aboutsummaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-16 11:51:52 +0900
committerJunio C Hamano <gitster@pobox.com>2017-05-16 11:51:52 +0900
commit6ebfa10439e50175f24874b39c16fea6560adefe (patch)
tree061a467e9741d800629eb2558aa2428bda0283ae /sequencer.c
parent4b44b7b1df44d371eaf3fbed75829d1a749bc7df (diff)
parent44dc738a39f2c4dba41c0ddacae280d0f88dc71f (diff)
downloadgit-6ebfa10439e50175f24874b39c16fea6560adefe.tar.gz
git-6ebfa10439e50175f24874b39c16fea6560adefe.tar.xz
Merge branch 'jt/use-trailer-api-in-commands'
"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
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c
index 10c3b4ff8..0fa3fb14f 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1045,6 +1045,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
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);
@@ -2357,6 +2358,9 @@ void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag)
getenv("GIT_COMMITTER_EMAIL")));
strbuf_addch(&sob, '\n');
+ if (!ignore_footer)
+ strbuf_complete_line(msgbuf);
+
/*
* If the whole message buffer is equal to the sob, pretend that we
* found a conforming footer with a matching sob
@@ -2377,13 +2381,6 @@ void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag)
* the title and body to be filled in by the user.
*/
append_newlines = "\n\n";
- } else if (msgbuf->buf[len - 1] != '\n') {
- /*
- * Incomplete line. Complete the line and add a
- * blank one so that there is an empty line between
- * the message body and the sob.
- */
- append_newlines = "\n\n";
} else if (len == 1) {
/*
* Buffer contains a single newline. Add another