t9402-git-cvsserver-refs: don't check the stderr of a subshell

Four 'cvs diff' related tests in 't9402-git-cvsserver-refs.sh' fail when the test script is run with '-x' tracing (and using a shell other than a Bash version supporting BASH_XTRACEFD). The reason for those failures is that the tests check the emptiness of a subshell's stderr, which includes the trace of commands executed in that subshell as well, throwing off the emptiness check. Save the stdout and stderr of the invoked 'cvs' command instead of the whole subshell, so the latter remains free from tracing output. (Note that changing how stdout is saved is only done for the sake of consistency, it's not necessary for correctness.) After this change t9402 passes with '-x', even when running with /bin/sh. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Mar 8, 2018 at 13:38 UTC c20bf94abcf49323fdbd398c412a6cf6af3f3a61
1 file changed +4 -4
t/t9402-git-cvsserver-refs.sh
+4 -4
@@ -455,20 +455,20 @@ test_expect_success 'cvs up -r $(git rev-parse v1)' '
455 '
456
457 test_expect_success 'cvs diff -r v1 -u' '
458 - ( cd cvswork && cvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&
458 + ( cd cvswork && cvs -f diff -r v1 -u >../cvsDiff.out 2>../cvs.log ) &&
459 test_must_be_empty cvsDiff.out &&
460 test_must_be_empty cvs.log
461 '
462
463 test_expect_success 'cvs diff -N -r v2 -u' '
464 - ( cd cvswork && ! cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&
464 + ( cd cvswork && ! cvs -f diff -N -r v2 -u >../cvsDiff.out 2>../cvs.log ) &&
465 test_must_be_empty cvs.log &&
466 test -s cvsDiff.out &&
467 check_diff cvsDiff.out v2 v1 >check_diff.out 2>&1
468 '
469
470 test_expect_success 'cvs diff -N -r v2 -r v1.2' '
471 - ( cd cvswork && ! cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&
471 + ( cd cvswork && ! cvs -f diff -N -r v2 -r v1.2 -u >../cvsDiff.out 2>../cvs.log ) &&
472 test_must_be_empty cvs.log &&
473 test -s cvsDiff.out &&
474 check_diff cvsDiff.out v2 v1.2 >check_diff.out 2>&1
@@ -487,7 +487,7 @@ test_expect_success 'apply early [cvswork3] diff to b3' '
487 '
488
489 test_expect_success 'check [cvswork3] diff' '
490 - ( cd cvswork3 && ! cvs -f diff -N -u ) >"$WORKDIR/cvsDiff.out" 2>cvs.log &&
490 + ( cd cvswork3 && ! cvs -f diff -N -u >"$WORKDIR/cvsDiff.out" 2>../cvs.log ) &&
491 test_must_be_empty cvs.log &&
492 test -s cvsDiff.out &&
493 test $(grep Index: cvsDiff.out | wc -l) = 3 &&