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

git-gc "--aggressive" somewhat broken

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 6, 2007, 20:19 UTC
Message-ID
<alpine.LFD.0.999.0707061310390.8278@woody.linux-foundation.org>
This flag seems misdesigned as-is.

It makes the window bigger (good, and aggressive), but it also enabled "-f".

Which sometimes causes _worse_ packing.
In particular, there's a gcc import at
	git://git.infradead.org/toolchain/gcc.git

which apparently packs down quite nicely to a 450MB pack, but when it gets repacked "aggressively", it blows up to 1.4GB. The reason? That pack was generated using --depth=100 --window=100 (I think).

So under certain circumstances, "--aggressive" is anything _but_ aggressive, and actually causes much worse packing.

If we want to be really aggressive, we migth decide to pass a new flag to pack-objects that does something closer to what "aggressive" was meant to do: it would use existing delta's if they exist, but _despite_ existing it could look if there are even better choices.

So right now we have:
 - default behaviour:
   always re-use existing deltas, don't look at alternatives at all.
   This is optimal for CPU/memory/IO usage, and is generally a good idea
 - "-f" (and as a result, the current bad "git gc --aggressive"):
   never re-use existing deltas, always look for new ones.
   This is good if you have reason to believe that the old choices are 
   bad, or you need to force re-generation of deltas (because you want to 
   force a new pack-file format, for example)
and the missing piece might be
 - "git pack-objects --aggressive":
   re-use existing deltas _and_ look for even better ones.
   This is good if all you're looking for is better packing.
Hmm?
		Linus
Next: Linus Torvalds
Message 1 of 4 in “git-gc "--aggressive" somewhat broken”
  1. Linus TorvaldsJul 6, 2007
  2. Linus TorvaldsJul 6, 2007
  3. Linus TorvaldsJul 7, 2007
  4. Nicolas PitreJul 9, 2007

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.