Thread (14 messages) flat view 14 messages, 10 authors, 2018-10-07

Re: People unaware of the importance of "git gc"?

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:33

Possibly related (same subject, not in this thread)

Steven Grimm [off-list ref] wrote:
Shawn O. Pearce wrote:
quoted
But this suffers from the same fate if the user sets gc.auto too
small and doesn't realize that the reason Git is always repacking
is because over the last 6 months they have been unlucky enough to
stage the magic number of unreachable blobs into the 17 directory
and they have *never* run `git gc --prune` because the auto thing
is working just fine for them and they don't realize they need to
prune every once in a blue moon.
Check the modification times on those files and don't count ones that 
are older than the last git-gc run, maybe? That'd take care of the problem.
Eh, that could mean a bunch of stat calls that it would be nice
to avoid.  The counter Junio (and git-gui) implements just does
a readdir().  Reasonably cheap.

Maybe just save a ".git/gc_last_auto" with the last object count
of .git/objects/17, after repacking.  If the count is over the
gc.auto limit *and* is still over the limit after subtracting the
".git/gc_last_auto" value then consider that auto is required.

This way the file is only consulted if we are really thinking
about running a repack, and its only written to if we actually do
the repack.  So we only take the extra penalty if we are going to
be taking a *really* big extra penalty by repacking.

-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help