diff options
author | Silvan Mosberger <contact@infinisil.com> | 2023-11-19 19:12:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 19:12:29 +0100 |
commit | 5a7118da750f58e5c701f541859fbe58c27b9bef (patch) | |
tree | 10e43e576c568056d1165b2f0dd7b1bfb0132169 /lib | |
parent | 0bf3f5cf6a98b5d077cdcdb00a6d4b3d92bc78b5 (diff) | |
parent | b514f0433cdbafbe05899f4dbd420bbdf1c5c7b9 (diff) |
Merge pull request #268520 from tweag/fileset-minor-changes
`lib.fileset`: Minor changes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fileset/default.nix | 2 | ||||
-rw-r--r-- | lib/fileset/internal.nix | 8 | ||||
-rwxr-xr-x | lib/fileset/tests.sh | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/lib/fileset/default.nix b/lib/fileset/default.nix index ea2475284ac69..ca2ab9a357403 100644 --- a/lib/fileset/default.nix +++ b/lib/fileset/default.nix @@ -312,7 +312,7 @@ in { lib.fileset.fromSource: The source origin of the argument is of type ${typeOf path}, but it should be a path instead.'' else if ! pathExists path then throw '' - lib.fileset.fromSource: The source origin (${toString path}) of the argument does not exist.'' + lib.fileset.fromSource: The source origin (${toString path}) of the argument is a path that does not exist.'' else if isFiltered then _fromSourceFilter path source.filter else diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix index 0769e654c8fb8..23d7b847204c9 100644 --- a/lib/fileset/internal.nix +++ b/lib/fileset/internal.nix @@ -381,7 +381,7 @@ rec { # Turn a fileset into a source filter function suitable for `builtins.path` # Only directories recursively containing at least one files are recursed into - # Type: Path -> fileset -> (String -> String -> Bool) + # Type: fileset -> (String -> String -> Bool) _toSourceFilter = fileset: let # Simplify the tree, necessary to make sure all empty directories are null @@ -753,9 +753,9 @@ rec { resultingTree = _differenceTree - positive._internalBase - positive._internalTree - negativeTreeWithPositiveBase; + positive._internalBase + positive._internalTree + negativeTreeWithPositiveBase; in # If the first file set is empty, we can never have any files in the result if positive._internalIsEmptyWithoutBase then diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh index 3c88ebdd05592..06f92f297d88d 100755 --- a/lib/fileset/tests.sh +++ b/lib/fileset/tests.sh @@ -1064,13 +1064,18 @@ rm -rf -- * ## lib.fileset.fromSource # Check error messages -expectFailure 'fromSource null' 'lib.fileset.fromSource: The source origin of the argument is of type null, but it should be a path instead.' +# String-like values are not supported expectFailure 'fromSource (lib.cleanSource "")' 'lib.fileset.fromSource: The source origin of the argument is a string-like value \(""\), but it should be a path instead. \s*Sources created from paths in strings cannot be turned into file sets, use `lib.sources` or derivations instead.' +# Wrong type +expectFailure 'fromSource null' 'lib.fileset.fromSource: The source origin of the argument is of type null, but it should be a path instead.' expectFailure 'fromSource (lib.cleanSource null)' 'lib.fileset.fromSource: The source origin of the argument is of type null, but it should be a path instead.' +# fromSource on non-existent paths gives an error +expectFailure 'fromSource ./a' 'lib.fileset.fromSource: The source origin \('"$work"'/a\) of the argument is a path that does not exist.' + # fromSource on a path works and is the same as coercing that path mkdir a touch a/b c |