mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 12:36:01 +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:
parent
0b7f7e4b03
commit
e8e9376a7b
10 changed files with 154 additions and 19 deletions
|
|
@ -57,6 +57,25 @@ TEST(parseFlakeRef, path)
|
|||
}
|
||||
}
|
||||
|
||||
TEST(parseFlakeRef, GitArchiveInput)
|
||||
{
|
||||
experimentalFeatureSettings.experimentalFeatures.get().insert(Xp::Flakes);
|
||||
|
||||
fetchers::Settings fetchSettings;
|
||||
|
||||
{
|
||||
auto s = "github:foo/bar/branch%23"; // branch name with `#`
|
||||
auto flakeref = parseFlakeRef(fetchSettings, s);
|
||||
ASSERT_EQ(flakeref.to_string(), "github:foo/bar/branch%23");
|
||||
}
|
||||
|
||||
{
|
||||
auto s = "github:foo/bar?ref=branch%23"; // branch name with `#`
|
||||
auto flakeref = parseFlakeRef(fetchSettings, s);
|
||||
ASSERT_EQ(flakeref.to_string(), "github:foo/bar/branch%23");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(to_string, doesntReencodeUrl)
|
||||
{
|
||||
fetchers::Settings fetchSettings;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue