Re: Should `@` be really a valid git tag name?
- From
Jeff King <peff@peff.net>
- Date
- Sep 17, 2021, 21:47 UTC
- Message-ID
- <YUUM5VqTEtjhnfjj@coredump.intra.peff.net>
- In-Reply-To
- <xmqq4kaihqjj.fsf@gitster.g>
On Fri, Sep 17, 2021 at 01:53:52PM -0700, Junio C Hamano wrote:
Show 19 quoted lines
> Carlo Arenas <carenas@gmail.com> writes: > > > On Fri, Sep 17, 2021 at 7:12 AM <gitmailinglist.bentolor@xoxy.net> wrote: > >> > >> A SO commenter pointed out, that git-check-ref-format forbids @ and > >> maybe I should report this as a potential bug. Is it? > > > > a reference that is named "@" only is invalid, but refs/tags/@ is not. > > ;-) > > "git check-ref-format master ; echo $?" would show that any single > level name is "forbidden", so probably the SO commenter (whatever > that is) was confused---it is not about @ at all. > > In any case, a tag whose name is @ may be another source of > confusion in the modern world, after we added @ as a synonym to > HEAD. I do not know, for example, offhand which between the HEAD or > that tag "git show @" would choose. It makes sense to avoid it.
In the past when we've had confusing names (like refs/heads/HEAD), we continue to allow them at the plumbing level (to retain backwards compatibility), but flag them at the porcelain level to prevent users shooting themselves in the foot. This seems like a good candidate for that (for both git-branch and git-tag).
-Peff