File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,8 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
102102
103103 if (baseDir) {
104104 /* Check if 'url' is a path (either absolute or relative
105- to 'baseDir'). If so, search upward to the root of the
106- repo (i.e. the directory containing .git). */
105+ to 'baseDir'). If so, search upward to the root of the
106+ repo (i.e. the directory containing .git). */
107107
108108 path = absPath (path, baseDir);
109109
@@ -232,7 +232,12 @@ std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
232232)
233233{
234234 try {
235- return fromParsedURL (fetchSettings, parseURL (url), isFlake);
235+ auto parsed = parseURL (url);
236+ if (baseDir
237+ && (parsed.scheme == " path" || parsed.scheme == " git+file" )
238+ && !hasPrefix (parsed.path , " /" ))
239+ parsed.path = absPath (parsed.path , *baseDir);
240+ return fromParsedURL (fetchSettings, std::move (parsed), isFlake);
236241 } catch (BadURL &) {
237242 return std::nullopt ;
238243 }
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ nix build -o "$TEST_ROOT/result" flake1
9797
9898nix build -o " $TEST_ROOT /result" " $flake1Dir "
9999nix build -o " $TEST_ROOT /result" " git+file://$flake1Dir "
100+ (cd " $flake1Dir " && nix build -o " $TEST_ROOT /result" " ." )
101+ (cd " $flake1Dir " && nix build -o " $TEST_ROOT /result" " path:." )
102+ (cd " $flake1Dir " && nix build -o " $TEST_ROOT /result" " git+file:." )
100103
101104# Test explicit packages.default.
102105nix build -o " $TEST_ROOT /result" " $flake1Dir #default"
You can’t perform that action at this time.
0 commit comments