Skip to content

Commit cab11f4

Browse files
spectre10gitster
authored andcommitted
t7501: add tests for --amend --signoff
Add tests for amending the commit to add Signed-off-by trailer. And also to check if it does not add another trailer if one already exists. Currently, there are tests for --signoff separately in t7501, however, they are not tested with --amend. Therefore, these tests belong with other similar tests of --amend in t7501-commit-basic-functionality. Helped-by: Phillip Wood <[email protected]> Signed-off-by: Ghanshyam Thakkar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4e4f576 commit cab11f4

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

t/t7501-commit-basic-functionality.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Copyright (c) 2007 Kristian Høgsberg <[email protected]>
44
#
55

6-
# FIXME: Test the various index usages, test reflog,
7-
# signoff
6+
# FIXME: Test the various index usages, test reflog
87

98
test_description='git commit'
109
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
@@ -462,6 +461,28 @@ test_expect_success 'amend commit to fix date' '
462461
463462
'
464463

464+
test_expect_success 'amend commit to add signoff' '
465+
466+
test_commit "msg" file content &&
467+
git commit --amend --signoff &&
468+
test_commit_message HEAD <<-EOF
469+
msg
470+
471+
Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
472+
EOF
473+
'
474+
475+
test_expect_success 'amend does not add signoff if it already exists' '
476+
477+
test_commit --signoff "tenor" file newcontent &&
478+
git commit --amend --signoff &&
479+
test_commit_message HEAD <<-EOF
480+
tenor
481+
482+
Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
483+
EOF
484+
'
485+
465486
test_expect_success 'commit mentions forced date in output' '
466487
git commit --amend --date=2010-01-02T03:04:05 >output &&
467488
grep "Date: *Sat Jan 2 03:04:05 2010" output

0 commit comments

Comments
 (0)