]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6400: preserve git ls-files exit status code
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>
Sun, 4 Jul 2021 05:46:11 +0000 (12:46 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Jul 2021 19:24:11 +0000 (12:24 -0700)
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>
t/t6400-merge-df.sh

index 38700d29b521f2a2b1d86a5ac072b64fd605dbca..57a67cf362730be7d2ec695310346cb15b276823 100755 (executable)
@@ -82,13 +82,13 @@ test_expect_success 'modify/delete + directory/file conflict' '
        git checkout delete^0 &&
        test_must_fail git merge modify &&
 
-       test 5 -eq $(git ls-files -s | wc -l) &&
-       test 4 -eq $(git ls-files -u | wc -l) &&
+       test_stdout_line_count = 5 git ls-files -s &&
+       test_stdout_line_count = 4 git ls-files -u &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
        then
-               test 0 -eq $(git ls-files -o | wc -l)
+               test_stdout_line_count = 0 git ls-files -o
        else
-               test 1 -eq $(git ls-files -o | wc -l)
+               test_stdout_line_count = 1 git ls-files -o
        fi &&
 
        test_path_is_file letters/file &&
@@ -103,13 +103,13 @@ test_expect_success 'modify/delete + directory/file conflict; other way' '
 
        test_must_fail git merge delete &&
 
-       test 5 -eq $(git ls-files -s | wc -l) &&
-       test 4 -eq $(git ls-files -u | wc -l) &&
+       test_stdout_line_count = 5 git ls-files -s &&
+       test_stdout_line_count = 4 git ls-files -u &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
        then
-               test 0 -eq $(git ls-files -o | wc -l)
+               test_stdout_line_count = 0 git ls-files -o
        else
-               test 1 -eq $(git ls-files -o | wc -l)
+               test_stdout_line_count = 1 git ls-files -o
        fi &&
 
        test_path_is_file letters/file &&