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

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'
Previous: Nikolaus Schuetz via GitGitGadgetNext: Nikolaus Schuetz
Message 6 of 7 in “t1402: test forbidden characters in refnames”
  1. t1402: test forbidden characters in refnamesNikolaus Schuetz via GitGitGadget, Aug 13, 2026
  2. Patrick SteinhardtAug 19, 2026
  3. Junio C HamanoAug 19, 2026
  4. Nikolaus SchuetzAug 20, 2026
  5. t1402: test forbidden characters in refnamesNikolaus Schuetz via GitGitGadget, Aug 20, 2026
  6. Junio C HamanoAug 21, 2026
  7. Nikolaus SchuetzAug 23, 2026

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.