mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
fetchers/git: make path absolute for local repo
This commit is contained in:
parent
2d9b213cc2
commit
96bd9bad2f
1 changed files with 10 additions and 1 deletions
|
@ -426,7 +426,16 @@ struct GitInputScheme : InputScheme
|
||||||
auto url = parseURL(getStrAttr(input.attrs, "url"));
|
auto url = parseURL(getStrAttr(input.attrs, "url"));
|
||||||
bool isBareRepository = url.scheme == "file" && !pathExists(url.path + "/.git");
|
bool isBareRepository = url.scheme == "file" && !pathExists(url.path + "/.git");
|
||||||
repoInfo.isLocal = url.scheme == "file" && !forceHttp && !isBareRepository;
|
repoInfo.isLocal = url.scheme == "file" && !forceHttp && !isBareRepository;
|
||||||
repoInfo.url = repoInfo.isLocal ? url.path : url.to_string();
|
//
|
||||||
|
// FIXME: here we turn a possibly relative path into an absolute path.
|
||||||
|
// This allows relative git flake inputs to be resolved against the
|
||||||
|
// **current working directory** (as in POSIX), which tends to work out
|
||||||
|
// ok in the context of flakes, but is the wrong behavior,
|
||||||
|
// as it should resolve against the flake.nix base directory instead.
|
||||||
|
//
|
||||||
|
// See: https://discourse.nixos.org/t/57783 and #9708
|
||||||
|
//
|
||||||
|
repoInfo.url = repoInfo.isLocal ? std::filesystem::absolute(url.path).string() : url.to_string();
|
||||||
|
|
||||||
// If this is a local directory and no ref or revision is
|
// If this is a local directory and no ref or revision is
|
||||||
// given, then allow the use of an unclean working tree.
|
// given, then allow the use of an unclean working tree.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue