summaryrefslogtreecommitdiff
path: root/t/t0001-init.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-05-26 13:17:23 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-05-26 13:17:23 -0700
commite29300d69fb8e003b36f155a5f286d72ee5a557f (patch)
treed22a3ff686090407694d7e87bb3bf9901b3951db /t/t0001-init.sh
parentMerge branch 'kf/gpg-sig-verification-doc' into maint (diff)
parentmingw: remove unnecessary definition (diff)
downloadtgif-e29300d69fb8e003b36f155a5f286d72ee5a557f.tar.xz
Merge branch 'js/windows-dotgit' into maint
On Windows, .git and optionally any files whose name starts with a dot are now marked as hidden, with a core.hideDotFiles knob to customize this behaviour. * js/windows-dotgit: mingw: remove unnecessary definition mingw: introduce the 'core.hideDotFiles' setting
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index a5b9e7a4c7..a6fdd5ef3a 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -354,4 +354,34 @@ 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 &&
+ (
+ 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 'bare git dir 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