]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jt/use-trailer-api-in-commands' into maint
authorJunio C Hamano <gitster@pobox.com>
Sun, 4 Jun 2017 01:21:06 +0000 (10:21 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sun, 4 Jun 2017 01:21:06 +0000 (10:21 +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 9cb5cc75190ee527045cf47ce23e30592b23839e,5df080dadaf670ecfd89c3af603876ee76297c71..4dcf9c8be044247c6c18a4ec2a4675d9df9953eb
@@@ -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);