git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Jeff King
Message 3 of 4 in “Removing redundant packs”
  1. Petr BaudisDec 8, 2007
  2. Junio C HamanoDec 8, 2007
  3. Jeff KingDec 8, 2007
  4. Jeff KingDec 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.