Skip to content

Commit 385ceec

Browse files
j6tgitster
authored andcommitted
t3005: do not assume a particular order of stdout and stderr of git-ls-files
There is no guarantee that stderr is flushed before stdout when both channels are redirected to a file. Check the channels using independent files. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f64bfa commit 385ceec

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

t/t3005-ls-files-relative.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ test_expect_success 'ls-files -c' '
4545
for f in ../y*
4646
do
4747
echo "error: pathspec $sq$f$sq did not match any file(s) known to git."
48-
done >expect &&
49-
echo "Did you forget to ${sq}git add${sq}?" >>expect &&
50-
ls ../x* >>expect &&
51-
test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual 2>&1 &&
52-
test_cmp expect actual
48+
done >expect.err &&
49+
echo "Did you forget to ${sq}git add${sq}?" >>expect.err &&
50+
ls ../x* >expect.out &&
51+
test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
52+
test_cmp expect.out actual.out &&
53+
test_cmp expect.err actual.err
5354
)
5455
'
5556

@@ -59,11 +60,12 @@ test_expect_success 'ls-files -o' '
5960
for f in ../x*
6061
do
6162
echo "error: pathspec $sq$f$sq did not match any file(s) known to git."
62-
done >expect &&
63-
echo "Did you forget to ${sq}git add${sq}?" >>expect &&
64-
ls ../y* >>expect &&
65-
test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual 2>&1 &&
66-
test_cmp expect actual
63+
done >expect.err &&
64+
echo "Did you forget to ${sq}git add${sq}?" >>expect.err &&
65+
ls ../y* >expect.out &&
66+
test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
67+
test_cmp expect.out actual.out &&
68+
test_cmp expect.err actual.err
6769
)
6870
'
6971

0 commit comments

Comments
 (0)