]> granicus.if.org Git - git/commitdiff
fmt-merge-msg: respect core.commentchar in people credits
authorRalf Thielow <ralf.thielow@gmail.com>
Sun, 7 Apr 2013 15:25:43 +0000 (17:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 7 Apr 2013 16:28:29 +0000 (09:28 -0700)
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>
builtin/fmt-merge-msg.c
t/t6200-fmt-merge-msg.sh

index b49612f0ce02e0c8503bee77477800297e84065d..4bf167ad8abf820ee3422bc273076acfdc2f061a 100644 (file)
@@ -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);
 }
 
index 992c2a04674d474a8875da955935512ec99f335a..84e10fde6fde69e69c24f959d529a5f946117352 100755 (executable)
@@ -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 &&