am: let --signoff override --no-signoff
commitb5e823594cff190bc18361207a89b08d57b038d7
authorPaul Tan <pyokagan@gmail.com>
Tue, 4 Aug 2015 14:08:51 +0000 (4 22:08 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Aug 2015 17:33:47 +0000 (12 10:33 -0700)
tree7a9e7632d3f06cd7388c6f3a52bb87cb8d0870e3
parent852a171018be4695f21848b03d001b5ed3ee96a0
am: let --signoff override --no-signoff

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>
builtin/am.c
t/t4153-am-resume-override-opts.sh