From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t6300: avoid creating refs/heads/HEAD
Date: Mon, 27 Feb 2017 11:33:23 -0800 [thread overview]
Message-ID: <xmqqzih7whrw.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170227092931.7iquwaxomeuuusi2@sigill.intra.peff.net> (Jeff King's message of "Mon, 27 Feb 2017 04:29:31 -0500")
Jeff King <peff@peff.net> writes:
> This comes originally from Junio's 84679d470. I cannot see how naming
> the new branch HEAD would make any difference to the test, but perhaps I
> am missing something.
Nah, I think it was just a random string that came to mind and the
topic being "ah we blindly dereference something when showing %(HEAD)"
it was plausible I thought of "H E A D" as that random string before
I used my usual other random strings like frotz ;-)
> I noticed this while digging on a nearby issue around "git branch -m @".
> This does happen to be the only test that checks that we can make a
> branch called refs/heads/HEAD, and I found it because it triggers if you
> try to disallow "git branch -m HEAD". :)
About that "nearby" one, does it even make sense to do the interpret
thing on the <new> name? I can understand "please rename the branch
I was previously on to this new name" wanting to say @{-1} when the
user does not recall the exact spelling of a long name, but I do not
quite see how "to this new name" part benefits by the "interpret
branch name" magic in the first place.
> If we care about that, though, I think we should make an explicit test
> for "git branch HEAD". But I'm not sure we _do_ care about that. Making
> a branch called HEAD is moderately insane, and I don't think it would be
> unreasonable for us to outlaw it at some point.
Yeah, at that point we would have "test_must_fail git branch HEAD".
> t/t6300-for-each-ref.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
> index aea1dfc71..a468041c5 100755
> --- a/t/t6300-for-each-ref.sh
> +++ b/t/t6300-for-each-ref.sh
> @@ -558,7 +558,7 @@ test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
> test_when_finished "git checkout master" &&
> git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
> sed -e "s/^\* / /" actual >expect &&
> - git checkout --orphan HEAD &&
> + git checkout --orphan orphaned-branch &&
> git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
> test_cmp expect actual
> '
next prev parent reply other threads:[~2017-02-27 19:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 9:29 [PATCH] t6300: avoid creating refs/heads/HEAD Jeff King
2017-02-27 19:33 ` Junio C Hamano [this message]
2017-02-27 20:51 ` Jeff King
2017-02-27 21:19 ` Junio C Hamano
2017-02-27 21:41 ` Jeff King
2017-02-27 22:18 ` Junio C Hamano
2017-02-27 21:44 ` Junio C Hamano
2017-02-27 21:46 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzih7whrw.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).