git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: bug? in checkout with ambiguous refnames
Date: Wed, 12 Jan 2011 19:19:37 +0100	[thread overview]
Message-ID: <20110112181937.GK24920@pengutronix.de> (raw)
In-Reply-To: <20110112174600.GB31747@sigill.intra.peff.net>

Hi,

On Wed, Jan 12, 2011 at 12:46:00PM -0500, Jeff King wrote:
> On Wed, Jan 12, 2011 at 10:11:30AM +0100, Uwe Kleine-König wrote:
> > > > So working copy and cache are at refs/tags/sgu/mxs-amba-uart, HEAD
> > > > points to refs/heads/sgu/mxs-amba-uart
> > > 
> > > Yeah, we generally resolve ambiguities in favor of the tag (and that
> > > warning comes from deep within get_sha1_basic). So the real bug here is
> > > that it still said "Switched to branch", which is totally wrong.
> > I wonder how I can resolve the ambiguity when calling checkout.  (Well
> > apart from changing either branch name or tag name)
> > 
> > git checkout refs/heads/sgu/mxs-amba-uart results in a detached HEAD.
> 
> You can't disambiguate to the branch without going to a detached HEAD in
> the current code; it's just broken[1].
> 
> With the patch here:
> 
>   http://article.gmane.org/gmane.comp.version-control.git/164986
> 
> it will disambiguate to the branch by default, and if you want the tag,
> you can do:
> 
>   git checkout tags/sgu/mxs-amba-uart
that's fine.

> [1]: You can't do it with checkout, that is. You can still hack around
>      it with:
> 
>         branch=refs/heads/sgu/mxs-amba-uart
>         git read-tree -m -u $branch &&
>         git symbolic-ref HEAD $branch
I did

	git checkout refs/heads/sgu/mxs-amba-uart
	git symbolic-ref HEAD refs/heads/sgu/mxs-amba-uart

:-)

Uwe
> 
>      which is a simplified version of what checkout is doing.
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

      reply	other threads:[~2011-01-12 18:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07 10:46 bug? in checkout with ambiguous refnames Uwe Kleine-König
2011-01-07 19:44 ` Junio C Hamano
2011-01-07 19:49 ` Jeff King
2011-01-07 19:54   ` Jeff King
2011-01-07 22:50     ` Junio C Hamano
2011-01-07 23:17       ` Junio C Hamano
2011-01-11  6:52         ` Jeff King
2011-01-11 17:02           ` Junio C Hamano
2011-01-11 18:02             ` Jeff King
2011-01-12  1:25               ` Jeff King
2011-01-12  9:07                 ` Junio C Hamano
2011-01-12 17:27                   ` Jeff King
2011-01-11  6:55     ` Jeff King
2011-01-11 19:20       ` Jeff King
2011-01-11 20:00         ` Jeff King
2011-01-08 20:40   ` Martin von Zweigbergk
2011-01-08 21:40     ` Jeff King
2011-01-09  2:43       ` Martin von Zweigbergk
2011-01-09  7:31       ` Junio C Hamano
2011-01-09 16:18         ` Martin von Zweigbergk
2011-01-12  9:11   ` Uwe Kleine-König
2011-01-12 17:46     ` Jeff King
2011-01-12 18:19       ` Uwe Kleine-König [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=20110112181937.GK24920@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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).