+53
lib/fileset/default.nix
+53
lib/fileset/default.nix
······+The file set containing all files from the first file set that are not in the second file set.+See also [Difference (set theory)](https://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement).
+80
lib/fileset/internal.nix
+80
lib/fileset/internal.nix
···+# TODO: Have a `lib.lists.commonPrefixLength` function such that we don't need the list allocation from commonPrefix here+# This here is the filesetTree from the negative file set, but for a base path that matches the positive file set.+# because under the base path of `/foo/bar`, everything from the negative file set is included+# The common prefix is the same as the positive base path, so the second path is equal or longer.+# E.g. for `difference /foo /foo/bar` the common prefix is /foo, equal to the positive file set's base+# So we need to shorten the base of the tree for the negative argument from /foo/bar to just /foo+# E.g. for `difference /foo/bar /foo` the common prefix is /foo, equal to the negative file set's base+# If the second file set is empty, nothing gets removed, so the result is just the first file set
+98
lib/fileset/tests.sh
+98
lib/fileset/tests.sh
···+expectEqual 'toSource { root = ./a; fileset = difference ./a ./b; }' 'toSource { root = ./a; fileset = ./a; }'+expectFailure 'toSource { root = ./a; fileset = difference ./. ./a; }' 'lib.fileset.toSource: `fileset` could contain files in '"$work"', which is not under the `root` \('"$work"'/a\). Potential solutions:+\s*- Set `root` to '"$work"' or any directory higher up. This changes the layout of the resulting store path.+\s*- Set `fileset` to a file set that cannot contain files outside the `root` \('"$work"'/a\). This could change the files included in the result.'