]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t4212: avoid putting git on left-hand side of pipe
authorJeff King <peff@peff.net>
Thu, 27 Apr 2023 08:14:06 +0000 (04:14 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Apr 2023 15:53:32 +0000 (08:53 -0700)
We wouldn't expect cat-file to fail here, but it's good practice to
avoid putting git on the upstream of a pipe, as we otherwise ignore its
exit code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4212-log-corrupt.sh

index e89e1f54b6caed2e97d04aaf4672a0491a398acf..8b5433ea7406a5eb354875330c9ada25f31e8822 100755 (executable)
@@ -8,8 +8,9 @@ TEST_PASSES_SANITIZE_LEAK=true
 test_expect_success 'setup' '
        test_commit foo &&
 
-       git cat-file commit HEAD |
-       sed "/^author /s/>/>-<>/" >broken_email.commit &&
+       git cat-file commit HEAD >ok.commit &&
+       sed "/^author /s/>/>-<>/" <ok.commit >broken_email.commit &&
+
        git hash-object --literally -w -t commit broken_email.commit >broken_email.hash &&
        git update-ref refs/heads/broken_email $(cat broken_email.hash)
 '