]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5516: drop unnecessary subshell and command invocation
authorEric Sunshine <sunshine@sunshineco.com>
Thu, 9 Dec 2021 05:11:01 +0000 (00:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2021 18:29:48 +0000 (10:29 -0800)
To create its "expect" file, this test pipes into `sort` the output of
`git for-each-ref` and a copy of that same output but with a minor
textual transformation applied. To do so, it employs a subshell and
commands `cat` and `sed` even though the same result can be accomplished
by `sed` alone (without a subshell).

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5516-fetch-push.sh

index 8212ca56dc5b132edb552fba714657eed3579681..d5e19b54af907154f5c02419df497eee935c39b3 100755 (executable)
@@ -1316,10 +1316,7 @@ test_expect_success 'fetch follows tags by default' '
                git pull ../testrepo main &&
                git tag -m "annotated" tag &&
                git for-each-ref >tmp1 &&
-               (
-                       cat tmp1
-                       sed -n "s|refs/heads/main$|refs/remotes/origin/main|p" tmp1
-               ) |
+               sed -n "p; s|refs/heads/main$|refs/remotes/origin/main|p" tmp1 |
                sort -k 3 >../expect
        ) &&
        git init dst &&