Skip to content

Commit c8bb208

Browse files
nikolauspschuetzgitster
authored andcommitted
t1402: test forbidden characters in refnames
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 745601a commit c8bb208

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

t/t1402-check-ref-format.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,20 @@ invalid_ref '.refs/foo'
5151
invalid_ref 'refs/heads/foo.'
5252
invalid_ref 'heads/foo..bar'
5353
invalid_ref 'heads/foo?bar'
54+
invalid_ref 'heads/foo~bar'
55+
invalid_ref 'heads/foo^bar'
56+
invalid_ref 'heads/foo:bar'
57+
invalid_ref 'heads/foo*bar'
58+
invalid_ref 'heads/foo[bar'
59+
invalid_ref 'heads/foo bar'
5460
valid_ref 'foo./bar'
5561
invalid_ref 'heads/foo.lock'
5662
invalid_ref 'heads///foo.lock'
5763
invalid_ref 'foo.lock/bar'
5864
invalid_ref 'foo.lock///bar'
5965
valid_ref 'heads/foo@bar'
66+
valid_ref 'refs/@'
67+
invalid_ref '@' --allow-onelevel
6068
invalid_ref 'heads/v@{ation'
6169
invalid_ref 'heads/foo\bar'
6270
invalid_ref "$(printf 'heads/foo\t')"

0 commit comments

Comments
 (0)