Skip to content

Commit c29411a

Browse files
authored
Merge pull request #14431 from NixOS/git-url-fixes
libfetchers: Restore plain git inputs recognition
2 parents 9e79e83 + ade3d5d commit c29411a

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/libfetchers/git.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ struct GitInputScheme : InputScheme
164164
{
165165
std::optional<Input> inputFromURL(const Settings & settings, const ParsedURL & url, bool requireTree) const override
166166
{
167-
auto parsedScheme = parseUrlScheme(url.scheme);
168-
if (parsedScheme.application != "git")
167+
if (url.scheme != "git" && parseUrlScheme(url.scheme).application != "git")
169168
return {};
170169

171170
auto url2(url);

src/libflake-tests/flakeref.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,28 @@ INSTANTIATE_TEST_SUITE_P(
206206
.description = "flake_id_ref_branch_ignore_empty_segments_ref_rev",
207207
.expectedUrl = "flake:nixpkgs/branch/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed",
208208
},
209+
InputFromURLTestCase{
210+
.url = "git://somewhere/repo?ref=branch",
211+
.attrs =
212+
{
213+
{"type", Attr("git")},
214+
{"ref", Attr("branch")},
215+
{"url", Attr("git://somewhere/repo")},
216+
},
217+
.description = "plain_git_with_ref",
218+
.expectedUrl = "git://somewhere/repo?ref=branch",
219+
},
220+
InputFromURLTestCase{
221+
.url = "git+https://somewhere.aaaaaaa/repo?ref=branch",
222+
.attrs =
223+
{
224+
{"type", Attr("git")},
225+
{"ref", Attr("branch")},
226+
{"url", Attr("https://somewhere.aaaaaaa/repo")},
227+
},
228+
.description = "git_https_with_ref",
229+
.expectedUrl = "git+https://somewhere.aaaaaaa/repo?ref=branch",
230+
},
209231
InputFromURLTestCase{
210232
// Note that this is different from above because the "flake id" shorthand
211233
// doesn't allow this.

0 commit comments

Comments
 (0)