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

Re: [PATCH] gc: fix off-by-one error with gc.autoPackLimit

From
Jeff King <peff@peff.net>
Date
Jun 27, 2016, 19:38 UTC
Message-ID
<20160627193842.GD10877@sigill.intra.peff.net>
In-Reply-To
<20160625064647.GA20659@dcvr.yhbt.net>
On Sat, Jun 25, 2016 at 06:46:47AM +0000, Eric Wong wrote:
Show 20 quoted lines
> This matches the documentation and allows gc.autoPackLimit=1
> to maintain a single pack without attempting a repack on every
> "git gc --auto" invocation.
> 
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
>  builtin/gc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/gc.c b/builtin/gc.c
> index c583aad..332bcf7 100644
> --- a/builtin/gc.c
> +++ b/builtin/gc.c
> @@ -177,7 +177,7 @@ static int too_many_packs(void)
>  		 */
>  		cnt++;
>  	}
> -	return gc_auto_pack_limit <= cnt;
> +	return gc_auto_pack_limit < cnt;
>  }

Looks good, and I cannot think of any real downside. "0" is special for "do not use this limit", so you now have no way of asking to gc every time. But why would you want to? Asking for 1 pack is effectively "gc if something happened, otherwise do nothing".

-Peff
Previous: Eric Wong
Message 6 of 6 in “[RFC] gc: correct gc.autoPackLimit documentation”
  1. Eric WongJun 25, 2016
  2. Jeff KingJun 25, 2016
  3. Eric WongJun 25, 2016
  4. Junio C HamanoJun 25, 2016
  5. gc: fix off-by-one error with gc.autoPackLimitEric Wong, Jun 25, 2016
  6. Jeff KingJun 27, 2016

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.