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

[PATCH/RFC] fmt-merge-msg: add a blank line after people info

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 11, 2012, 10:31 UTC
Message-ID
<20120511103122.GA19573@burratino>
In-Reply-To
<7vipi9mfhx.fsf@alter.siamese.dyndns.org>

The new "credit people" feature in fmt-merge-msg changed the format of a typical "merge --log" message from

	Merge branch for-upstream of git://git.example.com/subsystem
	* for-upstream: (51 commits)
	  foo: bar baz
to
	Merge branch for-upstream of git://git.example.com/subsystem
	By C O Ntributor
	* for-upstream: (51 commits)
	  foo: bar baz

The message feels more natural with a line of breathing room before the list of one-line descriptions headed by the branch name, like messages already get when attached to a merge by "fmt-merge-msg -m" or automatically incorporated during a merge of an annotated tag.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Hi again,
Junio C Hamano wrote:
> I'd hold making that judgement for a several weeks until my eyes get
> used to if I were you.

Turns out my reaction is pretty much the same as before. I still like the idea and still am distracted by the spacing. After the small patch below, the log seems peaceful again and I am totally fine with it.

	Merge branch for-upstream of git://git.example.com/subsystem
	By Fred the Clown
	* for-upstream: (51 commits)
	  foo: bar baz

Hope that helps, Jonathan

 builtin/fmt-merge-msg.c  |    5 +++++
 t/t6200-fmt-merge-msg.sh |    9 +++++++++
 2 files changed, 14 insertions(+)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 1bc6b8b8..8f228781 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -264,6 +264,8 @@ static void add_people_info(struct strbuf *out,
 			    struct string_list *authors,
 			    struct string_list *committers)
 {
+	size_t pos = out->len;
+
 	if (authors->nr)
 		qsort(authors->items,
 		      authors->nr, sizeof(authors->items[0]),
@@ -275,6 +277,9 @@ static void add_people_info(struct strbuf *out,
 
 	credit_people(out, authors, 'a');
 	credit_people(out, committers, 'c');
+
+	if (out->len > pos)
+		strbuf_addch(out, '\n');
 }
 
 static void shortlog(const char *name,
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 9b50f54c..d39417ba 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -104,6 +104,7 @@ test_expect_success '[merge] summary/log configuration' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left:
 	  Left #5
 	  Left #4
@@ -151,6 +152,7 @@ test_expect_success 'merge.log=3 limits shortlog length' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left: (5 commits)
 	  Left #5
 	  Left #4
@@ -168,6 +170,7 @@ test_expect_success 'merge.log=5 shows all 5 commits' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left:
 	  Left #5
 	  Left #4
@@ -192,6 +195,7 @@ test_expect_success '--log=3 limits shortlog length' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left: (5 commits)
 	  Left #5
 	  Left #4
@@ -209,6 +213,7 @@ test_expect_success '--log=5 shows all 5 commits' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left:
 	  Left #5
 	  Left #4
@@ -240,6 +245,7 @@ test_expect_success 'fmt-merge-msg -m' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* ${apos}left${apos} of $(pwd):
 	  Left #5
 	  Left #4
@@ -273,6 +279,7 @@ test_expect_success 'setup: expected shortlog for two branches' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left:
 	  Left #5
 	  Left #4
@@ -398,6 +405,7 @@ test_expect_success 'merge-msg two tags' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* tag ${apos}tag-l5${apos}:
 	  Left #5
 	  Left #4
@@ -428,6 +436,7 @@ test_expect_success 'merge-msg tag and branch' '
 
 	By Another Author (3) and A U Thor (2)
 	via Another Committer
+
 	* left:
 	  Left #5
 	  Left #4
-- 
1.7.10.1
Previous: Junio C HamanoNext: Junio C Hamano
Message 26 of 36 in “A possible fmt-merge-msg update?”
  1. Junio C HamanoMar 5, 2012
  2. Linus TorvaldsMar 5, 2012
  3. Junio C HamanoMar 5, 2012
  4. Linus TorvaldsMar 5, 2012
  5. fmt-merge-msg: show those involved in a merged seriesJunio C Hamano, Mar 5, 2012
  6. Linus TorvaldsMar 5, 2012
  7. Junio C HamanoMar 5, 2012
  8. René ScharfeMar 7, 2012
  9. Junio C HamanoMar 7, 2012
  10. René ScharfeMar 8, 2012
  11. Junio C HamanoMar 8, 2012
  12. Junio C HamanoMar 8, 2012
  13. Phil HordMar 12, 2012
  14. Jeff KingMar 13, 2012
  15. Junio C HamanoMar 14, 2012
  16. Phil HordMar 14, 2012
  17. Jonathan NiederMar 12, 2012
  18. Junio C HamanoMar 13, 2012
  19. Jonathan NiederMar 13, 2012
  20. Junio C HamanoMar 13, 2012
  21. Johannes SixtMar 13, 2012
  22. Junio C HamanoMar 13, 2012
  23. Johannes SixtMar 14, 2012
  24. Junio C HamanoMar 14, 2012
  25. 1/1 fmt-merge-msg: show those involved in a merged seriesJunio C Hamano, Mar 13, 2012
  26. fmt-merge-msg: add a blank line after people infoJonathan Nieder, May 11, 2012
  27. Junio C HamanoMay 11, 2012
  28. Linus TorvaldsMay 11, 2012
  29. Junio C HamanoMay 14, 2012
  30. Junio C HamanoMay 15, 2012
  31. Linus TorvaldsMay 16, 2012
  32. Junio C HamanoMay 16, 2012
  33. Jonathan NiederJun 6, 2012
  34. Jonathan NiederJun 6, 2012
  35. Junio C HamanoJun 6, 2012
  36. Jeff KingMar 6, 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.