sequencer: use a helper to find the commit message
It is actually not safe to look for a commit message by looking for the first empty line and skipping it. The find_commit_subject() function looks more carefully, so let's use it. Since we are interested in the entire commit message, we re-compute the string length after verifying that the commit subject is not empty (in which case the entire commit message would be empty, something that should not happen but that we want to handle gracefully). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jan 2, 2017 at 16:26 UTC
23aa51420cca7bee854f54e970206c00f3be0c86
1 file changed
+3
-8
sequencer.c
+3
-8
@@ -703,14 +703,9 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
703
next = commit;
704
next_label = msg.label;
705
706
- /*
707
- * Append the commit log message to msgbuf; it starts
708
- * after the tree, parent, author, committer
709
- * information followed by "\n\n".
710
- */
711
- p = strstr(msg.message, "\n\n");
712
- if (p)
713
- strbuf_addstr(&msgbuf, skip_blank_lines(p + 2));
706
+ /* Append the commit log message to msgbuf. */
707
+ if (find_commit_subject(msg.message, &p))
708
+ strbuf_addstr(&msgbuf, p);
709
710
if (opts->record_origin) {
711
if (!has_conforming_footer(&msgbuf, NULL, 0))