mailmap tests: add a test for comment syntax

Add a test for mailmap comment syntax. As noted in [1] there was no test coverage for this. Let's make sure a future change doesn't break it. 1. https://lore.kernel.org/git/CAN0heSoKYWXqskCR=GPreSHc6twCSo1345WTmiPdrR57XSShhA@mail.gmail.com/ Reported-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jan 12, 2021 at 21:18 UTC 9b391b09a084d49a71d29f1a90637252db427cbd
1 file changed +33
t/t4203-mailmap.sh
+33
@@ -753,4 +753,37 @@ test_expect_success 'commit --author honors mailmap' '
753 test_cmp expect actual
754 '
755
756 +test_expect_success 'comment syntax: setup' '
757 + test_create_repo comm &&
758 + test_commit -C comm --author "A <a@example.com>" A &&
759 + test_commit -C comm --author "B <b@example.com>" B &&
760 + test_commit -C comm --author "C <#@example.com>" C &&
761 + test_commit -C comm --author "D <d@e#ample.com>" D &&
762 +
763 + test_config -C comm mailmap.file ../doc.map &&
764 + cat >>doc.map <<-\EOF &&
765 + # Ah <a@example.com>
766 +
767 + ; Bee <b@example.com>
768 + Cee <cee@example.com> <#@example.com>
769 + Dee <dee@example.com> <d@e#ample.com>
770 + EOF
771 +
772 + cat >expect <<-\EOF &&
773 + Author A <a@example.com> maps to A <a@example.com>
774 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
775 +
776 + Author B <b@example.com> maps to ; Bee <b@example.com>
777 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
778 +
779 + Author C <#@example.com> maps to Cee <cee@example.com>
780 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
781 +
782 + Author D <d@e#ample.com> maps to Dee <dee@example.com>
783 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
784 + EOF
785 + git -C comm log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
786 + test_cmp expect actual
787 +'
788 +
789 test_done