Jacob Abel <jacobabel@xxxxxxxxxx> writes: > On 23/04/19 09:23AM, Jacob Abel wrote: >> On 23/04/18 09:34AM, Junio C Hamano wrote: >> > [...] >> >> Ah ok I understand what you mean now. >> >> Would the following work? Since all we care about in `git worktree add` is >> `stderr`, can't we just duplicate `stderr` to `stdout` while redirecting >> stderr to `actual` so that in the event the git command fails, it's still >> displayed in the output of `sh t2400-*.sh -x`? >> >> diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh >> index 82091cbb1f..a8f734b1c3 100755 >> --- a/t/t2400-worktree-add.sh >> +++ b/t/t2400-worktree-add.sh >> @@ -327,8 +327,7 @@ test_expect_success 'add -B' ' >> >> test_expect_success 'add --quiet' ' >> test_when_finished "git worktree remove -f -f another-worktree" && >> - test_when_finished "cat actual" && >> - git worktree add --quiet another-worktree main 2>actual && >> + git worktree add --quiet another-worktree main 2>actual 2>&1 && >> test_must_be_empty actual >> ' >> > > Ok scratch that. I tried checking this a bit more and it doesn't work quite > as expected. I'll remove the `cat actual`s from the tests and if I can > think of a better alternative, I'll report back. While I do not understand what you are trying to achieve here, if you expect both the standard output and error streams are quiet, then cmd >output 2>&1 would store both to 'output' and test_must_be_empty can check what is in there. On the other hand, cmd 2>&1 >output would store the standard output of 'cmd' in 'output' while sending the standard error of 'cmd' to the standard output of the whole thing.