Skip to contentSkip to conversation

git gc and git repack

DISCUSSION Sergio Callegari 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

I am puzzled by a different behavior when doing housekeeping with git-gc and git-repack:

On a repository I have, git gc gives:

Generating pack...
Done counting 75 objects.
Deltifying 75 objects.
100% (75/75) done
Writing 75 objects.
100% (75/75) done
Total 75 (delta 26), reused 68 (delta 26)
Pack pack-a989a4c4c7454874220cf502865ab9a28952499f created. Removing unused objects 100%...
Done.

while git repack -a -d gives

Generating pack...
Done counting 143 objects.
Deltifying 143 objects.
100% (143/143) done
Writing 143 objects.
100% (143/143) done
Total 143 (delta 49), reused 120 (delta 31)
Pack pack-d17fd54437f04fbde34088909e31e95718e7b8c5 created. Removing unused objects 100%...
Done.

Why is a different number of objects being considered in the two case, with git repack considering more objects and producing a different pack? Also, the package produced by repack turns out to be much larger than the one by git gc... In any case, both packages turn out to be git-fsck clean...

I suspect, this has to to with my repository using alternates... (in fact git-gc and git-repack start behaving identically if I pass the -l (local) option to repack... can anyone confirm that this is the only difference?

Also can anybody confirm whether git repack -a -d actually includes in the pack also _all_ the "borrowed" objects? I.e. if it is in fact a way to convert a repository that borrows objects into one that is self-standing?

#1 lore raw

Hi,

Quoted 7 lines · Sergio Callegari

I am puzzled by a different behavior when doing housekeeping with git-gc and git-repack:

[...]
Done counting 75 objects.
[...]

Quoted 8 lines

while git repack -a -d gives

Done counting 143 objects.

I suspect, this has to to with my repository using alternates... (in fact git-gc and git-repack start behaving identically if I pass the -l (local) option to repack... can anyone confirm that this is the only difference?

Yes. And if you look in git-gc, you'll see as to why: it uses the -l flag.

Quoted 4 lines

Also can anybody confirm whether git repack -a -d actually includes in the pack also _all_ the "borrowed" objects? I.e. if it is in fact a way to convert a repository that borrows objects into one that is self-standing?

Yes exactly.

Ciao,
Dscho