git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/3] object-name: don't allow @ as a branch name

From
Jeff King <peff@peff.net>
Date
Oct 7, 2024, 20:37 UTC
Message-ID
<20241007203720.GA603285@coredump.intra.peff.net>
In-Reply-To
<cover.1728331771.git.code@khaugsbakk.name>
On Mon, Oct 07, 2024 at 10:15:16PM +0200, Kristoffer Haugsbakk wrote:
Show 15 quoted lines
> This has come up before.  There even is a test which guards the current
> behavior (allow `@` as a branch name) with the comment:[1]
> 
> ```
> # The thing we are testing here is that "@" is the real branch refs/heads/@,
> # and not refs/heads/HEAD. These tests should not imply that refs/heads/@ is a
> # sane thing, but it _is_ technically allowed for now. If we disallow it, these
> # can be switched to test_must_fail.
> ```
> 
> There was no reply to this change in neither the first[2] nor second
> version.
> 
> That series points back to a bug report thread[3] which is about
> expanding `@` to a branch named `HEAD`.

Yeah. The series you found was about not expanding "@" in the wrong contexts. So the test made sure we did not do so, but of course it was then left asserting the weird behavior that was left over. So this:

> So that was tangential to the bug fix (`HEAD` as a branch name was not
> disallowed in the patch series that resulted from this bug).

is accurate. Those tests are no reason we should not consider disallowing "@" as a branch name.

  As an aside, I have a couple times left these sort of "do not take
  this test as an endorsement of the behavior" comments when working in
  crufty corners of the code base. I am happy that one is finally paying
  off! ;)

So I think the aim of your series is quite reasonable. The implementation mostly looks good, but I have a few comments which I'll leave on the individual patches.

-Peff
Previous: Jeff KingNext: Kristoffer Haugsbakk
Message 12 of 18 in “object-name: don't allow @ as a branch name”
  1. 0/3 object-name: don't allow @ as a branch nameKristoffer Haugsbakk, Oct 7, 2024
  2. 1/3 object-name: fix whitespaceKristoffer Haugsbakk, Oct 7, 2024
  3. 2/3 object-name: don't allow @ as a branch nameKristoffer Haugsbakk, Oct 7, 2024
  4. Jeff KingOct 7, 2024
  5. Kristoffer HaugsbakkOct 7, 2024
  6. Jeff KingOct 8, 2024
  7. Rubén JustoOct 8, 2024
  8. Junio C HamanoOct 7, 2024
  9. Jeff KingOct 8, 2024
  10. 3/3 t1402: exercise disallowed branch namesKristoffer Haugsbakk, Oct 7, 2024
  11. Jeff KingOct 7, 2024
  12. Jeff KingOct 7, 2024
  13. Kristoffer HaugsbakkOct 7, 2024
  14. shejialuoOct 8, 2024
  15. Kristoffer HaugsbakkOct 8, 2024
  16. shejialuoOct 18, 2024
  17. Junio C HamanoOct 8, 2024
  18. shejialuoOct 9, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.