Re: Removing redundant packs
- From
Jeff King <peff@peff.net>
- Date
- Dec 8, 2007, 23:44 UTC
- Message-ID
- <20071208234414.GA31121@sigill.intra.peff.net>
- In-Reply-To
- <7vsl2cvpef.fsf@gitster.siamese.dyndns.org>
On Sat, Dec 08, 2007 at 01:37:44PM -0800, Junio C Hamano wrote:
Show 5 quoted lines
> (1) In each repository, run "repack -a -d". That would ensure that > everybody has the necessary objects that they themselves need. By > doing this for a repository that borrows from another makes sure > pruning the latter would not break the former, so you start from > leaves and move on to the repositories they borrow from.
I'm not sure this works. Try this:
# make parent repo with two commits, fully packed mkdir parent && cd parent && git init && echo content >file && git add file && git commit -m added && echo more >>file && git commit -m more -a && git repack -a -d
# clone child repo with alternates git clone -s . ../child
# and now forget about the second commit in the parent git reset --hard HEAD^ rm -rf .git/logs
# at this point the "parent" repo doesn't know anything about the second # commit, but contains the objects; the child repo does know about it, # but relies on the pack in the parent for the objects
# so your advice is to "repack -a -d" first in the child, then in the # parent. # child first; output will be: "Nothing new to pack." cd ../child && git repack -a -d # and then parent, which will lose the objects for the second commit cd ../parent && git repack -a -d
# and confirm that child is broken # output is: "fatal: bad object HEAD" cd ../child && PAGER=cat git show
You seem to think that repacking without "-l" will pull objects from alternates, but it doesn't (I have also seen "repack -a -d" recommended for "how do I break alternates dependencies", but it obviously also doesn't work for that).
-Peff