]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mingw: make test_path_is_hidden more robust
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 11 Apr 2020 13:40:21 +0000 (13:40 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Apr 2020 21:23:25 +0000 (14:23 -0700)
This function uses Windows' system tool `attrib` to determine the state
of the hidden flag of a file or directory.

We should not actually expect the first `attrib.exe` in the PATH to
be the one we are looking for. Or that it is in the PATH, for that
matter.

Let's use the full path to the tool instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib-functions.sh

index 7a7e7a38312e888566bf81013540312fe2f2878d..2f81463a2409cc35dfcf28b679b62fe094a8dff3 100644 (file)
@@ -1547,6 +1547,6 @@ test_bitmap_traversal () {
 # Tests for the hidden file attribute on windows
 is_hidden () {
        # Use the output of `attrib`, ignore the absolute path
-       case "$(attrib "$1")" in *H*?:*) return 0;; esac
+       case "$("$SYSTEMROOT"/system32/attrib "$1")" in *H*?:*) return 0;; esac
        return 1
 }