t6400: preserve git ls-files exit status code

In t6400, we're checking number of files in the index and the working tree by piping the output of "git ls-files" to "wc -l", thus losing the exit status code of git. Let's use the newly introduced test_stdout_line_count in order to check the exit status code of Git's command. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Đoàn Trần Công Danh committed Jul 4, 2021 at 12:46 UTC 66c9562013de1d8fc04fb46a75fb88122df303c4
1 file changed +8 -8
t/t6400-merge-df.sh
+8 -8
@@ -82,13 +82,13 @@ test_expect_success 'modify/delete + directory/file conflict' '
82 git checkout delete^0 &&
83 test_must_fail git merge modify &&
84
85 - test 5 -eq $(git ls-files -s | wc -l) &&
86 - test 4 -eq $(git ls-files -u | wc -l) &&
85 + test_stdout_line_count = 5 git ls-files -s &&
86 + test_stdout_line_count = 4 git ls-files -u &&
87 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
88 then
89 - test 0 -eq $(git ls-files -o | wc -l)
89 + test_stdout_line_count = 0 git ls-files -o
90 else
91 - test 1 -eq $(git ls-files -o | wc -l)
91 + test_stdout_line_count = 1 git ls-files -o
92 fi &&
93
94 test_path_is_file letters/file &&
@@ -103,13 +103,13 @@ test_expect_success 'modify/delete + directory/file conflict; other way' '
103
104 test_must_fail git merge delete &&
105
106 - test 5 -eq $(git ls-files -s | wc -l) &&
107 - test 4 -eq $(git ls-files -u | wc -l) &&
106 + test_stdout_line_count = 5 git ls-files -s &&
107 + test_stdout_line_count = 4 git ls-files -u &&
108 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
109 then
110 - test 0 -eq $(git ls-files -o | wc -l)
110 + test_stdout_line_count = 0 git ls-files -o
111 else
112 - test 1 -eq $(git ls-files -o | wc -l)
112 + test_stdout_line_count = 1 git ls-files -o
113 fi &&
114
115 test_path_is_file letters/file &&