From: Jeff King Date: Mon, 27 Jun 2016 19:38:42 GMT Subject: Re: [PATCH] gc: fix off-by-one error with gc.autoPackLimit 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: > 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 > --- > 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