git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Beat Bolli <bbolli@ewanet.ch>
Date
Feb 18, 2012, 21:14 UTC
Message-ID
<1329599690-9152-1-git-send-email-bbolli@ewanet.ch>

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 <raible@nextest.com>
Signed-off-by: Beat Bolli <bbolli@ewanet.ch>
---
 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
Next: Junio C Hamano
Message 1 of 5 in “cherry-pick -x: always insert an empty line”
  1. cherry-pick -x: always insert an empty lineBeat Bolli, Feb 18, 2012
  2. Junio C HamanoFeb 19, 2012
  3. Beat BolliFeb 23, 2012
  4. Sebastian SchuberthFeb 23, 2012
  5. Sebastian SchuberthFeb 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.