Re: [PATCH] Add option -b/--branch to clone for select a new HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> On Tue, Aug 25, 2009 at 11:27:47PM +0400, Kirill A. Korinskiy wrote:
>
>> +test_expect_success 'clone' '
>> +
>> +	git clone parent clone &&
>> +	(cd clone && git rev-parse --verify refs/remotes/origin/master)
>> +
>> +'
>> +
>> +test_expect_success 'clone -b' '
>> +
>> +	git clone -b two parent clone-b &&
>> +	(cd clone-b && test $(git rev-parse --verify HEAD) = $(git rev-parse --verify refs/remotes/origin/two))
>> +
>> +'
>
> OK, I think that second test makes sense (though please wrap the very
> long line), but now what is the first one doing? Shouldn't it be:
>
>   (cd clone &&
>    test $(git rev-parse --verify HEAD) = \
>         $(git rev-parse --verify refs/remotes/origin/master)
>   )
>
> also?

Are you checking that the HEAD (whichever branch it points at) points at
the same commit, or are you also interested in the _current branch_ to be
a particular name as well?  The suggested check only compares commits and
HEAD can be pointing at a local branch whose name is xyzzy.

What is the semantics of this new -b option?  When the remote repository
has 'next' as its default branch (i.e. HEAD points at it), and if you run
clone with "-b maint" against it, I expect that the checked out commit
will be the 'maint' of remote repository, but what is the name of the
current branch in the resulting clone on our end?

 - Would we use 'master' as the name of our current branch, because that
   is the default?

 - Would we use 'next' as the name of our current branch, because that is
   what the remote side uses?

 - Would we use 'maint', because that is what -b gave us?

I am _hoping_ it is the last one, as otherwise you would also need to make
sure that the branch that is different from 'maint' we set as the current
branch must track 'maint' from the remote.

Oh, with -b, would we set up our 'maint' to track their 'maint'?  Is it
something you may want to verify as well?

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]