mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
libfetchers: Restore plain git inputs recognition
Accidentally broken in dbc235cc62.
Adds a bit of tests for this, even though this protocol is mostly deprecated
everywhere.
This commit is contained in:
parent
4a2fb18ba0
commit
ade3d5d746
2 changed files with 23 additions and 2 deletions
|
|
@ -164,8 +164,7 @@ struct GitInputScheme : InputScheme
|
||||||
{
|
{
|
||||||
std::optional<Input> inputFromURL(const Settings & settings, const ParsedURL & url, bool requireTree) const override
|
std::optional<Input> inputFromURL(const Settings & settings, const ParsedURL & url, bool requireTree) const override
|
||||||
{
|
{
|
||||||
auto parsedScheme = parseUrlScheme(url.scheme);
|
if (url.scheme != "git" && parseUrlScheme(url.scheme).application != "git")
|
||||||
if (parsedScheme.application != "git")
|
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto url2(url);
|
auto url2(url);
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,28 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
.description = "flake_id_ref_branch_ignore_empty_segments_ref_rev",
|
.description = "flake_id_ref_branch_ignore_empty_segments_ref_rev",
|
||||||
.expectedUrl = "flake:nixpkgs/branch/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed",
|
.expectedUrl = "flake:nixpkgs/branch/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed",
|
||||||
},
|
},
|
||||||
|
InputFromURLTestCase{
|
||||||
|
.url = "git://somewhere/repo?ref=branch",
|
||||||
|
.attrs =
|
||||||
|
{
|
||||||
|
{"type", Attr("git")},
|
||||||
|
{"ref", Attr("branch")},
|
||||||
|
{"url", Attr("git://somewhere/repo")},
|
||||||
|
},
|
||||||
|
.description = "plain_git_with_ref",
|
||||||
|
.expectedUrl = "git://somewhere/repo?ref=branch",
|
||||||
|
},
|
||||||
|
InputFromURLTestCase{
|
||||||
|
.url = "git+https://somewhere.aaaaaaa/repo?ref=branch",
|
||||||
|
.attrs =
|
||||||
|
{
|
||||||
|
{"type", Attr("git")},
|
||||||
|
{"ref", Attr("branch")},
|
||||||
|
{"url", Attr("https://somewhere.aaaaaaa/repo")},
|
||||||
|
},
|
||||||
|
.description = "git_https_with_ref",
|
||||||
|
.expectedUrl = "git+https://somewhere.aaaaaaa/repo?ref=branch",
|
||||||
|
},
|
||||||
InputFromURLTestCase{
|
InputFromURLTestCase{
|
||||||
// Note that this is different from above because the "flake id" shorthand
|
// Note that this is different from above because the "flake id" shorthand
|
||||||
// doesn't allow this.
|
// doesn't allow this.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue