git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Kirill A. Korinskiy" <catap@catap.ru>, git@vger.kernel.org
Subject: Re: [PATCH] Add option -b/--branch to clone for select a new HEAD
Date: Tue, 25 Aug 2009 15:42:36 -0700	[thread overview]
Message-ID: <7vvdkbms6b.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20090825215726.GA30981@coredump.intra.peff.net> (Jeff King's message of "Tue\, 25 Aug 2009 17\:57\:26 -0400")

Jeff King <peff@peff.net> 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?

  reply	other threads:[~2009-08-25 22:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87praj90n8.wl%catap@catap.ru>
2009-08-25 19:25 ` [PATCH] Add option -b/--branch to clone for select a new HEAD Kirill A. Korinskiy
2009-08-25 19:27   ` Kirill A. Korinskiy
2009-08-25 21:57     ` Jeff King
2009-08-25 22:42       ` Junio C Hamano [this message]
2009-08-25 22:36     ` Björn Steinbrink
     [not found]       ` <87ljl694fd.wl%catap@catap.ru>
2009-08-26 12:16         ` Björn Steinbrink
2009-08-26 14:46           ` Kirill A. Korinskiy
2009-08-26 15:50             ` Björn Steinbrink
2009-08-26 16:10               ` Jeff King
2009-08-26 16:56                 ` Björn Steinbrink
2009-08-26 17:48                   ` Jeff King
2009-08-26 19:05                     ` Jeff King
2009-08-28 10:31   ` Tor Arne Vestbø
2009-08-28 11:05     ` Martin Langhoff
2009-08-28 12:10       ` Julian Phillips
2009-08-24 20:42 Kirill A. Korinskiy
2009-08-25  1:57 ` Jeff King
2009-08-25  2:13   ` Junio C Hamano
2009-08-25 17:20     ` Kirill A. Korinskiy
2009-08-25 19:00       ` Jeff King
2009-08-25 12:30   ` Kirill A. Korinskiy

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=7vvdkbms6b.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=catap@catap.ru \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).