fmt-merge-msg: respect core.commentchar in people credits

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ralf Thielow committed Apr 7, 2013 at 17:25 UTC 9927ebed1966be260afb3579781d5b4a9ee4a029
2 files changed +21 -3
builtin/fmt-merge-msg.c
+3 -3
@@ -287,10 +287,10 @@ static void credit_people(struct strbuf *out,
287 const char *me;
288
289 if (kind == 'a') {
290 - label = "\n# By ";
290 + label = "By";
291 me = git_author_info(IDENT_NO_DATE);
292 } else {
293 - label = "\n# Via ";
293 + label = "Via";
294 me = git_committer_info(IDENT_NO_DATE);
295 }
296
@@ -300,7 +300,7 @@ static void credit_people(struct strbuf *out,
300 (me = skip_prefix(me, them->items->string)) != NULL &&
301 skip_prefix(me, " <")))
302 return;
303 - strbuf_addstr(out, label);
303 + strbuf_addf(out, "\n%c %s ", comment_line_char, label);
304 add_people_count(out, them);
305 }
306
t/t6200-fmt-merge-msg.sh
+18
@@ -180,6 +180,24 @@ test_expect_success 'merge.log=5 shows all 5 commits' '
180 test_cmp expected actual
181 '
182
183 +test_expect_success '--log=5 with custom comment character' '
184 + cat >expected <<-EOF &&
185 + Merge branch ${apos}left${apos}
186 +
187 + / By Another Author (3) and A U Thor (2)
188 + / Via Another Committer
189 + * left:
190 + Left #5
191 + Left #4
192 + Left #3
193 + Common #2
194 + Common #1
195 + EOF
196 +
197 + git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
198 + test_cmp expected actual
199 +'
200 +
201 test_expect_success 'merge.log=0 disables shortlog' '
202 echo "Merge branch ${apos}left${apos}" >expected
203 git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&