Skip to content

Commit

Permalink
t3700-add: fix dependence on stdout and stderr buffering
Browse files Browse the repository at this point in the history
One test case checked the stdout and stderr of 'git add' by constructing a
single 'expect' file that contained both streams. But when the command
runs, the order of stdout and stderr output is unpredictable because it
depends on how the streams are buffered. At least on Windows, the buffering
is different from what the test case expected. Hence, check the two output
texts separately.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Sixt authored and Junio C Hamano committed Jul 26, 2010
1 parent 938791c commit c1e02b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions t/t3700-add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,20 @@ test_expect_success 'git add --dry-run of non-existing file' "
echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
"

cat >expect <<EOF
cat >expect.err <<\EOF
The following paths are ignored by one of your .gitignore files:
ignored-file
Use -f if you really want to add them.
fatal: no files added
EOF
cat >expect.out <<\EOF
add 'track-this'
EOF

test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1 &&
test_cmp expect actual
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err &&
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
'

test_done

0 comments on commit c1e02b2

Please sign in to comment.