fix(nix/readTree): Ignore hidden files and directories
This skips any directory entries starting with a dot. Change-Id: I95767f3d35bcb2ed9b3d6e772f3924dd57612711 Reviewed-on: https://cl.tvl.fyi/c/depot/+/123 Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
cbcec9fd04
commit
cec109807b
1 changed files with 14 additions and 3 deletions
|
@ -9,17 +9,28 @@ let
|
|||
filter
|
||||
hasAttr
|
||||
head
|
||||
isAttrs
|
||||
length
|
||||
listToAttrs
|
||||
map
|
||||
match
|
||||
isAttrs
|
||||
readDir;
|
||||
readDir
|
||||
substring;
|
||||
|
||||
argsWithPath = parts: args // {
|
||||
locatedAt = parts;
|
||||
};
|
||||
|
||||
readDirVisible = path:
|
||||
let
|
||||
children = readDir path;
|
||||
isVisible = f: f == ".skip-subtree" || (substring 0 1 f) != ".";
|
||||
names = filter isVisible (attrNames children);
|
||||
in listToAttrs (map (name: {
|
||||
inherit name;
|
||||
value = children.${name};
|
||||
}) names);
|
||||
|
||||
# The marker is added to every set that was imported directly by
|
||||
# readTree.
|
||||
importWithMark = path: parts:
|
||||
|
@ -34,7 +45,7 @@ let
|
|||
|
||||
readTree = path: parts:
|
||||
let
|
||||
dir = readDir path;
|
||||
dir = readDirVisible path;
|
||||
self = importWithMark path parts;
|
||||
joinChild = c: path + ("/" + c);
|
||||
|
||||
|
|
Loading…
Reference in a new issue