From: Derrick Stolee Date: Fri, 05 Oct 2018 20:00:12 GMT Subject: Re: [RFC PATCH] We should add a "git gc --auto" after "git clone" due to commit graph Message-ID: <14529aaa-fee0-e839-4629-bf87cdd13e31@gmail.com> In-Reply-To: <20181005194703.GA19735@sigill.intra.peff.net> On 10/5/2018 3:47 PM, Jeff King wrote: > 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). If we want, then we can add an optional chunk to the commit-graph file that stores the object count.