Skip to content

Commit bc18d18

Browse files
patthoytsdscho
authored andcommitted
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 <[email protected]>
1 parent 35d9901 commit bc18d18

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

t/t0001-init.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,32 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
339339
test_path_is_dir realgitdir/refs
340340
'
341341

342+
# Tests for the hidden file attribute on windows
343+
is_hidden () {
344+
test "1" -eq "$(echo puts [file attributes $1 -hidden]|tclsh)"
345+
}
346+
347+
test_expect_success MINGW 'plain hidden' '
348+
rm -rf newdir &&
349+
(
350+
unset GIT_DIR GIT_WORK_TREE
351+
mkdir newdir &&
352+
cd newdir &&
353+
git init &&
354+
is_hidden .git
355+
) &&
356+
check_config newdir/.git false unset
357+
'
358+
359+
test_expect_success MINGW 'plain bare not hidden' '
360+
rm -rf newdir &&
361+
(
362+
unset GIT_DIR GIT_WORK_TREE GIT_CONFIG
363+
mkdir newdir &&
364+
cd newdir &&
365+
git --bare init
366+
) &&
367+
! is_hidden newdir
368+
'
369+
342370
test_done

0 commit comments

Comments
 (0)