1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

libfetchers: Remove badGitRefRegex and use libgit2 for reference validation

Fixes usage of `#` symbol in the reference name.
This also seems to identify several deficiencies in the libgit2 refname
validation code wrt to DEL symbol and a singular `@` symbol [1].

[1]: https://git-scm.com/docs/git-check-ref-format#_description
This commit is contained in:
Sergei Zimmerman 2025-08-11 01:00:21 +03:00
parent 0b7f7e4b03
commit e8e9376a7b
No known key found for this signature in database
10 changed files with 154 additions and 19 deletions

View file

@ -67,6 +67,7 @@ valid_ref 'foo./bar'
valid_ref 'heads/foo@bar'
valid_ref "$(printf 'heads/fu\303\237')"
valid_ref 'foo-bar-baz'
valid_ref 'branch#'
valid_ref '$1'
valid_ref 'foo.locke'
@ -97,6 +98,7 @@ invalid_ref 'heads/v@{ation'
invalid_ref 'heads/foo\.ar' # should fail due to \
invalid_ref 'heads/foo\bar' # should fail due to \
invalid_ref "$(printf 'heads/foo\t')" # should fail because it has a TAB
invalid_ref "$(printf 'heads/foo\37')"
invalid_ref "$(printf 'heads/foo\177')"
invalid_ref '@'