[PATCH] cherry-pick -x: always insert an empty line

Subsystems: the rest

STALE3718d

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] cherry-pick -x: always insert an empty line

From: Beat Bolli <hidden>
Date: 2016-06-15 22:53:06

When cherry-picking a commit that has only a summary, the -x option
creates an invalid commit message because it puts the hash of the commit
being picked on the second line which should be left empty.

This patch fixes this buglet by always inserting an empty line before
the added line.

Aside from that, even with a non-trivial commit the generated note
"(cherry picked from commit 555c9864971744abb558796aea28e12a1ac20839)"
seems abrupt when appended directly.

Cc: Eric Raible <redacted>
Signed-off-by: Beat Bolli <redacted>
---
 sequencer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index 5fcbcb8..63fd589 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -382,7 +382,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
 		}
 
 		if (opts->record_origin) {
-			strbuf_addstr(&msgbuf, "(cherry picked from commit ");
+			strbuf_addstr(&msgbuf, "\n(cherry picked from commit ");
 			strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
 			strbuf_addstr(&msgbuf, ")\n");
 		}
-- 
1.7.9

Re: [PATCH] cherry-pick -x: always insert an empty line

From: Sebastian Schuberth <hidden>
Date: 2016-06-15 22:53:08

On 18.02.2012 22:14, Beat Bolli wrote:
This patch fixes this buglet by always inserting an empty line before
the added line.
Thanks for this! Not having an empty line there has annoyed me, too, 
several times.

-- 
Sebastian Schuberth
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help