diff options
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-x | t/t0001-init.sh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 86c1a51654..42a263cada 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -167,9 +167,8 @@ test_expect_success 'reinit' ' ) && test_i18ngrep "Initialized empty" again/out1 && test_i18ngrep "Reinitialized existing" again/out2 && - >again/empty && - test_i18ncmp again/empty again/err1 && - test_i18ncmp again/empty again/err2 + test_must_be_empty again/err1 && + test_must_be_empty again/err2 ' test_expect_success 'init with --template' ' @@ -287,6 +286,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 && @@ -319,14 +319,14 @@ test_lazy_prereq GETCWD_IGNORES_PERMS ' base=GETCWD_TEST_BASE_DIR && mkdir -p $base/dir && chmod 100 $base || - error "bug in test script: cannot prepare $base" + BUG "cannot prepare $base" (cd $base/dir && /bin/pwd -P) status=$? chmod 700 $base && rm -rf $base || - error "bug in test script: cannot clean $base" + BUG "cannot clean $base" return $status ' @@ -407,7 +407,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 +419,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 +453,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 |