threads / discuss / 7112

git gc and git repack

Subject: git gc and git repack

## tl;dr

2 messages between Mar 6, 2007 and Mar 6, 2007.

replies: 1people: 2as markdown or json

Sergio Callegari· Mar 6, 2007, 16:13 UTC · lore
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?

Johannes Schindelin· Mar 6, 2007, 21:13 UTC · re: Sergio Callegari · lore

Re: git gc and git repack

Hi,
On Tue, 6 Mar 2007, Sergio Callegari wrote:
Show 15 quoted lines
> I am puzzled by a different behavior when doing housekeeping with git-gc and
> git-repack:
>
> [...] 
> Done counting 75 objects.
> [...]
>
> 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.
> 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

← back to recent threads