summaryrefslogtreecommitdiff
path: root/t/t4153-am-resume-override-opts.sh
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2015-08-04 22:08:51 +0800
committerJunio C Hamano <gitster@pobox.com>2015-08-12 10:33:47 -0700
commitb5e823594cff190bc18361207a89b08d57b038d7 (patch)
tree7a9e7632d3f06cd7388c6f3a52bb87cb8d0870e3 /t/t4153-am-resume-override-opts.sh
parent852a171018be4695f21848b03d001b5ed3ee96a0 (diff)
downloadgit-b5e823594cff190bc18361207a89b08d57b038d7.tar.gz
am: let --signoff override --no-signoffpt/am-builtin-options
After resolving a conflicting patch, a user may wish to sign off the patch to declare that the patch has been modified. As such, the user will expect that running "git am --signoff --continue" will append the signoff to the commit message. However, the --signoff option is only taken into account during the mail-parsing stage. If the --signoff option is set, then the signoff will be appended to the commit message. Since the mail-parsing stage comes before the patch application stage, the --signoff option, if provided on the command-line when resuming, will have no effect at all. We cannot move the append_signoff() call to the patch application stage as the applypatch-msg hook and interactive mode, which run before patch application, may expect the signoff to be there. Fix this by taking note if the user explictly set the --signoff option on the command-line, and append the signoff to the commit message when resuming if so. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4153-am-resume-override-opts.sh')
-rwxr-xr-xt/t4153-am-resume-override-opts.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh
index 39fac7993e..7c013d84d5 100755
--- a/t/t4153-am-resume-override-opts.sh
+++ b/t/t4153-am-resume-override-opts.sh
@@ -64,6 +64,26 @@ test_expect_success '--no-quiet overrides --quiet' '
test_i18ncmp expected out
'
+test_expect_success '--signoff overrides --no-signoff' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout first &&
+
+ test_must_fail git am --no-signoff side[12].eml &&
+ test_path_is_dir .git/rebase-apply &&
+ echo side1 >file &&
+ git add file &&
+ git am --signoff --continue &&
+
+ # Applied side1 will be signed off
+ echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&
+ git cat-file commit HEAD^ | grep "Signed-off-by:" >actual &&
+ test_cmp expected actual &&
+
+ # Applied side2 will not be signed off
+ test $(git cat-file commit HEAD | grep -c "Signed-off-by:") -eq 0
+'
+
test_expect_success TTY '--reject overrides --no-reject' '
rm -fr .git/rebase-apply &&
git reset --hard &&