Re: 'git clone' doesn't use alternates automatically?
- From
Jeff King <peff@peff.net>
- Date
- Jan 31, 2009, 21:55 UTC
- Message-ID
- <20090131215514.GB9415@coredump.intra.peff.net>
- In-Reply-To
- <885649360901311208s4bc17ae3me2062b07b302291e@mail.gmail.com>
On Sat, Jan 31, 2009 at 01:08:16PM -0700, James Pickens wrote:
> Well, the clone gets the alternates either way. It just doesn't > use them to avoid copying the data unless I give -s. More
The other key change is that you don't depend on the origin in your alternates when you don't use "-s".
> So, is there any reason 'git clone' shouldn't automatically use > the alternates that it copied into the new repository? I might > look into writing a patch if nobody objects.
I think the reason "-s" isn't the default is that alternates are fragile (as Jakub mentioned), and we don't want ot set them up without the user asking to do so.
So from what you've posted (but I haven't double checked or looked at the code), it sounds like the current behavior is:
- with "-s", add the origin as an alternate, and use alternates while
cloning - "with --reference", add some other repo as an alternate, and use
alternates while cloning - without either, copy alternates from origin, but _don't_ use
alternates while cloningThe last one seems a little silly. Why bother setting up the alternates if you're not going to use them? I guess because we might not be able to get the objects at all, otherwise, and we need to know where to copy them from. But either:
- that is an implementation-specific detail of clone, and those
alternates should go away after we cloneor
- we should fully respect those alternates
The only downside to the latter is that now somebody who has cloned a repository with alternates now has an alternates-based repository and might not know it (i.e., they might have been the one who set up alternates in the origin).
-Peff