Skip to content

t1402: test forbidden characters in refnames - #2203

Open
nikolauspschuetz wants to merge 1 commit into
gitgitgadget:masterfrom
nikolauspschuetz:ns/t1402-forbidden-characters
Open

t1402: test forbidden characters in refnames#2203
nikolauspschuetz wants to merge 1 commit into
gitgitgadget:masterfrom
nikolauspschuetz:ns/t1402-forbidden-characters

Conversation

@nikolauspschuetz

Copy link
Copy Markdown

git-check-ref-format(1) documents the characters that a refname may not contain (space, tilde, caret, colon, question-mark, asterisk, open-bracket) and the rule that it may not be the single character "@". t1402 only exercised a few of these directly.

This adds the remaining forbidden characters in embedded form, and checks that "@" alone is rejected even with --allow-onelevel, where "@" is otherwise a valid refname component (as "refs/@" confirms).

Test-only; documents existing behaviour, in the spirit of 919eb8a (t1402: check for refs ending with a dot).

git-check-ref-format(1) documents that a refname cannot contain a
space, tilde, caret, colon, question-mark, asterisk or open-bracket,
and that it cannot be the single character "@".  Of these, only "?"
was tested as a character embedded in an otherwise-valid refname;
"*" was checked only as a lone character or with --refspec-pattern.

Add the remaining forbidden characters in that embedded form, and
check that "@" alone is rejected even with --allow-onelevel -- where
"@" is otherwise a valid refname component, as "refs/@" confirms.

Signed-off-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
@nikolauspschuetz
nikolauspschuetz marked this pull request as ready for review August 13, 2026 20:03
@nikolauspschuetz

Copy link
Copy Markdown
Author

/preview

@gitgitgadget

gitgitgadget Bot commented Aug 13, 2026

Copy link
Copy Markdown

Preview email sent as pull.2203.git.1786651494406.gitgitgadget@gmail.com

@nikolauspschuetz

Copy link
Copy Markdown
Author

/submit

@gitgitgadget

gitgitgadget Bot commented Aug 13, 2026

Copy link
Copy Markdown

Submitted as pull.2203.git.1786653837190.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2203/nikolauspschuetz/ns/t1402-forbidden-characters-v1

To fetch this version to local tag pr-2203/nikolauspschuetz/ns/t1402-forbidden-characters-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2203/nikolauspschuetz/ns/t1402-forbidden-characters-v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant