]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t: consolidate the `is_hidden` functions
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 11 Apr 2020 13:40:20 +0000 (13:40 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Apr 2020 21:23:23 +0000 (14:23 -0700)
The `is_hidden` function can be used (only on Windows) to determine
whether a directory or file have their `hidden` flag set.

This function is duplicated between two test scripts. It is better to
move it into `test-lib-functions.sh` so that it is reused.

This patch is best viewed with `--color-moved`.

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

index 26f82063267f3043f7f9c36745d913c12dbe0a27..9cc919d8d1a1bd1f918a3318652e8798e274fd81 100755 (executable)
@@ -392,13 +392,6 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
        test_path_is_dir realgitdir/refs
 '
 
-# 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
-       return 1
-}
-
 test_expect_success MINGW '.git hidden' '
        rm -rf newdir &&
        (
index 60c1ba951b7d4178708574d10986659749925059..c861e12ea4408488924257db53cb0d46f79d0873 100755 (executable)
@@ -92,13 +92,6 @@ test_expect_success 'clone -c remote.<remote>.fetch=<refspec> --origin=<name>' '
        test_cmp expect actual
 '
 
-# 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
-       return 1
-}
-
 test_expect_success MINGW 'clone -c core.hideDotFiles' '
        test_commit attributes .gitattributes "" &&
        rm -rf child &&
index 352c213d52e2e4a50808128c027eba7f1ac163df..7a7e7a38312e888566bf81013540312fe2f2878d 100644 (file)
@@ -1543,3 +1543,10 @@ test_bitmap_traversal () {
        test_cmp "$1.normalized" "$2.normalized" &&
        rm -f "$1.normalized" "$2.normalized"
 }
+
+# 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
+       return 1
+}