Skip to content

Commit 12e1495

Browse files
committed
Warn against the use of relative 'git+file:' flake inputs
1 parent 043df13 commit 12e1495

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/libfetchers/git.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,16 @@ struct GitInputScheme : InputScheme
435435
//
436436
// See: https://discourse.nixos.org/t/57783 and #9708
437437
//
438-
repoInfo.url = repoInfo.isLocal ? std::filesystem::absolute(url.path).string() : url.to_string();
438+
if (repoInfo.isLocal) {
439+
if (!isAbsolute(url.path)) {
440+
warn(
441+
"Fetching Git repository '%s', which uses a path relative to the current directory. "
442+
"This is not supported and will stop working in a future release.",
443+
url);
444+
}
445+
repoInfo.url = std::filesystem::absolute(url.path).string();
446+
} else
447+
repoInfo.url = url.to_string();
439448

440449
// If this is a local directory and no ref or revision is
441450
// given, then allow the use of an unclean working tree.

0 commit comments

Comments
 (0)