builtin/am: honor --signoff also when --rebasing
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 15 Apr 2017 14:41:01 +0000 (16:41 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Apr 2017 04:19:09 +0000 (21:19 -0700)
Signoff is handled in parse_mail(), but not in parse_mail_rebasing(),
since the latter is only used when git-rebase calls git-am with the
--rebasing option, and --signoff is never passed in this case.

In order to introduce (in the upcoming commits) support for
`git-rebase --signoff`, we must make git-am pay attention to it also
in the rebase case. This can be done by moving the conditional
addition of the signoff from parse_mail() to the caller am_run(),
after either of the parse_mail*() functions were called.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c
index 826f18ba12d9c58ceb3e8d6998412c234b33bcfe..c92652dfcf464fe2f53260d36df159136c6b4e0a 100644 (file)
@@ -1321,9 +1321,6 @@ static int parse_mail(struct am_state *state, const char *mail)
        strbuf_addbuf(&msg, &mi.log_message);
        strbuf_stripspace(&msg, 0);
 
-       if (state->signoff)
-               am_signoff(&msg);
-
        assert(!state->author_name);
        state->author_name = strbuf_detach(&author_name, NULL);
 
@@ -1848,6 +1845,9 @@ static void am_run(struct am_state *state, int resume)
                        if (skip)
                                goto next; /* mail should be skipped */
 
+                       if (state->signoff)
+                               am_append_signoff(state);
+
                        write_author_script(state);
                        write_commit_msg(state);
                }