1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 03:23:16 +02:00

Warn against the use of relative 'git+file:' flake inputs

(cherry picked from commit 12e14956e2)
This commit is contained in:
Eelco Dolstra 2025-01-16 17:22:54 +01:00 committed by Bryan Lai
parent d944cb7f58
commit f27e263f89

View file

@ -434,7 +434,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.to_string());
}
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.