Improve ref validity checking in fetchgit #3642
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous regex was too strict and did not match what git was allowing. It
could lead to
fetchGit
not accepting valid branch names, even though theyexist in a repository (for example, branch names containing
/
, which arepretty standard, like
release/1.0
branches).The new regex defines what a branch name should NOT contain. It takes the
definitions from
refs.c
in https://github.com/git/git andgit help check-ref-format
pages.This change also introduces a test for ref name validity checking, which
compares the result from Nix with the result of
git check-ref-format --branch
.Should fix #3612