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

Re: gc getting called on each git command ... what's wrong?

From
BCBrandon Casey <brandon.casey.ctr@nrlssc.navy.mil>
Date
Jun 8, 2011, 16:29 UTC
Message-ID
<mHQrb8DBZuqQY8Hc3UzxeMQ_IVnTRI-lDtGLq4eawjiPycP6aZDRrQ@cipher.nrlssc.navy.mil>
In-Reply-To
<1307548930.19438.30.camel@drew-northup.unet.maine.edu>
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;
Previous: Drew NorthupNext: Junio C Hamano
Message 4 of 10 in “gc getting called on each git command ... what's wrong?”
  1. Geoff RussellJun 8, 2011
  2. Peter HarrisJun 8, 2011
  3. Drew NorthupJun 8, 2011
  4. Brandon CaseyJun 8, 2011
  5. Junio C HamanoJun 8, 2011
  6. Jakub NarebskiJun 8, 2011
  7. Geoff RussellJun 15, 2011
  8. Jakub NarebskiJun 15, 2011
  9. Geoff RussellJun 16, 2011
  10. Jakub NarebskiJun 16, 2011

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.