]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: simplify adding Signed-off-by: trailer
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Fri, 24 Nov 2017 11:07:55 +0000 (11:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Nov 2017 13:44:18 +0000 (22:44 +0900)
Add the Signed-off-by: trailer in one place rather than adding it to
the message when doing a recursive merge and specifying '--signoff'
when running 'git commit'. This means that if there are conflicts when
merging with a strategy other than 'recursive' the Signed-off-by:
trailer will be added if the user commits the resolution themselves
without passing '--signoff' to 'git commit'. It also simplifies the
in-process commit that is about to be added to the sequencer.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c

index 334348f0d4b576e50f7cbe4ff9cffad210623479..a9e0ad49fb1707077ba5261877d8f40d705ab2f4 100644 (file)
@@ -477,9 +477,6 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
                        _(action_name(opts)));
        rollback_lock_file(&index_lock);
 
-       if (opts->signoff)
-               append_signoff(msgbuf, 0, 0);
-
        if (!clean)
                append_conflicts_hint(msgbuf);
 
@@ -657,8 +654,6 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
                argv_array_push(&cmd.args, "--amend");
        if (opts->gpg_sign)
                argv_array_pushf(&cmd.args, "-S%s", opts->gpg_sign);
-       if (opts->signoff)
-               argv_array_push(&cmd.args, "-s");
        if (defmsg)
                argv_array_pushl(&cmd.args, "-F", defmsg, NULL);
        if ((flags & CLEANUP_MSG))
@@ -1347,6 +1342,9 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
                }
        }
 
+       if (opts->signoff)
+               append_signoff(&msgbuf, 0, 0);
+
        if (is_rebase_i(opts) && write_author_script(msg.message) < 0)
                res = -1;
        else if (!opts->strategy || !strcmp(opts->strategy, "recursive") || command == TODO_REVERT) {