object-name: don't allow @ as a branch name
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 14 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | object-name: fix whitespaceobject-name.c | +0 | 0 replies | |
| 2/3 | object-name: don't allow @ as a branch nameobject-name.c t/ | +4 | 6 replies | |
| 3/3 | t1402: exercise disallowed branch namest/ | +4 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] object-name: don't allow @ as a branch name
I use @ a lot for Git commands in the terminal. I accidentally did something that made me create a branch named @. This puzzled me since HEAD is not allowed.
Note that the bare/one-level @ ref name is already banned. So this is just about not allowing refs/heads/@.
§ Research
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.
Peff found a way for the branch name HEAD to be created While figuring out a solution:[4]
Quoted 3 lines
Checking "HEAD" afterwards means you can't actually have a branch named "HEAD". Doing so is probably insane, but we probably really _do_ want to just disallow the @-conversion here.
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).
🔗 1: https://lore.kernel.org/git/[email protected]/
🔗 2: https://public-inbox.org/git/[email protected]/
🔗 3: https://public-inbox.org/git/[email protected]/
🔗 4: https://public-inbox.org/git/[email protected]/
§2 Disallow HEAD as a branch name
This was done later in 2017:
https://lore.kernel.org/git/[email protected]/
§2 refs/heads/@ is apparently disallowed by git-refs(1)
See t/t1508-at-combinations.sh:
``` error: refs/heads/@: badRefName: invalid refname format ```
Kristoffer Haugsbakk (3):
object-name: fix whitespace
object-name: don't allow @ as a branch name
t1402: exercise disallowed branch names
object-name.c | 5 ++--- t/t1402-check-ref-format.sh | 4 ++++ t/t3204-branch-name-interpretation.sh | 9 ++------- 3 files changed, 8 insertions(+), 10 deletions(-)
Signature · 1 line
2.46.1.641.g54e7913fcb6