[PATCH v4 19/29] tests: t3440: use test_commit_message for trailer checks
- From
Li Chen <me@linux.beauty>
- Date
- Oct 14, 2025, 12:24 UTC
- 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 <chenl311@chinatelecom.cn> --- 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