Is there a definitive list of commands anywhere that cause git gc --auto
to run? The git-gc(1) man page simply states:
--auto
With this option, git gc checks whether any housekeeping is required; if not, it exits without performing any work. Some git commands run git gc --auto
after performing operations that could create many loose objects.
(emphasis added)
I'm in the process of organising a large migration from SVN to Git. The overwhelming majority of users will be on Windows PCs, and a not-insignificant portion of them are non-technical. They will be using TortoiseGit (as it closely matches TortoiseSVN, which they are already familiar with) - I've noticed that TortoiseGit does not include any functionality to run git gc
manually at all.
The non-technical staff cannot be expected to have to launch a "git bash" command line to run git gc --auto
from the appropriate working dir; and as we are using the "portable" distribution of MsysGit they will not have the "Git GUI Here.." windows shell context menu shortcut.
Is it reasonable to expect that over time Git will mostly self-maintain, or do I need to try and work out a non-technical user friendly method of invoking git gc --auto
?
builtin/merge.c: const char *argv_gc_auto[] = { "gc", "--auto", NULL };
builtin/receive-pack.c: "gc", "--auto", "--quiet", NULL,
git-am.sh: git gc --auto
git-rebase--interactive.sh: git gc --auto &&
git-svn.perl: command_noisy('gc', '--auto');
From git grep -- --auto
on git.git, those results looked interesting. The notable one is builtin/merge.c
meaning that the ever so common git pull
should trigger a git gc --auto
.
Additionally, unless your 'non-technical' staff is doing rather 'advanced' stuff (at which point they wouldn't be 'non-technical' anymore), I don't see why they would ever need to run git gc
manually instead of just letting git gc --auto
handle everything.
With Git 2.17 (Q2 2018), you will have to add git commit
to the list of commands triggering a git gc --auto
.
Actually, that should have been the case since the beginning of Git.
See commit 095c741 (28 Feb 2018) by Ævar Arnfjörð Bjarmason (avar
).
(Merged by Junio C Hamano -- gitster
-- in commit 9bb8eb0, 08 Mar 2018)
commit
: run git gc --auto
just before the post-commit
hook
Change the behavior of git-commit
back to what it was back in
d4bb43e ("Invoke "git gc --auto
" from commit
, merge
, am
and
rebase
.", 2007-09-05, Git v1.5.4-rc0) when it was git-commit.sh
.
Shortly afterwards in f5bbc32 ("Port git commit
to C.", 2007-11-08, Git v1.5.4-rc0) when it was ported to C, the "git gc --auto
" invocation went away.
Since that unintended regression, git gc --auto
only ran for git-am
,
git-merge
, git-fetch
, and git-receive-pack
.
It was possible to write a script that would "git commit
" a lot of data locally, and gc
would never run.
One such repository that was locally committing generated zone file
changes had grown to a size of ~60GB before a daily cronjob was added
to "git gc
", bringing it down to less than 1GB. This will make such
cases work without intervention.
I think fixing such pathological cases where the repository will grow
forever is a worthwhile trade-off for spending a couple of
milliseconds calling "git gc --auto
" (in the common cases where it
doesn't do anything).