]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6423: fix suppression of Git’s exit code in tests
authorAyush Chandekar <ayu.chandekar@gmail.com>
Sun, 2 Feb 2025 12:09:26 +0000 (17:39 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Feb 2025 23:23:15 +0000 (15:23 -0800)
Some test in t6423 supress Git's exit code, which can cause test
failures go unnoticed. Specifically using git <subcommand> |
<other-command> masks potential failures of the Git command.

This commit ensures that Git's exit status is correctly propogated by:
- Avoiding pipes that suppress exit codes.

Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6423-merge-rename-directories.sh

index 88d1cf2cde9dabbba74daf6debdc82b11ba12ec1..94080c65d12b0383921825a4d6e7c5ea344e7c35 100755 (executable)
@@ -5071,7 +5071,8 @@ test_expect_success '12i: Directory rename causes rename-to-self' '
                test_path_is_file source/bar &&
                test_path_is_file source/baz &&
 
-               git ls-files | uniq >tracked &&
+               git ls-files >actual &&
+               uniq <actual >tracked &&
                test_line_count = 3 tracked &&
 
                git status --porcelain -uno >actual &&
@@ -5129,7 +5130,8 @@ test_expect_success '12j: Directory rename to root causes rename-to-self' '
                test_path_is_file bar &&
                test_path_is_file baz &&
 
-               git ls-files | uniq >tracked &&
+               git ls-files >actual &&
+               uniq <actual >tracked &&
                test_line_count = 3 tracked &&
 
                git status --porcelain -uno >actual &&
@@ -5187,7 +5189,8 @@ test_expect_success '12k: Directory rename with sibling causes rename-to-self' '
                test_path_is_file dirA/bar &&
                test_path_is_file dirA/baz &&
 
-               git ls-files | uniq >tracked &&
+               git ls-files >actual &&
+               uniq <actual >tracked &&
                test_line_count = 3 tracked &&
 
                git status --porcelain -uno >actual &&