1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Handle store symlinks in flake directories

E.g. 'nix path-info ./result' inside a flake directory now works
again.
This commit is contained in:
Eelco Dolstra 2019-06-21 15:29:05 +02:00
parent 4f6a7c8621
commit d132d057a8
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
5 changed files with 25 additions and 12 deletions

View file

@ -143,6 +143,14 @@ FlakeRef::FlakeRef(const std::string & uri_, bool allowRelative)
IsPath d;
if (allowRelative) {
d.path = absPath(uri);
try {
if (!S_ISDIR(lstat(d.path).st_mode))
throw BadFlakeRef("path '%s' is not a flake (sub)directory");
} catch (SysError & e) {
if (e.errNo == ENOENT || e.errNo == EISDIR)
throw BadFlakeRef("flake '%s' does not exist");
throw;
}
while (true) {
if (pathExists(d.path + "/.git")) break;
subdir = baseNameOf(d.path) + (subdir.empty() ? "" : "/" + subdir);