Message ID | 20200409201129.82608-3-gitster@pobox.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | make "is_hidden" even more robust | expand |
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 39b478e731..ad54863166 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -762,6 +762,11 @@ test_path_is_missing () { # Tests for the hidden file attribute on windows test_path_is_hidden () { + if ! test_have_prereq MINGW + then + BUG "use of test_path_is_hidden without MINGW prerequisite" + fi + # Use the output of `attrib`, ignore the absolute path case "$("$SYSTEMROOT"/system32/attrib "$1")" in *H*?:*) return 0;;
This test helper function is meant to test if the "hidden" atttribute is set (or unset) as expected on Windows, and use of it outside MINGW prerequisite is an error. Ensure we have the prereq and trigger a BUG otherwise. It is tempting to instead replace its implementation with something like if test_have_prereq MINGW then ... current Windows specific code ... else # ls without -a/-A hides paths that begin with a dot case "$(basename "$1")" in .*) return 0 ;; esac fi return 1 but one test in t0001 is designed specifically that with an option "repository/.git" of a newly created repository is *not* hidden on Windows, which means that it is impossible to make that feature work on POSIX systems and the above won't test what we want to test. Signed-off-by: Junio C Hamano <gitster@pobox.com> --- t/test-lib-functions.sh | 5 +++++ 1 file changed, 5 insertions(+)