Before, we had some Git commands which were upstream of the pipe. This
meant that if it produced an error, it would've gone unnoticed. Refactor
to place Git commands on their own.

Helped-by: Eric Sunshine <sunsh...@sunshineco.com>
Signed-off-by: Denton Liu <liu.den...@gmail.com>
---
 t/t7604-merge-custom-message.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/t/t7604-merge-custom-message.sh b/t/t7604-merge-custom-message.sh
index 89619cf446..b045fdb413 100755
--- a/t/t7604-merge-custom-message.sh
+++ b/t/t7604-merge-custom-message.sh
@@ -36,14 +36,18 @@ test_expect_success 'setup' '
 test_expect_success 'merge c2 with a custom message' '
        git reset --hard c1 &&
        git merge -m "$(cat exp.subject)" c2 &&
-       git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
+       git cat-file commit HEAD >actual &&
+       sed -e "1,/^$/d" <actual >tmp &&
+       mv tmp actual &&
        test_cmp exp.subject actual
 '
 
 test_expect_success 'merge --log appends to custom message' '
        git reset --hard c1 &&
        git merge --log -m "$(cat exp.subject)" c2 &&
-       git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
+       git cat-file commit HEAD >actual &&
+       sed -e "1,/^$/d" <actual >tmp &&
+       mv tmp actual &&
        test_cmp exp.log actual
 '
 
-- 
2.21.0.512.g57bf1b23e1

Reply via email to