Merge branch 'rt/commentchar-fmt-merge-msg'

The new core.commentchar configuration was not applied to a few
places.

* rt/commentchar-fmt-merge-msg:
  fmt-merge-msg: use core.commentchar in tag signatures completely
  fmt-merge-msg: respect core.commentchar in people credits
This commit is contained in:
Junio C Hamano 2013-04-15 12:40:56 -07:00
commit 948cf4f5e5
2 changed files with 29 additions and 7 deletions

View file

@ -287,10 +287,10 @@ static void credit_people(struct strbuf *out,
const char *me; const char *me;
if (kind == 'a') { if (kind == 'a') {
label = "\n# By "; label = "By";
me = git_author_info(IDENT_NO_DATE); me = git_author_info(IDENT_NO_DATE);
} else { } else {
label = "\n# Via "; label = "Via";
me = git_committer_info(IDENT_NO_DATE); 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 && (me = skip_prefix(me, them->items->string)) != NULL &&
skip_prefix(me, " <"))) skip_prefix(me, " <")))
return; return;
strbuf_addstr(out, label); strbuf_addf(out, "\n%c %s ", comment_line_char, label);
add_people_count(out, them); add_people_count(out, them);
} }
@ -503,14 +503,18 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
} else { } else {
if (tag_number == 2) { if (tag_number == 2) {
struct strbuf tagline = STRBUF_INIT; struct strbuf tagline = STRBUF_INIT;
strbuf_addf(&tagline, "\n# %s\n", strbuf_addch(&tagline, '\n');
origins.items[first_tag].string); strbuf_add_commented_lines(&tagline,
origins.items[first_tag].string,
strlen(origins.items[first_tag].string));
strbuf_insert(&tagbuf, 0, tagline.buf, strbuf_insert(&tagbuf, 0, tagline.buf,
tagline.len); tagline.len);
strbuf_release(&tagline); strbuf_release(&tagline);
} }
strbuf_addf(&tagbuf, "\n# %s\n", strbuf_addch(&tagbuf, '\n');
origins.items[i].string); strbuf_add_commented_lines(&tagbuf,
origins.items[i].string,
strlen(origins.items[i].string));
fmt_tag_signature(&tagbuf, &sig, buf, len); fmt_tag_signature(&tagbuf, &sig, buf, len);
} }
strbuf_release(&sig); strbuf_release(&sig);

View file

@ -175,6 +175,24 @@ test_expect_success 'merge.log=5 shows all 5 commits' '
test_cmp expected actual 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' ' test_expect_success 'merge.log=0 disables shortlog' '
echo "Merge branch ${apos}left${apos}" >expected echo "Merge branch ${apos}left${apos}" >expected
git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual && git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&