Re: [PATCH v2] t1402: test forbidden characters in refnames
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 21, 2026, 09:29 UTC
- Message-ID
- <xmqq5x13stxt.fsf@gitster.g>
- In-Reply-To
- <pull.2203.v2.git.1787264417682.gitgitgadget@gmail.com>
"Nikolaus Schuetz via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 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).
Many funny characters are not allowed between 'foo' and 'bar', but are there characters other than dot that are not allowed at the beginning or at the end (e.g., "refs/heads/foo." and "foo.lock")?
IOW are we testing exhaustive now?
Show 11 quoted lines
> invalid_ref '.refs/foo'
> invalid_ref 'refs/heads/foo.'
> -invalid_ref 'heads/foo..bar'
> -invalid_ref 'heads/foo?bar'
> +for c in '?' '~' '^' ':' '*' '[' ' ' '\' '..'
> +do
> + invalid_ref "heads/foo${c}bar"
> +done
> valid_ref 'foo./bar'
> invalid_ref 'heads/foo.lock'
> invalid_ref 'heads///foo.lock'