3 test_description='.mailmap configurations'
7 test_expect_success setup '
11 git commit -m initial &&
15 git commit --author "nick1 <bugs@company.xx>" -m second
27 test_expect_success 'No mailmap' '
28 git shortlog HEAD >actual &&
29 test_cmp expect actual
41 test_expect_success 'default .mailmap' '
42 echo "Repo Guy <author@example.com>" > .mailmap &&
43 git shortlog HEAD >actual &&
44 test_cmp expect actual
47 # Using a mailmap file in a subdirectory of the repo here, but
48 # could just as well have been a file outside of the repository
57 test_expect_success 'mailmap.file set' '
58 mkdir -p internal_mailmap &&
59 echo "Internal Guy <bugs@company.xx>" > internal_mailmap/.mailmap &&
60 git config mailmap.file internal_mailmap/.mailmap &&
61 git shortlog HEAD >actual &&
62 test_cmp expect actual
73 test_expect_success 'mailmap.file override' '
74 echo "External Guy <author@example.com>" >> internal_mailmap/.mailmap &&
75 git config mailmap.file internal_mailmap/.mailmap &&
76 git shortlog HEAD >actual &&
77 test_cmp expect actual
89 test_expect_success 'mailmap.file non-existant' '
90 rm internal_mailmap/.mailmap &&
91 rmdir internal_mailmap &&
92 git shortlog HEAD >actual &&
93 test_cmp expect actual
105 test_expect_success 'name entry after email entry' '
106 mkdir -p internal_mailmap &&
107 echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
108 echo "Internal Guy <bugs@company.xx>" >>internal_mailmap/.mailmap &&
109 git shortlog >actual &&
110 test_cmp expect actual
122 test_expect_success 'name entry after email entry, case-insensitive' '
123 mkdir -p internal_mailmap &&
124 echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
125 echo "Internal Guy <BUGS@Company.xx>" >>internal_mailmap/.mailmap &&
126 git shortlog >actual &&
127 test_cmp expect actual
138 test_expect_success 'No mailmap files, but configured' '
139 rm -f .mailmap internal_mailmap/.mailmap &&
140 git shortlog HEAD >actual &&
141 test_cmp expect actual
144 # Extended mailmap configurations should give us the following output for shortlog
146 A U Thor <author@example.com> (1):
149 CTO <cto@company.xx> (1):
152 Other Author <other@author.xx> (2):
156 Santa Claus <santa.claus@northpole.xx> (2):
160 Some Dude <some@dude.xx> (1):
165 test_expect_success 'Shortlog output (complex mapping)' '
169 git commit --author "nick2 <bugs@company.xx>" -m third &&
174 git commit --author "nick2 <nick2@company.xx>" -m fourth &&
179 git commit --author "santa <me@company.xx>" -m fifth &&
184 git commit --author "claus <me@company.xx>" -m sixth &&
189 git commit --author "CTO <cto@coompany.xx>" -m seventh &&
191 mkdir -p internal_mailmap &&
192 echo "Committed <committer@example.com>" > internal_mailmap/.mailmap &&
193 echo "<cto@company.xx> <cto@coompany.xx>" >> internal_mailmap/.mailmap &&
194 echo "Some Dude <some@dude.xx> nick1 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
195 echo "Other Author <other@author.xx> nick2 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
196 echo "Other Author <other@author.xx> <nick2@company.xx>" >> internal_mailmap/.mailmap &&
197 echo "Santa Claus <santa.claus@northpole.xx> <me@company.xx>" >> internal_mailmap/.mailmap &&
198 echo "Santa Claus <santa.claus@northpole.xx> <me@company.xx>" >> internal_mailmap/.mailmap &&
200 git shortlog -e HEAD >actual &&
201 test_cmp expect actual
205 # git log with --pretty format which uses the name and email mailmap placemarkers
207 Author CTO <cto@coompany.xx> maps to CTO <cto@company.xx>
208 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
210 Author claus <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>
211 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
213 Author santa <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>
214 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
216 Author nick2 <nick2@company.xx> maps to Other Author <other@author.xx>
217 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
219 Author nick2 <bugs@company.xx> maps to Other Author <other@author.xx>
220 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
222 Author nick1 <bugs@company.xx> maps to Some Dude <some@dude.xx>
223 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
225 Author A U Thor <author@example.com> maps to A U Thor <author@example.com>
226 Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>
229 test_expect_success 'Log output (complex mapping)' '
230 git log --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
231 test_cmp expect actual
236 ^3a2fdcb (A U Thor 2005-04-07 15:13:13 -0700 1) one
237 7de6f99b (Some Dude 2005-04-07 15:13:13 -0700 2) two
238 5815879d (Other Author 2005-04-07 15:14:13 -0700 3) three
239 ff859d96 (Other Author 2005-04-07 15:15:13 -0700 4) four
240 5ab6d4fa (Santa Claus 2005-04-07 15:16:13 -0700 5) five
241 38a42d8b (Santa Claus 2005-04-07 15:17:13 -0700 6) six
242 8ddc0386 (CTO 2005-04-07 15:18:13 -0700 7) seven
245 test_expect_success 'Blame output (complex mapping)' '
246 git blame one >actual &&
247 test_cmp expect actual