Re: gc getting called on each git command ... what's wrong?
On 06/08/2011 11:02 AM, Drew Northup wrote:
Show 21 quoted lines
>
> On Tue, 2011-06-07 at 21:48 -0400, Peter Harris wrote:
>> On Tue, Jun 7, 2011 at 9:33 PM, Geoff Russell wrote:
>>>
>>> As of today, almost every time I do a git command, gc is getting
>>> invoked.
> <re-added>
>>> I have packSizeLimit set to 30M
> </re-added>
>>> There are 96 pack files.
>>
>> That's why. See gc.autopacklimit in "git help config" -- by default,
>> git will gc if there are more than 50 pack files.
>
> Do we want to consider ignoring (or automatically doubling, or something
> like that) gc.autopacklimit if that number of packs meet or exceed
> gc.packSizeLimit? I have no idea what the patch for this might look
> like, but it seems to make more sense than this situation.
>
> Just a random brain fart...
>
Or just ignore the packs that exceed pack.packSizeLimit...
diff --git a/builtin/gc.c b/builtin/gc.c
index ff5f73b..7be14ab 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -26,6 +26,7 @@ static int pack_refs = 1;
static int aggressive_window = 250;
static int gc_auto_threshold = 6700;
static int gc_auto_pack_limit = 50;
+static off_t pack_size_limit;
static const char *prune_expire = "2.weeks.ago";
#define MAX_ADD 10
@@ -64,6 +65,10 @@ static int gc_config(const char *var, const char *value, void *cb)
}
return git_config_string(&prune_expire, var, value);
}
+ if (!strcmp(var, "pack.packsizelimit")) {
+ pack_size_limit = git_config_ulong(var, value);
+ return 0;
+ }
return git_default_config(var, value, cb);
}
@@ -135,10 +140,8 @@ static int too_many_packs(void)
continue;
if (p->pack_keep)
continue;
- /*
- * Perhaps check the size of the pack and count only
- * very small ones here?
- */
+ if (pack_size_limit && p->pack_size >= pack_size_limit)
+ continue;
cnt++;
}
return gc_auto_pack_limit <= cnt;