From bbd411d64bd96a1e1873a7fc627f657ad850b241 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Thu, 18 Mar 2010 11:48:50 +0000 Subject: [PATCH] mingw: add tests for the hidden attribute on the git directory With msysGit the .git directory is supposed to be hidden, unless it is a bare git repository. Test this. Signed-off-by: Pat Thoyts --- t/t0001-init.sh | 28 ++++++++++++++++++++++++++++ t/test-lib.sh | 1 + 2 files changed, 29 insertions(+) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 7fe8883ae0..28f67ce1d4 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -318,4 +318,32 @@ test_expect_success 'init prefers command line to GIT_DIR' ' ! test -d otherdir/refs ' +# Tests for the hidden file attribute on windows +is_hidden () { + test "1" -eq "$(echo puts [file attributes $1 -hidden]|tclsh)" +} + +test_expect_success MINGW 'plain hidden' ' + rm -rf newdir && + ( + unset GIT_DIR GIT_WORK_TREE + mkdir newdir && + cd newdir && + git init && + is_hidden .git + ) && + check_config newdir/.git false unset +' + +test_expect_success MINGW 'plain bare not hidden' ' + rm -rf newdir + ( + unset GIT_DIR GIT_WORK_TREE GIT_CONFIG + mkdir newdir && + cd newdir && + git --bare init + ) && + ! is_hidden newdir +' + test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index 28ebb5f5fe..3b8a0182a1 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -970,6 +970,7 @@ case $(uname -s) in # no POSIX permissions # backslashes in pathspec are converted to '/' # exec does not inherit the PID + test_set_prereq MINGW ;; *) test_set_prereq POSIXPERM -- 2.11.4.GIT