git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH 1/2] sha1_name.c: signal if @{-N} was a true branch nameor a detached head
Date: Thu, 9 May 2013 14:24:42 -0400	[thread overview]
Message-ID: <CAPig+cS-SyANELP5N9ch2UQgsDaJmfnm0qqPBQ+71ctGDXzzYg@mail.gmail.com> (raw)
In-Reply-To: <7vk3n9dvlu.fsf@alter.siamese.dyndns.org>

On Wed, May 8, 2013 at 5:12 PM, Junio C Hamano <gitster@pobox.com> wrote:
> sha1_name.c: signal if @{-N} was a true branch nameor a detached head

s/nameor/name or/

> The original API read "checkout: moving from (.*) to ..." from the
> reflog of the HEAD, and returned the substring between "from" and
> "to", but there was no way, if the substring was a 40-hex string, to
> tell if we were on a detached HEAD at that commit object, or on a
> branch whose name happened to be the 40-hex string.
>
> At this point, we cannot afford to change the format recorded in the
> reflog, so introduce a heuristics to see if the 40-hex matches the
> object name of the commit we are switching out of.  This will
> unfortunately mishandle this case:
>
>         HEX=$(git rev-parse master)
>         git checkout -b $HEX master
>         git checkout master
>
> where we were indeed on a non-detached $HEX branch (i.e. HEAD was
> pointing at refs/heads/$HEX, not storing $HEX), of course, but
> otherwise should be fairly reliable.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

      parent reply	other threads:[~2013-05-09 18:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 21:12 [PATCH 1/2] sha1_name.c: signal if @{-N} was a true branch nameor a detached head Junio C Hamano
2013-05-08 21:18 ` [PATCH 2/2] interpret_branch_name(): unconfuse @{-1}@{u} when @{-1} is detached Junio C Hamano
2013-05-08 21:32 ` [non PATCH */2] preparatory analysis of remaining @{...} issues Junio C Hamano
2013-05-09  6:46 ` [PATCH 1/2] sha1_name.c: signal if @{-N} was a true branch nameor a detached head Jeff King
2013-05-09 17:08   ` Junio C Hamano
2013-05-13 12:04     ` Jeff King
2013-05-09 18:24 ` Eric Sunshine [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=CAPig+cS-SyANELP5N9ch2UQgsDaJmfnm0qqPBQ+71ctGDXzzYg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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).