Thread (43 messages) 43 messages, 3 authors, 2025-11-03
STALE235d
Revisions (2)
  1. v4 current
  2. v5 [diff vs current]

[PATCH v4 19/29] tests: t3440: use test_commit_message for trailer checks

From: Li Chen <hidden>
Date: 2025-10-14 12:28:06
Subsystem: the rest · Maintainer: Linus Torvalds

Replaced the pipeline-based trailer assertions with
explicit expectations verified by test_commit_message,
ensuring the rebase trailer tests catch git command
failures reliably.

Signed-off-by: Li Chen <redacted>
---
 t/t3440-rebase-trailer.sh | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/t/t3440-rebase-trailer.sh b/t/t3440-rebase-trailer.sh
index 6f1a062e8f..16b059c2c3 100755
--- a/t/t3440-rebase-trailer.sh
+++ b/t/t3440-rebase-trailer.sh
@@ -52,18 +52,28 @@ test_expect_success 'reject trailer with missing key before separator' '
 
 test_expect_success 'CLI trailer duplicates allowed; replace policy keeps last' '
 	git reset --hard third &&
-	git -c trailer.Bug.ifexists=replace -c trailer.Bug.ifmissing=add rebase -m --trailer "Bug: 123" --trailer "Bug: 456" HEAD~1 &&
-	git cat-file commit HEAD | grep "^Bug: 456" &&
-	git cat-file commit HEAD | grep -v "^Bug: 123"
+	git -c trailer.Bug.ifexists=replace -c trailer.Bug.ifmissing=add \
+		rebase -m --trailer "Bug: 123" --trailer "Bug: 456" HEAD~1 &&
+	cat >expect <<-\EOF &&
+	third
+
+	Bug: 456
+	EOF
+	test_commit_message HEAD expect
 '
 
 test_expect_success 'multiple Signed-off-by trailers all preserved' '
 	git reset --hard third &&
 	git rebase -m \
-		--trailer "Signed-off-by: Dev A <a@ex.com>" \
-		--trailer "Signed-off-by: Dev B <b@ex.com>" HEAD~1 &&
-	git cat-file commit HEAD | grep -c "^Signed-off-by:" >count &&
-	test "$(cat count)" = 2   # two new commits
+			--trailer "Signed-off-by: Dev A <a@ex.com>" \
+			--trailer "Signed-off-by: Dev B <b@ex.com>" HEAD~1 &&
+	cat >expect <<-\EOF &&
+	third
+
+	Signed-off-by: Dev A <a@ex.com>
+	Signed-off-by: Dev B <b@ex.com>
+	EOF
+	test_commit_message HEAD expect
 '
 
 test_expect_success 'rebase -m --trailer adds trailer after conflicts' '
-- 
2.51.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help