Skip to content

Commit

Permalink
Warn against the use of relative 'git+file:' flake inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Jan 16, 2025
1 parent 043df13 commit 12e1495
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/libfetchers/git.cc
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,16 @@ struct GitInputScheme : InputScheme
//
// See: https://discourse.nixos.org/t/57783 and #9708
//
repoInfo.url = repoInfo.isLocal ? std::filesystem::absolute(url.path).string() : url.to_string();
if (repoInfo.isLocal) {
if (!isAbsolute(url.path)) {
warn(
"Fetching Git repository '%s', which uses a path relative to the current directory. "
"This is not supported and will stop working in a future release.",
url);
}
repoInfo.url = std::filesystem::absolute(url.path).string();
} else
repoInfo.url = url.to_string();

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

0 comments on commit 12e1495

Please sign in to comment.