All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "D. Ben Knoble" <ben.knoble@gmail.com>,
	"Bence Csókás" <bence.csokas@arm.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>
Subject: Re: [Bug] Porcelain allows creation of '@' branch
Date: Thu, 03 Sep 2026 10:38:31 +0200	[thread overview]
Message-ID: <958622c0-e0a5-4e27-9815-cd1fff2ed111@app.fastmail.com> (raw)
In-Reply-To: <CALnO6CCph_xC394v_BetLPyoriYc9dLZY42LsXhjVNdvt2e-cQ@mail.gmail.com>

On Mon, Aug 31, 2026, at 21:59, D. Ben Knoble wrote:
> On Mon, Aug 31, 2026 at 3:12 PM Bence Csókás <bence.csokas@arm.com> wrote:
>>
>> Hi,
>>
>> I ran into this issue a few weeks ago. I'm using Git 2.55.0, which is
>> the latest released.
>>
>> `git help check-ref-format` says this about a branch name:
>>
>>    [...]
>>    9. They cannot be the single character @.
>>    [...]
>
> This is the rule for a reference.
>
>> And as expected, it is rejected:
>>
>>    $ git check-ref-format @ && echo BUG!
>>    $
>>
>> However, the following commands all create a branch named @ :
>>
>>    $ git checkout -b @
>>    $ git switch -c @
>>    $ git branch @
>
> But (with git refs list) we should see this creates a ref "refs/heads/@".
>
> I happen to think that's extremely confusing given that "@" is the
> shorthand for HEAD, but… it's not against the current documented
> rules, I think. (e.g., "git switch @" will fail, since it sees "git
> switch HEAD"; using "refs/heads/@" will also fail.) git-checkout
> doesn't fail but also doesn't change to the "@" branch. Futzing with
> .git/HEAD and restoring the working tree works, but… yikes.
>
> Of course, --branch mode is allowed to be stricter; maybe we should
> reject this case?

Not a bug (2024) https://lore.kernel.org/git/xmqqy12z7eti.fsf@gitster.g/

    I suspect that it is much more productive to deprecate and remove
    "@" that is a built-in synomym for HEAD (but "refs/remotes/origin/@"
    does not act as a synonym for "refs/remotes/origin/HEAD"). [...]

>[snip]

  parent reply	other threads:[~2026-09-03  8:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 14:22 [Bug] Porcelain allows creation of '@' branch Bence Csókás
2026-08-31 19:59 ` D. Ben Knoble
2026-09-02  7:37   ` Jeff King
2026-09-03  8:38   ` Kristoffer Haugsbakk [this message]
2026-09-03 12:35     ` Bence Csókás
2026-09-03 15:14       ` Ben Knoble
2026-09-03 18:45         ` Junio C Hamano
2026-09-06  7:56           ` Kristoffer Haugsbakk

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=958622c0-e0a5-4e27-9815-cd1fff2ed111@app.fastmail.com \
    --to=kristofferhaugsbakk@fastmail.com \
    --cc=ben.knoble@gmail.com \
    --cc=bence.csokas@arm.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.