about summary refs log tree commit diff
path: root/lib/fileset
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2023-09-26 19:12:58 +0200
committerSilvan Mosberger <silvan.mosberger@tweag.io>2023-10-04 16:31:13 +0200
commit5bbe67bf67b5728bf2c0ed8228853c661a39606d (patch)
tree6f3c4cd1472a386b805446b9531735da64da6232 /lib/fileset
parent704452f29cc632f1d9fbc651993eed5d69ee8549 (diff)
downloadnixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.tar
nixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.tar.gz
nixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.tar.bz2
nixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.tar.lz
nixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.tar.xz
nixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.tar.zst
nixlib-5bbe67bf67b5728bf2c0ed8228853c661a39606d.zip
lib.fileset: Mention trace functions in the file set evaluation error
Diffstat (limited to 'lib/fileset')
-rw-r--r--lib/fileset/README.md1
-rw-r--r--lib/fileset/internal.nix4
-rwxr-xr-xlib/fileset/tests.sh8
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/fileset/README.md b/lib/fileset/README.md
index 2ef7b81e8850..d4c80e9433e4 100644
--- a/lib/fileset/README.md
+++ b/lib/fileset/README.md
@@ -207,6 +207,5 @@ Here's a list of places in the library that need to be updated in the future:
 - > The file set library is currently somewhat limited but is being expanded to include more functions over time.
 
   in [the manual](../../doc/functions/fileset.section.md)
-- Once a tracing function exists, `__noEval` in [internal.nix](./internal.nix) should mention it
 - If/Once a function to convert `lib.sources` values into file sets exists, the `_coerce` and `toSource` functions should be updated to mention that function in the error when such a value is passed
 - If/Once a function exists that can optionally include a path depending on whether it exists, the error message for the path not existing in `_coerce` should mention the new function
diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix
index ebfe69b010de..d18e37e9d6e6 100644
--- a/lib/fileset/internal.nix
+++ b/lib/fileset/internal.nix
@@ -106,7 +106,9 @@ rec {
   ];
 
   _noEvalMessage = ''
-    lib.fileset: Directly evaluating a file set is not supported. Use `lib.fileset.toSource` to turn it into a usable source instead.'';
+    lib.fileset: Directly evaluating a file set is not supported.
+      To turn it into a usable source, use `lib.fileset.toSource`.
+      To pretty-print the contents, use `lib.fileset.trace` or `lib.fileset.traceVal`.'';
 
   # The empty file set without a base path
   _emptyWithoutBase = {
diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh
index 80fa21961ffb..6c6379d07349 100755
--- a/lib/fileset/tests.sh
+++ b/lib/fileset/tests.sh
@@ -327,8 +327,12 @@ expectFailure 'toSource { root = ./.; fileset = "/some/path"; }' 'lib.fileset.to
 expectFailure 'toSource { root = ./.; fileset = ./a; }' 'lib.fileset.toSource: `fileset` \('"$work"'/a\) does not exist.'
 
 # File sets cannot be evaluated directly
-expectFailure 'union ./. ./.' 'lib.fileset: Directly evaluating a file set is not supported. Use `lib.fileset.toSource` to turn it into a usable source instead.'
-expectFailure '_emptyWithoutBase' 'lib.fileset: Directly evaluating a file set is not supported. Use `lib.fileset.toSource` to turn it into a usable source instead.'
+expectFailure 'union ./. ./.' 'lib.fileset: Directly evaluating a file set is not supported.
+\s*To turn it into a usable source, use `lib.fileset.toSource`.
+\s*To pretty-print the contents, use `lib.fileset.trace` or `lib.fileset.traceVal`.'
+expectFailure '_emptyWithoutBase' 'lib.fileset: Directly evaluating a file set is not supported.
+\s*To turn it into a usable source, use `lib.fileset.toSource`.
+\s*To pretty-print the contents, use `lib.fileset.trace` or `lib.fileset.traceVal`.'
 
 # Past versions of the internal representation are supported
 expectEqual '_coerce "<tests>: value" { _type = "fileset"; _internalVersion = 0; _internalBase = ./.; }' \