From: Junio C Hamano <gitster@pobox.com>
To: "Shubham Kanodia via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Shubham Kanodia <shubham.kanodia10@gmail.com>,
Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH v3] maintenance: add prune-remote-refs task
Date: Fri, 03 Jan 2025 11:02:21 -0800 [thread overview]
Message-ID: <xmqqbjwnra9u.fsf@gitster.g> (raw)
In-Reply-To: <pull.1838.v3.git.1735928035056.gitgitgadget@gmail.com> (Shubham Kanodia via GitGitGadget's message of "Fri, 03 Jan 2025 18:13:54 +0000")
"Shubham Kanodia via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Shubham Kanodia <shubham.kanodia10@gmail.com>
>
> Remote-tracking refs can accumulate in local repositories even as branches
> are deleted on remotes, impacting git performance negatively. Existing
> alternatives to keep refs pruned have a few issues:
>
> 1. Running `git fetch` with either `--prune` or `fetch.prune=true`
> set, with the default refspec to copy all their branches into
> our remote-tracking branches, will prune stale refs, but also
> pulls in new branches from remote. That is undesirable if the
> user wants to only work with a selected few remote branches.
>
> 2. `git remote prune` cleans up refs without adding to the
> existing list but requires periodic user intervention.
>
> Add a new maintenance task 'prune-remote-refs' that runs 'git remote
> prune' for each configured remote daily. Leave the task disabled by
> default, as it may be unexpected to see their remote-tracking
> branches to disappear while they are not watching for unsuspecting
> users.
There is no description on how and why the prefetch job has been
modified here.
I haven't formed a strong opinion on the "should we keep going after
the first failure?" question yet, and if this topic is modifying the
way how the prefetch operates, the patch(es) should be CC'ed to the
author of that feature (The author of 28cb5e66 (maintenance: add
prefetch task, 2020-09-25) CC'ed).
If it turns out to be a good idea to do so, I would expect the topic
to consist of at least two patches:
- [PATCH 1/2] to argue that it is a bug that the prefetch job stops
at the first failed remote, and change its behaviour to prefetch
from all remotes and then report a failure if the prefetch failed
for any remote. With some additional tests to check the updated
behaviour.
- [PATCH 2/2] to argue the need for periodic `remote prune`, and do
the part of this patch that relates to that new feature.
> +struct remote_cb_data {
> + struct maintenance_run_opts *maintenance_opts;
> + struct string_list failed_remotes;
> +};
> +
> +static void report_failed_remotes(struct string_list *failed_remotes,
> + const char *action_name)
> +{
> + if (failed_remotes->nr) {
> + int i;
> + struct strbuf msg = STRBUF_INIT;
> + strbuf_addf(&msg, _("failed to %s the following remotes: "),
> + action_name);
> + for (i = 0; i < failed_remotes->nr; i++) {
> + if (i)
> + strbuf_addstr(&msg, ", ");
> + strbuf_addstr(&msg, failed_remotes->items[i].string);
> + }
> + error("%s", msg.buf);
> + strbuf_release(&msg);
> + }
> +}
A few comments:
- The message pretends to be _("localizable"), but the sentence
logo inserts action_name that is not translated. If the
operation failed only for a single remote, "following remotes" is
grammatically incorrect.
- Would it be useful to force this message to a single line, with
multiple remote names concatenated with ","? Computer output of
a listing often is more useful without "," if it is meant to be
consumable for cut-and-paste users.
Overall, I am fairly negative on the report this helper tries to
give the users. Because we are going to do the operation on all
remotes anyway, wouldn't we have let the underlying operations (like
"git fetch" or "git remore prune") already issue error messages to
the user? Do we need this extra reporting on top at all?
Thanks.
next prev parent reply other threads:[~2025-01-03 19:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-23 9:36 [PATCH] maintenance: add prune-remote-refs task Shubham Kanodia via GitGitGadget
2024-12-27 9:07 ` Junio C Hamano
2024-12-28 9:58 ` Shubham Kanodia
2024-12-28 16:05 ` Junio C Hamano
2024-12-28 16:24 ` Shubham Kanodia
2024-12-28 10:07 ` [PATCH v2] " Shubham Kanodia via GitGitGadget
2024-12-28 16:25 ` Junio C Hamano
2024-12-30 7:15 ` Patrick Steinhardt
2024-12-30 14:05 ` Junio C Hamano
2025-01-03 6:50 ` Shubham Kanodia
2025-01-03 7:38 ` Patrick Steinhardt
2025-01-03 18:13 ` [PATCH v3] " Shubham Kanodia via GitGitGadget
2025-01-03 19:02 ` Junio C Hamano [this message]
[not found] ` <CAG=Um+1ch1sKC0H8MJoFv=6iSK3pvA=03AKXmvhm5DG=H8T1rw@mail.gmail.com>
2025-01-07 17:29 ` Shubham Kanodia
2025-01-07 18:48 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqbjwnra9u.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=ps@pks.im \
--cc=shubham.kanodia10@gmail.com \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).