From: Jeff King <peff@peff.net>
To: Zdenek Crha <zdenek.crha@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Git clone behave strange after active branch change in bare repo
Date: Mon, 12 Mar 2012 07:12:42 -0400 [thread overview]
Message-ID: <20120312111242.GA12921@sigill.intra.peff.net> (raw)
In-Reply-To: <CA+OUE95+Ux_+hSRJw6MH-kh54JewXx-fbWqBoh-Eh_P1tNwAFA@mail.gmail.com>
On Mon, Mar 12, 2012 at 11:10:03AM +0100, Zdenek Crha wrote:
> When I run git clone while 'master' and 'a_branch' point to same
> commit, I will get clone with default branch 'master' where I would
> expect default branch 'a_branch'.
Yes, this is a known issue. The git protocol does not transfer the
contents of the symref; the client must guess the branch name from the
set of refs that are advertised. This has been discussed before, and
there were even some patches proposed, but I think nobody cared enough
to push it through, as it requires an extension to the protocol.
You can search the list archives for past discussions.
> I did few more checks and it seems to me that:
>
> * when active branch is 'master' then default branch in clone is
> always master as expected
> * when active branch is different from 'master', then the default
> branch in clone is a first branch in alfabetically sorted list of
> branches that point to same commit as active branch
Exactly. The relevant code is in remote.c:guess_remote_head.
-Peff
prev parent reply other threads:[~2012-03-12 11:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-12 10:10 Git clone behave strange after active branch change in bare repo Zdenek Crha
2012-03-12 11:12 ` Jeff King [this message]
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=20120312111242.GA12921@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=zdenek.crha@gmail.com \
/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).