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

[RFC PATCH] sequencer: do_commit: print the change summary ala git-am

From
LNLeah Neukirchen <leah@vuxu.org>
Date
Apr 16, 2020, 12:39 UTC
Message-ID
<87mu7blg9w.fsf@vuxu.org>

This makes the output of "git pull --rebase" look as if using the apply backend.

Signed-off-by: Leah Neukirchen <leah@vuxu.org>
---
I noticed that the new "merge" rebase backend does not print lines ala
"Applying: reticulate the splines" anymore.  I found these useful when
using "git pull --rebase", as one easily saw which unpushed patches
were in the tree.  (Also, eliminated patches were not printed anymore,
but that is a special thing about our workflow, where many committers
can do exactly the same trivial patches often.)

I found do_commit to be the best place to put this, but I'm not super familiar with the Git code base; perhaps this also prints in other invocations where it rather shouldn't.

linelen is taken from builtin/am.c.
 sequencer.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/sequencer.c b/sequencer.c
index 6fd2674632..5e315eda1c 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1442,6 +1442,14 @@ static int write_rebase_head(struct object_id *oid)
 	return 0;
 }
 
+/**
+ * Returns the length of the first line of msg.
+ */
+static int linelen(const char *msg)
+{
+        return strchrnul(msg, '\n') - msg;
+}
+
 static int do_commit(struct repository *r,
 		     const char *msg_file, const char *author,
 		     struct replay_opts *opts, unsigned int flags,
@@ -1458,6 +1466,10 @@ static int do_commit(struct repository *r,
 					     "from '%s'"),
 					   msg_file);
 
+		if (!opts->quiet)
+			fprintf_ln(stdout, _("Applying: %.*s"),
+				linelen(sb.buf), sb.buf);
+
 		res = try_to_commit(r, msg_file ? &sb : NULL,
 				    author, opts, flags, &oid);
 		strbuf_release(&sb);
-- 
2.26.1
Next: Phillip Wood
Message 1 of 2 in “sequencer: do_commit: print the change summary ala git-am”
  1. sequencer: do_commit: print the change summary ala git-amLeah Neukirchen, Apr 16, 2020
  2. Phillip WoodApr 16, 2020

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.