]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t2200,t9832: avoid using 'git' upstream in a pipe
authorAmanda Shafack <shafack.likhene@gmail.com>
Sun, 18 Oct 2020 20:48:07 +0000 (20:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Oct 2020 20:54:11 +0000 (13:54 -0700)
Avoid placing `git` upstream in a pipe since doing so throws away
its exit code, thus an unexpected failure may go unnoticed.

Signed-off-by: Amanda Shafack <shafack.likhene@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2200-add-update.sh
t/t9832-unshelve.sh

index f764b7e3f53e95e11acd4c2bdaafb737979d45e2..7cb7a7038277fdf5e55e984f998d56324d7c62cd 100755 (executable)
@@ -179,7 +179,8 @@ test_expect_success 'add -u resolves unmerged paths' '
 
 test_expect_success '"add -u non-existent" should fail' '
        test_must_fail git add -u non-existent &&
-       ! (git ls-files | grep "non-existent")
+       git ls-files >actual &&
+       ! grep "non-existent" actual
 '
 
 test_done
index 7194fb285566d7863668f8a3c66f7e55536ccb74..6b3cb0414aa08cb62817ba9f0710e6db4d282787 100755 (executable)
@@ -68,7 +68,8 @@ EOF
                cd "$git" &&
                change=$(last_shelved_change) &&
                git p4 unshelve $change &&
-               git show refs/remotes/p4-unshelved/$change | grep -q "Further description" &&
+               git show refs/remotes/p4-unshelved/$change >actual &&
+               grep -q "Further description" actual &&
                git cherry-pick refs/remotes/p4-unshelved/$change &&
                test_path_is_file file2 &&
                test_cmp file1 "$cli"/file1 &&