From: Patrick Steinhardt <ps@pks.im>
To: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, mail@thomasbachem.com,
ttaylorr@openai.com
Subject: Re: [PATCH] maintenance: trace when auto maintenance skips due to lock
Date: Mon, 2 Nov 2026 09:29:33 +0100 [thread overview]
Message-ID: <auhJ0B_1__9z3DEC@pks.im> (raw)
In-Reply-To: <20261101105859.25579-2-pushkarkumarsingh1970@gmail.com>
On Sun, Nov 01, 2026 at 10:59:00AM +0000, Pushkar Singh wrote:
> diff --git a/builtin/gc.c b/builtin/gc.c
> index 81cecf6b6c..e73d1f1d49 100644
> --- a/builtin/gc.c
> +++ b/builtin/gc.c
> @@ -1409,6 +1409,8 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
> * recursive process stack. Do not report an error in
> * that case.
> */
> + if (opts->auto_flag && errno == EEXIST)
> + trace2_data_string("maintenance", r, "lock/skip", "exists");
So we now know to report failure when the lock exists already, but in
any other case we don't log anything at all. But wouldn't the caller
want to know when we failed because of for example EPERM, too, or
because of any other error?
> if (!opts->auto_flag && !opts->quiet)
> warning(_("lock file '%s' exists, skipping maintenance"),
> lock_path);
It's quite curious that we only print a warning when `git maintenance
run` has failed to acquire the lock instead of bubbling up an error. I
would have expected that we:
- Exit successfully but print a warning in the case where we are
executed with "--auto".
- Exit with an error code and print an error in the case where we
execute without "--auto".
Silently swallowing the fact that we didn't do anything in the latter
case certainly feels wrong to me. And git-gc(1) for example dies right
away when the lock exists, so that to me is another indicator that we
should follow and do the same for git-maintenance(1).
This is of course outside the scope of your patch series, but if you
feel like it I think it could be easily fixed while at it in a second
patch.
Thanks!
Patrick
next prev parent reply other threads:[~2026-11-02 8:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 10:59 [PATCH] maintenance: trace when auto maintenance skips due to lock Pushkar Singh
2026-11-02 8:29 ` Patrick Steinhardt [this message]
2026-11-02 12:23 ` Pushkar Singh
2026-11-02 12:29 ` [PATCH v2] maintenance: improve handling of lock acquisition failures Pushkar Singh
2026-11-02 12:51 ` Patrick Steinhardt
2026-11-03 17:34 ` Pushkar Singh
2026-11-04 17:34 ` [PATCH v3 0/2] maintenance: improve lock acquisition failure handling Pushkar Singh
2026-11-04 17:34 ` [PATCH v3 1/2] maintenance: report lock acquisition failures Pushkar Singh
2026-11-04 17:34 ` [PATCH v3 2/2] maintenance: trace " Pushkar Singh
2026-11-04 18:00 ` [PATCH v2] maintenance: improve handling of " Aniket Gupta
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=auhJ0B_1__9z3DEC@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mail@thomasbachem.com \
--cc=pushkarkumarsingh1970@gmail.com \
--cc=ttaylorr@openai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.