summaryrefslogtreecommitdiff
path: root/lib/fileset/internal.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2023-12-11 23:05:51 +0100
committerSilvan Mosberger <silvan.mosberger@tweag.io>2023-12-11 23:05:51 +0100
commit6e3be6ddb0c9789d8b891318c526a9401dab481e (patch)
treed7e52f6b8b5e0167188730c7cfecd2bf99a01ab6 /lib/fileset/internal.nix
parentlib.fileset: Refactor gitTracked and gitTrackedWith (diff)
downloadnixpkgs-6e3be6ddb0c9789d8b891318c526a9401dab481e.tar.gz
lib.fileset.gitTracked: Improve error when passing files
Diffstat (limited to 'lib/fileset/internal.nix')
-rw-r--r--lib/fileset/internal.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix
index ade21fd87610..9de5590d3eff 100644
--- a/lib/fileset/internal.nix
+++ b/lib/fileset/internal.nix
@@ -874,6 +874,8 @@ rec {
throw "lib.fileset.${function}: This function is currently not supported in pure evaluation mode, since it currently relies on `builtins.fetchGit`. See https://github.com/NixOS/nix/issues/9292."
else if ! isPath path then
throw "lib.fileset.${function}: Expected the ${argument} to be a path, but it's a ${typeOf path} instead."
+ else if pathType path != "directory" then
+ throw "lib.fileset.${function}: Expected the ${argument} (${toString path}) to be a directory, but it's a file instead."
# We can identify local working directories by checking for .git,
# see https://git-scm.com/docs/gitrepository-layout#_description.
# Note that `builtins.fetchGit` _does_ work for bare repositories (where there's no `.git`),