summaryrefslogtreecommitdiff
path: root/lib/fileset/tests.sh
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/tests.sh
parentlib.fileset: Refactor gitTracked and gitTrackedWith (diff)
downloadnixpkgs-6e3be6ddb0c9789d8b891318c526a9401dab481e.tar.gz
lib.fileset.gitTracked: Improve error when passing files
Diffstat (limited to 'lib/fileset/tests.sh')
-rwxr-xr-xlib/fileset/tests.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh
index 077aefe371c3..d55c4fbfdbeb 100755
--- a/lib/fileset/tests.sh
+++ b/lib/fileset/tests.sh
@@ -1317,6 +1317,12 @@ rm -rf -- *
expectFailure 'gitTracked null' 'lib.fileset.gitTracked: Expected the argument to be a path, but it'\''s a null instead.'
expectFailure 'gitTrackedWith {} null' 'lib.fileset.gitTrackedWith: Expected the second argument to be a path, but it'\''s a null instead.'
+# The path must be a directory
+touch a
+expectFailure 'gitTracked ./a' 'lib.fileset.gitTracked: Expected the argument \('"$work"'/a\) to be a directory, but it'\''s a file instead'
+expectFailure 'gitTrackedWith {} ./a' 'lib.fileset.gitTrackedWith: Expected the second argument \('"$work"'/a\) to be a directory, but it'\''s a file instead'
+rm -rf -- *
+
# The path has to contain a .git directory
expectFailure 'gitTracked ./.' 'lib.fileset.gitTracked: Expected the argument \('"$work"'\) to point to a local working tree of a Git repository, but it'\''s not.'
expectFailure 'gitTrackedWith {} ./.' 'lib.fileset.gitTrackedWith: Expected the second argument \('"$work"'\) to point to a local working tree of a Git repository, but it'\''s not.'