git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Petr Baudis <pasky@ucw.cz>, git@vger.kernel.org
Subject: Re: Removing redundant packs
Date: Sat, 8 Dec 2007 18:44:15 -0500	[thread overview]
Message-ID: <20071208234414.GA31121@sigill.intra.peff.net> (raw)
In-Reply-To: <7vsl2cvpef.fsf@gitster.siamese.dyndns.org>

On Sat, Dec 08, 2007 at 01:37:44PM -0800, Junio C Hamano wrote:

>  (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

  reply	other threads:[~2007-12-08 23:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-08 12:50 Removing redundant packs Petr Baudis
2007-12-08 21:37 ` Junio C Hamano
2007-12-08 23:44   ` Jeff King [this message]
2007-12-08 23:50     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071208234414.GA31121@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).