aboutsummaryrefslogtreecommitdiffstats
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-22 13:42:59 -0700
committerJunio C Hamano <gitster@pobox.com>2020-04-22 13:42:59 -0700
commit8b39dfdf47ee2d7a2afd1ff9932c09ad5b00076b (patch)
tree035daea139a9e03a5b5ece2eb74098ef1d4945cd /t/test-lib-functions.sh
parentMerge branch 'js/mingw-isilon-nfs' (diff)
parentt: restrict `is_hidden` to be called only on Windows (diff)
downloadgit-8b39dfdf47ee2d7a2afd1ff9932c09ad5b00076b.tar.gz
git-8b39dfdf47ee2d7a2afd1ff9932c09ad5b00076b.zip
Merge branch 'js/mingw-is-hidden-test-fix'
A Windows-specific test element has been made more robust against misuse from both user's environment and programmer's errors. * js/mingw-is-hidden-test-fix: t: restrict `is_hidden` to be called only on Windows mingw: make test_path_is_hidden more robust t: consolidate the `is_hidden` functions
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 88b7dbd69a..d9ef356a16 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1551,3 +1551,13 @@ test_bitmap_traversal () {
test_cmp "$1.normalized" "$2.normalized" &&
rm -f "$1.normalized" "$2.normalized"
}
+
+# Tests for the hidden file attribute on Windows
+test_path_is_hidden () {
+ test_have_prereq MINGW ||
+ BUG "test_path_is_hidden can only be used on Windows"
+
+ # Use the output of `attrib`, ignore the absolute path
+ case "$("$SYSTEMROOT"/system32/attrib "$1")" in *H*?:*) return 0;; esac
+ return 1
+}