]> git.ipfire.org Git - thirdparty/git.git/commitdiff
rev-list simplify tests: don't ignore "git" exit code
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 7 Mar 2022 12:49:06 +0000 (13:49 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Mar 2022 21:27:41 +0000 (13:27 -0800)
Change a fragile test pattern introduced in 65347030590 (Topo-sort
before --simplify-merges, 2008-08-03) to check the exit code of both
"git name-rev" and "git log".

This test as a whole would fail under SANITIZE=leak, but we'd pass
several "failing" tests due to hiding these exit codes before we'd
spot git dying with abort(). Now we'll instead spot all of the
failures.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6012-rev-list-simplify.sh

index 63fcccec32e2467f7ece263195290a95232d0d50..de1e87f1621d5db8c3730662731fdd67e1dffba7 100755 (executable)
@@ -12,7 +12,9 @@ note () {
 }
 
 unnote () {
-       git name-rev --tags --annotate-stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g"
+       test_when_finished "rm -f tmp" &&
+       git name-rev --tags --annotate-stdin >tmp &&
+       sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g" <tmp
 }
 
 #
@@ -111,8 +113,8 @@ check_outcome () {
        shift &&
        param="$*" &&
        test_expect_$outcome "log $param" '
-               git log --pretty="$FMT" --parents $param |
-               unnote >actual &&
+               git log --pretty="$FMT" --parents $param >out &&
+               unnote >actual <out &&
                sed -e "s/^.*   \([^ ]*\) .*/\1/" >check <actual &&
                test_cmp expect check
        '
@@ -151,8 +153,8 @@ check_result 'L K I H G B' --exclude-first-parent-only --first-parent L ^F
 check_result 'E C B A' --full-history E -- lost
 test_expect_success 'full history simplification without parent' '
        printf "%s\n" E C B A >expect &&
-       git log --pretty="$FMT" --full-history E -- lost |
-       unnote >actual &&
+       git log --pretty="$FMT" --full-history E -- lost >out &&
+       unnote >actual <out &&
        sed -e "s/^.*   \([^ ]*\) .*/\1/" >check <actual &&
        test_cmp expect check
 '