From: Derrick Stolee Date: Wed, 03 Oct 2018 13:42:55 GMT Subject: Re: We should add a "git gc --auto" after "git clone" due to commit graph Message-ID: <836a8d28-0879-73a5-7e0b-75f438ff6785@gmail.com> In-Reply-To: <20181003133650.GN23446@localhost> On 10/3/2018 9:36 AM, SZEDER Gábor wrote: > On Wed, Oct 03, 2018 at 03:23:57PM +0200, Ævar Arnfjörð Bjarmason wrote: >> Don't have time to patch this now, but thought I'd send a note / RFC >> about this. >> >> Now that we have the commit graph it's nice to be able to set >> e.g. core.commitGraph=true & gc.writeCommitGraph=true in ~/.gitconfig or >> /etc/gitconfig to apply them to all repos. >> >> But when I clone e.g. linux.git stuff like 'tag --contains' will be slow >> until whenever my first "gc" kicks in, which may be quite some time if >> I'm just using it passively. >> >> So we should make "git gc --auto" be run on clone, > There is no garbage after 'git clone'... And since there is no garbage, the gc will not write the commit-graph. > >> and change the >> need_to_gc() / cmd_gc() behavior so that we detect that the >> gc.writeCommitGraph=true setting is on, but we have no commit graph, and >> then just generate that without doing a full repack. > Or just teach 'git clone' to run 'git commit-graph write ...' I plan to add a 'fetch.writeCommitGraph' config setting. I was waiting until the file is incremental (on my to-do list soon), so the write is fast when only adding a few commits at a time. This would cover the clone case, too. Thanks, -Stolee