Merge branch 'jt/use-trailer-api-in-commands'
authorJunio C Hamano <gitster@pobox.com>
Tue, 16 May 2017 02:51:52 +0000 (11:51 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 May 2017 02:51:52 +0000 (11:51 +0900)
"git cherry-pick" and other uses of the sequencer machinery
mishandled a trailer block whose last line is an incomplete line.
This has been fixed so that an additional sign-off etc. are added
after completing the existing incomplete line.

* jt/use-trailer-api-in-commands:
sequencer: add newline before adding footers

1  2 
sequencer.c
diff --cc sequencer.c
index 10c3b4ff81547891172319cee0e291c5160050e1,5df080dadaf670ecfd89c3af603876ee76297c71..0fa3fb14f7c1df5f11ba0ef7e4e46a44a32817bd
@@@ -1040,11 -688,17 +1040,12 @@@ static int do_pick_commit(enum todo_com
                next = commit;
                next_label = msg.label;
  
 -              /*
 -               * Append the commit log message to msgbuf; it starts
 -               * after the tree, parent, author, committer
 -               * information followed by "\n\n".
 -               */
 -              p = strstr(msg.message, "\n\n");
 -              if (p)
 -                      strbuf_addstr(&msgbuf, skip_blank_lines(p + 2));
 +              /* Append the commit log message to msgbuf. */
 +              if (find_commit_subject(msg.message, &p))
 +                      strbuf_addstr(&msgbuf, p);
  
                if (opts->record_origin) {
+                       strbuf_complete_line(&msgbuf);
                        if (!has_conforming_footer(&msgbuf, NULL, 0))
                                strbuf_addch(&msgbuf, '\n');
                        strbuf_addstr(&msgbuf, cherry_picked_prefix);