Don't readDir the store

This commit is contained in:
Robert Hensing 2019-09-18 13:29:40 +02:00
parent f952568243
commit 0bd9291f56

View file

@ -129,6 +129,7 @@ rec {
inspectDirAndUp = dirPath: let
go = p: acc:
let
parentDir = dirOf p;
dirInfo = inspectDir p;
isHighest = dirInfo.isWorkTreeRoot || p == /. || p == "/";
dirs = [dirInfo] ++ acc;
@ -138,7 +139,7 @@ rec {
else [];
in
if isHighest
if isHighest || isForbiddenDir (parentDir)
then
{
localIgnores = concatMap getIgnores dirs;
@ -146,10 +147,19 @@ rec {
inherit (dirInfo) gitDir;
}
else
go (dirOf p) dirs
go parentDir dirs
;
in go dirPath [];
# isForbiddenDir: string -> bool
#
# Some directories should never be traversed when looking for .git
# - for performance
# - to help lorri and possibly other tools that monitor which paths are read
# during evaluation
isForbiddenDir = p:
p == builtins.storePath || p == "/";
# TODO: only readDir lazily for the .git type. Rest can be done efficiently with pathExists
inspectDir = dirPath:
let