Re: [RFC PATCH] We should add a "git gc --auto" after "git clone" due to commit graph
- From
Jeff King <peff@peff.net>
- Date
- Oct 5, 2018, 19:47 UTC
- Message-ID
- <20181005194703.GA19735@sigill.intra.peff.net>
- In-Reply-To
- <934fa00e-f6df-c333-4968-3e9acffab22d@gmail.com>
On Fri, Oct 05, 2018 at 03:41:40PM -0400, Derrick Stolee wrote:
> > So can we really just take (total_objects - commit_graph_objects) and > > compare it to some threshold? > > The commit-graph only stores the number of _commits_, not total objects.
Oh, right, of course. That does throw a monkey wrench in that line of thought. ;)
There's unfortunately not a fast way of doing that. One option would be to keep a counter of "ungraphed commit objects", and have callers update it. Anybody admitting a pack via index-pack or unpack-objects can easily get this information. Commands like fast-import can do likewise, and "git commit" obviously increments it by one.
I'm not excited about adding a new global on-disk data structure (and the accompanying lock).
-Peff