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 <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Aug 28, 2011 at 09:34 UTC 385ceec1cb46f8a476fa11ffc853dedba512fd52
1 file changed +12 -10
t/t3005-ls-files-relative.sh
+12 -10
@@ -45,11 +45,12 @@ test_expect_success 'ls-files -c' '
45 for f in ../y*
46 do
47 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
54 )
55 '
56
@@ -59,11 +60,12 @@ test_expect_success 'ls-files -o' '
60 for f in ../x*
61 do
62 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
69 )
70 '
71