git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] run-command: honor "gc.auto" for auto-maintenance

From
Junio C Hamano <gitster@pobox.com>
Date
May 12, 2026, 01:21 UTC
Message-ID
<xmqqzf25pgm0.fsf@gitster.g>
In-Reply-To
<20260511201800.GC22912@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> On Mon, May 11, 2026 at 02:29:56PM +0200, Patrick Steinhardt wrote:
>
>> @@ -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
Very good point.  I was about to send the same message ;-)
Previous: Jeff KingNext: Patrick Steinhardt
Message 7 of 18 in “builtin/maintenance: fix locking and respect "gc.auto"”
  1. 0/2 builtin/maintenance: fix locking and respect "gc.auto"Patrick Steinhardt, May 11, 2026
  2. 1/2 builtin/maintenance: fix locking with "--detach"Patrick Steinhardt, May 11, 2026
  3. Junio C HamanoMay 12, 2026
  4. Patrick SteinhardtMay 12, 2026
  5. 2/2 run-command: honor "gc.auto" for auto-maintenancePatrick Steinhardt, May 11, 2026
  6. Jeff KingMay 11, 2026
  7. Junio C HamanoMay 12, 2026
  8. Patrick SteinhardtMay 12, 2026
  9. 0/2 builtin/maintenance: fix locking and respect "gc.auto"Patrick Steinhardt, May 13, 2026
  10. 1/2 builtin/maintenance: fix locking with "--detach"Patrick Steinhardt, May 13, 2026
  11. Junio C HamanoMay 13, 2026
  12. Taylor BlauMay 20, 2026
  13. Jeff KingMay 20, 2026
  14. Patrick SteinhardtMay 20, 2026
  15. 2/2 run-command: honor "gc.auto" for auto-maintenancePatrick Steinhardt, May 13, 2026
  16. Patrick SteinhardtMay 21, 2026
  17. Junio C HamanoMay 21, 2026
  18. Patrick SteinhardtMay 21, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.