t/t4*: avoid redundant uses of cat

Signed-off-by: Beat Bolli <dev+git@drbeat.li> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Beat Bolli committed Mar 15, 2024 at 20:46 UTC 237ce762ef9ee360ae242cb47af808fc617c1d0a
3 files changed +6 -6
t/t4020-diff-external.sh
+1 -1
@@ -232,7 +232,7 @@ keep_only_cr () {
232 test_expect_success 'external diff with autocrlf = true' '
233 test_config core.autocrlf true &&
234 GIT_EXTERNAL_DIFF=./fake-diff.sh git diff &&
235 - test $(wc -l < crlfed.txt) = $(cat crlfed.txt | keep_only_cr | wc -c)
235 + test $(wc -l <crlfed.txt) = $(keep_only_cr <crlfed.txt | wc -c)
236 '
237
238 test_expect_success 'diff --cached' '
t/t4205-log-pretty-formats.sh
+1 -1
@@ -156,7 +156,7 @@ test_expect_success 'NUL termination with --reflog --pretty=oneline' '
156 for r in $revs
157 do
158 git show -s --pretty=oneline "$r" >raw &&
159 - cat raw | lf_to_nul || return 1
159 + lf_to_nul <raw || return 1
160 done >expect &&
161 # the trailing NUL is already produced so we do not need to
162 # output another one
t/t4301-merge-tree-write-tree.sh
+4 -4
@@ -313,7 +313,7 @@ test_expect_success 'rename/add handling' '
313 # First, check that the bar that appears at stage 3 does not
314 # correspond to an individual blob anywhere in history
315 #
316 - hash=$(cat out | tr "\0" "\n" | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
316 + hash=$(tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
317 git rev-list --objects --all >all_blobs &&
318 ! grep $hash all_blobs &&
319
@@ -380,7 +380,7 @@ test_expect_success SYMLINKS 'rename/add, where add is a mode conflict' '
380 # First, check that the bar that appears at stage 3 does not
381 # correspond to an individual blob anywhere in history
382 #
383 - hash=$(cat out | tr "\0" "\n" | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
383 + hash=$(tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
384 git rev-list --objects --all >all_blobs &&
385 ! grep $hash all_blobs &&
386
@@ -630,8 +630,8 @@ test_expect_success 'mod6: chains of rename/rename(1to2) and add/add via collidi
630 # conflict entries do not appear as individual blobs anywhere
631 # in history.
632 #
633 - hash1=$(cat out | tr "\0" "\n" | head | grep 2.four | cut -f 2 -d " ") &&
634 - hash2=$(cat out | tr "\0" "\n" | head | grep 3.two | cut -f 2 -d " ") &&
633 + hash1=$(tr "\0" "\n" <out | head | grep 2.four | cut -f 2 -d " ") &&
634 + hash2=$(tr "\0" "\n" <out | head | grep 3.two | cut -f 2 -d " ") &&
635 git rev-list --objects --all >all_blobs &&
636 ! grep $hash1 all_blobs &&
637 ! grep $hash2 all_blobs &&