[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: 'git clone' doesn't use alternates automatically?
From:       Jeff King <peff () peff ! net>
Date:       2009-01-31 21:55:14
Message-ID: 20090131215514.GB9415 () coredump ! intra ! peff ! net
[Download RAW message or body]

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 cloning

The 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 clone

      or

  - 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




--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic