diff mbox series

[5/6] merge tests: don't ignore "rev-parse" exit code in helper

Message ID patch-5.6-563666f9426-20220721T064349Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests: fix ignored & hidden exit codes | expand

Commit Message

Ævar Arnfjörð Bjarmason July 21, 2022, 6:51 a.m. UTC
Change the verify_mergeheads() helper the check the exit code of "git
rev-parse". The "$rest" variable added in 274a5c06d52 (merge: record
tag objects without peeling in MERGE_HEAD, 2011-11-07) wasn't being
used.

Such a thing is needed to support the .git/MERGE_HEAD format in
general, but in this case we have no such addition to the line. So
let's compare with "test_cmp" instead, we can always add back this
"$rest" parsing if it's needed in the future.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t7600-merge.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index f0f6fda150b..3682d6f9d4e 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -102,12 +102,11 @@  verify_parents () {
 }
 
 verify_mergeheads () {
-	test_write_lines "$@" >mergehead.expected &&
-	while read sha1 rest
+	for rev in "$@"
 	do
-		git rev-parse $sha1
-	done <.git/MERGE_HEAD >mergehead.actual &&
-	test_cmp mergehead.expected mergehead.actual
+		git rev-parse $rev || return 1
+	done >mergehead.expected &&
+	test_cmp mergehead.expected .git/MERGE_HEAD
 }
 
 verify_no_mergehead () {