git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fmt-merge-msg: respect core.commentchar in people credits
@ 2013-04-07 15:25 Ralf Thielow
  2013-04-07 15:25 ` [PATCH 2/2] fmt-merge-msg: use core.commentchar in tag signatures completely Ralf Thielow
  0 siblings, 1 reply; 12+ messages in thread
From: Ralf Thielow @ 2013-04-07 15:25 UTC (permalink / raw)
  To: git; +Cc: gitster, Ralf Thielow

Commit eff80a9 (Allow custom "comment char") introduced a custom
comment character for commit messages but forgot to use it in
people credits which can be a part of a commit message.

With this commit, the custom comment character is also used
in people credits.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 builtin/fmt-merge-msg.c  |  6 +++---
 t/t6200-fmt-merge-msg.sh | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 265a925..88df93a 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -287,10 +287,10 @@ static void credit_people(struct strbuf *out,
 	const char *me;
 
 	if (kind == 'a') {
-		label = "\n# By ";
+		label = "By";
 		me = git_author_info(IDENT_NO_DATE);
 	} else {
-		label = "\n# Via ";
+		label = "Via";
 		me = git_committer_info(IDENT_NO_DATE);
 	}
 
@@ -300,7 +300,7 @@ static void credit_people(struct strbuf *out,
 	     (me = skip_prefix(me, them->items->string)) != NULL &&
 	     skip_prefix(me, " <")))
 		return;
-	strbuf_addstr(out, label);
+	strbuf_addf(out, "\n%c %s ", comment_line_char, label);
 	add_people_count(out, them);
 }
 
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 992c2a0..84e10fd 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -180,6 +180,24 @@ test_expect_success 'merge.log=5 shows all 5 commits' '
 	test_cmp expected actual
 '
 
+test_expect_success '--log=5 with custom comment character' '
+	cat >expected <<-EOF &&
+	Merge branch ${apos}left${apos}
+
+	/ By Another Author (3) and A U Thor (2)
+	/ Via Another Committer
+	* left:
+	  Left #5
+	  Left #4
+	  Left #3
+	  Common #2
+	  Common #1
+	EOF
+
+	git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
+	test_cmp expected actual
+'
+
 test_expect_success 'merge.log=0 disables shortlog' '
 	echo "Merge branch ${apos}left${apos}" >expected
 	git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
-- 
1.8.2.470.g21ccebe

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-04-21  7:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-07 15:25 [PATCH 1/2] fmt-merge-msg: respect core.commentchar in people credits Ralf Thielow
2013-04-07 15:25 ` [PATCH 2/2] fmt-merge-msg: use core.commentchar in tag signatures completely Ralf Thielow
2013-04-18  6:42   ` t6200: avoid path mangling issue on Windows Johannes Sixt
2013-04-18 17:05     ` Junio C Hamano
2013-04-19  5:48       ` Johannes Sixt
2013-04-19 16:33         ` Junio C Hamano
2013-04-19 19:46           ` Johannes Sixt
2013-04-19 21:22             ` Junio C Hamano
2013-04-21  0:05               ` Jonathan Nieder
2013-04-21  6:22                 ` Johannes Sixt
2013-04-21  6:35                   ` Jonathan Nieder
2013-04-21  7:12                 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).