chainlint: let here-doc and multi-line string commence on same line
[gitweb.git] / t / t0001-init.sh
index 86c1a51654fa6c1b049a313fe8d880c6a266ee62..ca85aae51ed1c528d1b93e7fea5f53ecb8095851 100755 (executable)
@@ -287,6 +287,7 @@ test_expect_success 'init notices EEXIST (2)' '
 '
 
 test_expect_success POSIXPERM,SANITY 'init notices EPERM' '
+       test_when_finished "chmod +w newdir" &&
        rm -fr newdir &&
        mkdir newdir &&
        chmod -w newdir &&
@@ -407,7 +408,7 @@ is_hidden () {
 test_expect_success MINGW '.git hidden' '
        rm -rf newdir &&
        (
-               unset GIT_DIR GIT_WORK_TREE
+               sane_unset GIT_DIR GIT_WORK_TREE &&
                mkdir newdir &&
                cd newdir &&
                git init &&
@@ -419,7 +420,7 @@ test_expect_success MINGW '.git hidden' '
 test_expect_success MINGW 'bare git dir not hidden' '
        rm -rf newdir &&
        (
-               unset GIT_DIR GIT_WORK_TREE GIT_CONFIG
+               sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
                mkdir newdir &&
                cd newdir &&
                git --bare init
@@ -453,4 +454,16 @@ test_expect_success 're-init from a linked worktree' '
        )
 '
 
+test_expect_success MINGW 'redirect std handles' '
+       GIT_REDIRECT_STDOUT=output.txt git rev-parse --git-dir &&
+       test .git = "$(cat output.txt)" &&
+       test -z "$(GIT_REDIRECT_STDOUT=off git rev-parse --git-dir)" &&
+       test_must_fail env \
+               GIT_REDIRECT_STDOUT=output.txt \
+               GIT_REDIRECT_STDERR="2>&1" \
+               git rev-parse --git-dir --verify refs/invalid &&
+       printf ".git\nfatal: Needed a single revision\n" >expect &&
+       test_cmp expect output.txt
+'
+
 test_done