Re: [PATCH 2/2] run-command: honor "gc.auto" for auto-maintenance
- From
Jeff King <peff@peff.net>
- Date
- May 11, 2026, 20:18 UTC
- Message-ID
- <20260511201800.GC22912@coredump.intra.peff.net>
- In-Reply-To
- <20260511-pks-maintenance-fix-lock-with-detach-v1-2-ccd7d62c9a40@pks.im>
On Mon, May 11, 2026 at 02:29:56PM +0200, Patrick Steinhardt wrote:
Show 11 quoted lines
> @@ -1946,8 +1946,10 @@ int prepare_auto_maintenance(struct repository *r, int quiet,
> {
> int enabled, auto_detach;
>
> - if (!repo_config_get_bool(r, "maintenance.auto", &enabled) &&
> - !enabled)
> + if (repo_config_get_bool(r, "maintenance.auto", &enabled) &&
> + repo_config_get_bool(r, "gc.auto", &enabled))
> + enabled = 1;
> + if (!enabled)
> return 0;gc.auto isn't a bool; it's the count of loose objects after which to run maintenance. So "0" works in both contexts, but will we complain if gc.auto is set to 100? I think maybe not, because we fall back to git_parse_int(), but it feels kind of fragile.
The gc code uses repo_config_get_int() here.
-Peff