From: Li Chen Date: Tue, 14 Oct 2025 12:24:32 GMT Subject: [PATCH v4 19/29] tests: t3440: use test_commit_message for trailer checks Message-ID: <20251014122452.1851103-20-me@linux.beauty> In-Reply-To: <20251014122452.1851103-1-me@linux.beauty> 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 --- 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 " \ - --trailer "Signed-off-by: Dev B " 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 " \ + --trailer "Signed-off-by: Dev B " HEAD~1 && + cat >expect <<-\EOF && + third + + Signed-off-by: Dev A + Signed-off-by: Dev B + EOF + test_commit_message HEAD expect ' test_expect_success 'rebase -m --trailer adds trailer after conflicts' ' -- 2.51.0