Re: [PATCH 2/3] object-name: don't allow @ as a branch name
- From
Rubén Justo <rjusto@gmail.com>
- Date
- Oct 8, 2024, 20:37 UTC
- Message-ID
- <b1f2b664-34ea-4d9d-9bf5-fb6632b265f5@gmail.com>
- In-Reply-To
- <20241007204447.GB603285@coredump.intra.peff.net>
On Mon, Oct 07, 2024 at 04:44:47PM -0400, Jeff King wrote:
Show 5 quoted lines
> The refname "refs/heads/HEAD" is allowed by plumbing, as we try > to maintain backwards compatibility there. So the current prohibition is > just within the porcelain tools: we won't allow "git branch HEAD" > because it's an easy mistake to make, even though you could still create > it with "git update-ref".
Ah, your comment reminded me that something similar happened recently near me:
$ git push origin some-ref:HEAD
It caused a small disaster, although it was quickly fixed.
The backwards compatibility you mentioned, which can also be understood as a non-limitation in this aspect, is worth maintaining.
I haven't had time to investigate why git-push doesn't warn (or stop) the user when attempting that, but perhaps there's a small crack we want to fix. Or maybe it's something we actually want to allow...