]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6300: check for cat-file exit status code
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>
Sat, 21 Aug 2021 01:36:34 +0000 (08:36 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Aug 2021 18:45:54 +0000 (11:45 -0700)
In test_atom(), we're piping the output of cat-file to tail(1),
thus, losing its exit status.

Let's use a temporary file to preserve git exit status code.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6300-for-each-ref.sh

index ad9620efeb87a633013b473fe1314c1375679d00..05a15a933a9a6d48bd99a2503b8e03fe9c6c646a 100755 (executable)
@@ -66,7 +66,9 @@ test_atom() {
                        case $type in
                        tag)
                                # We cannot use $3 as it expects sanitize_pgp to run
-                               expect=$(git cat-file tag $ref | tail -n +6 | wc -c) ;;
+                               git cat-file tag $ref >out &&
+                               expect=$(tail -n +6 out | wc -c) &&
+                               rm -f out ;;
                        tree | blob)
                                expect="" ;;
                        commit)