3 test_description
='.mailmap configurations'
7 test_expect_success setup
'
11 git commit -m initial &&
14 git commit --author "nick1 <bugs@company.xx>" -m second
26 test_expect_success
'No mailmap' '
27 git shortlog HEAD >actual &&
28 test_cmp expect actual
40 test_expect_success
'default .mailmap' '
41 echo "Repo Guy <author@example.com>" > .mailmap &&
42 git shortlog HEAD >actual &&
43 test_cmp expect actual
46 # Using a mailmap file in a subdirectory of the repo here, but
47 # could just as well have been a file outside of the repository
56 test_expect_success
'mailmap.file set' '
57 mkdir internal_mailmap &&
58 echo "Internal Guy <bugs@company.xx>" > internal_mailmap/.mailmap &&
59 git config mailmap.file internal_mailmap/.mailmap &&
60 git shortlog HEAD >actual &&
61 test_cmp expect actual
72 test_expect_success
'mailmap.file override' '
73 echo "External Guy <author@example.com>" >> internal_mailmap/.mailmap &&
74 git config mailmap.file internal_mailmap/.mailmap &&
75 git shortlog HEAD >actual &&
76 test_cmp expect actual
88 test_expect_success
'mailmap.file non-existant' '
89 rm internal_mailmap/.mailmap &&
90 rmdir internal_mailmap &&
91 git shortlog HEAD >actual &&
92 test_cmp expect actual
103 test_expect_success
'No mailmap files, but configured' '
105 git shortlog HEAD >actual &&
106 test_cmp expect actual
109 # Extended mailmap configurations should give us the following output for shortlog
111 A U Thor
<author@example.com
> (1):
114 CTO
<cto@company.xx
> (1):
117 Other Author
<other@author.xx
> (2):
121 Santa Claus
<santa.claus@northpole.xx
> (2):
125 Some Dude
<some@dude.xx
> (1):
130 test_expect_success
'Shortlog output (complex mapping)' '
134 git commit --author "nick2 <bugs@company.xx>" -m third &&
139 git commit --author "nick2 <nick2@company.xx>" -m fourth &&
144 git commit --author "santa <me@company.xx>" -m fifth &&
149 git commit --author "claus <me@company.xx>" -m sixth &&
154 git commit --author "CTO <cto@coompany.xx>" -m seventh &&
156 mkdir internal_mailmap &&
157 echo "Committed <committer@example.com>" > internal_mailmap/.mailmap &&
158 echo "<cto@company.xx> <cto@coompany.xx>" >> internal_mailmap/.mailmap &&
159 echo "Some Dude <some@dude.xx> nick1 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
160 echo "Other Author <other@author.xx> nick2 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
161 echo "Other Author <other@author.xx> <nick2@company.xx>" >> internal_mailmap/.mailmap &&
162 echo "Santa Claus <santa.claus@northpole.xx> <me@company.xx>" >> internal_mailmap/.mailmap &&
163 echo "Santa Claus <santa.claus@northpole.xx> <me@company.xx>" >> internal_mailmap/.mailmap &&
165 git shortlog -e HEAD >actual &&
166 test_cmp expect actual
170 # git log with --pretty format which uses the name and email mailmap placemarkers
172 Author CTO
<cto@coompany.xx
> maps to CTO
<cto@company.xx
>
173 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
175 Author claus
<me@company.xx
> maps to Santa Claus
<santa.claus@northpole.xx
>
176 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
178 Author santa
<me@company.xx
> maps to Santa Claus
<santa.claus@northpole.xx
>
179 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
181 Author nick2
<nick2@company.xx
> maps to Other Author
<other@author.xx
>
182 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
184 Author nick2
<bugs@company.xx
> maps to Other Author
<other@author.xx
>
185 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
187 Author nick1
<bugs@company.xx
> maps to Some Dude
<some@dude.xx
>
188 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
190 Author A U Thor
<author@example.com
> maps to A U Thor
<author@example.com
>
191 Committer C O Mitter
<committer@example.com
> maps to Committed
<committer@example.com
>
194 test_expect_success
'Log output (complex mapping)' '
195 git log --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
196 test_cmp expect actual
201 ^
3a2fdcb
(A U Thor
2005-04-07 15:13:13 -0700 1) one
202 7de6f99b
(Some Dude
2005-04-07 15:13:13 -0700 2) two
203 5815879d
(Other Author
2005-04-07 15:14:13 -0700 3) three
204 ff859d96
(Other Author
2005-04-07 15:15:13 -0700 4) four
205 5ab6d4fa
(Santa Claus
2005-04-07 15:16:13 -0700 5) five
206 38a42d8b
(Santa Claus
2005-04-07 15:17:13 -0700 6) six
207 8ddc0386
(CTO
2005-04-07 15:18:13 -0700 7) seven
210 test_expect_success
'Blame output (complex mapping)' '
211 git blame one >actual &&
212 test_cmp expect actual