@@ -13,8 +13,8 @@ fuzz_blame () {
1313}
1414
1515test_expect_success setup '
16- cat >contacts <<-\ EOF &&
17- A U Thor <author@example.com >
16+ cat >contacts <<- EOF &&
17+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
1818 nick1 <bugs@company.xx>
1919 EOF
2020
@@ -33,19 +33,19 @@ test_expect_success 'check-mailmap no arguments' '
3333'
3434
3535test_expect_success ' check-mailmap arguments' '
36- cat >expect <<-\ EOF &&
37- A U Thor <author@example.com >
36+ cat >expect <<- EOF &&
37+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
3838 nick1 <bugs@company.xx>
3939 EOF
4040 git check-mailmap \
41- "A U Thor <author@example.com >" \
41+ "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >" \
4242 "nick1 <bugs@company.xx>" >actual &&
4343 test_cmp expect actual
4444'
4545
4646test_expect_success ' check-mailmap --stdin' '
47- cat >expect <<-\ EOF &&
48- A U Thor <author@example.com >
47+ cat >expect <<- EOF &&
48+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
4949 nick1 <bugs@company.xx>
5050 EOF
5151 git check-mailmap --stdin <contacts >actual &&
@@ -66,8 +66,8 @@ test_expect_success 'check-mailmap bogus contact' '
6666 test_must_fail git check-mailmap bogus
6767'
6868
69- cat > expect << \ EOF
70- A U Thor (1):
69+ cat > expect << EOF
70+ $GIT_AUTHOR_NAME (1):
7171 initial
7272
7373nick1 (1):
@@ -90,7 +90,7 @@ nick1 (1):
9090EOF
9191
9292test_expect_success ' default .mailmap' '
93- echo "Repo Guy <author@example.com >" > .mailmap &&
93+ echo "Repo Guy <$GIT_AUTHOR_EMAIL >" > .mailmap &&
9494 git shortlog HEAD >actual &&
9595 test_cmp expect actual
9696'
@@ -122,7 +122,7 @@ Internal Guy (1):
122122
123123EOF
124124test_expect_success ' mailmap.file override' '
125- echo "External Guy <author@example.com >" >> internal_mailmap/.mailmap &&
125+ echo "External Guy <$GIT_AUTHOR_EMAIL >" >> internal_mailmap/.mailmap &&
126126 git config mailmap.file internal_mailmap/.mailmap &&
127127 git shortlog HEAD >actual &&
128128 test_cmp expect actual
@@ -178,8 +178,8 @@ test_expect_success 'name entry after email entry, case-insensitive' '
178178 test_cmp expect actual
179179'
180180
181- cat > expect << \ EOF
182- A U Thor (1):
181+ cat > expect << EOF
182+ $GIT_AUTHOR_NAME (1):
183183 initial
184184
185185nick1 (1):
@@ -195,18 +195,18 @@ test_expect_success 'No mailmap files, but configured' '
195195test_expect_success ' setup mailmap blob tests' '
196196 git checkout -b map &&
197197 test_when_finished "git checkout master" &&
198- cat >just-bugs <<-\ EOF &&
198+ cat >just-bugs <<- EOF &&
199199 Blob Guy <bugs@company.xx>
200200 EOF
201- cat >both <<-\ EOF &&
202- Blob Guy <author@example.com >
201+ cat >both <<- EOF &&
202+ Blob Guy <$GIT_AUTHOR_EMAIL >
203203 Blob Guy <bugs@company.xx>
204204 EOF
205- printf "Tricky Guy <author@example.com >" >no-newline &&
205+ printf "Tricky Guy <$GIT_AUTHOR_EMAIL >" >no-newline &&
206206 git add just-bugs both no-newline &&
207207 git commit -m "my mailmaps" &&
208- echo "Repo Guy <author@example.com >" >.mailmap &&
209- echo "Internal Guy <author@example.com >" >internal.map
208+ echo "Repo Guy <$GIT_AUTHOR_EMAIL >" >.mailmap &&
209+ echo "Internal Guy <$GIT_AUTHOR_EMAIL >" >internal.map
210210'
211211
212212test_expect_success ' mailmap.blob set' '
@@ -266,12 +266,12 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' '
266266 git init non-bare &&
267267 (
268268 cd non-bare &&
269- test_commit one .mailmap "Fake Name <author@example.com >" &&
269+ test_commit one .mailmap "Fake Name <$GIT_AUTHOR_EMAIL >" &&
270270 echo " 1 Fake Name" >expect &&
271271 git shortlog -ns HEAD >actual &&
272272 test_cmp expect actual &&
273273 rm .mailmap &&
274- echo " 1 A U Thor " >expect &&
274+ echo " 1 $GIT_AUTHOR_NAME " >expect &&
275275 git shortlog -ns HEAD >actual &&
276276 test_cmp expect actual
277277 )
@@ -305,26 +305,26 @@ test_expect_success 'cleanup after mailmap.blob tests' '
305305'
306306
307307test_expect_success ' single-character name' '
308- echo " 1 A <author@example.com >" >expect &&
308+ echo " 1 A <$GIT_AUTHOR_EMAIL >" >expect &&
309309 echo " 1 nick1 <bugs@company.xx>" >>expect &&
310- echo "A <author@example.com >" >.mailmap &&
310+ echo "A <$GIT_AUTHOR_EMAIL >" >.mailmap &&
311311 test_when_finished "rm .mailmap" &&
312312 git shortlog -es HEAD >actual &&
313313 test_cmp expect actual
314314'
315315
316316test_expect_success ' preserve canonical email case' '
317- echo " 1 A U Thor <AUTHOR@example.com>" >expect &&
317+ echo " 1 $GIT_AUTHOR_NAME <AUTHOR@example.com>" >expect &&
318318 echo " 1 nick1 <bugs@company.xx>" >>expect &&
319- echo "<AUTHOR@example.com> <author@example.com >" >.mailmap &&
319+ echo "<AUTHOR@example.com> <$GIT_AUTHOR_EMAIL >" >.mailmap &&
320320 test_when_finished "rm .mailmap" &&
321321 git shortlog -es HEAD >actual &&
322322 test_cmp expect actual
323323'
324324
325325# Extended mailmap configurations should give us the following output for shortlog
326- cat > expect << \ EOF
327- A U Thor <author@example.com > (1):
326+ cat > expect << EOF
327+ $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL > (1):
328328 initial
329329
330330CTO <cto@company.xx> (1):
@@ -370,7 +370,7 @@ test_expect_success 'Shortlog output (complex mapping)' '
370370 git commit --author "CTO <cto@coompany.xx>" -m seventh &&
371371
372372 mkdir -p internal_mailmap &&
373- echo "Committed <committer@example.com >" > internal_mailmap/.mailmap &&
373+ echo "Committed <$GIT_COMMITTER_EMAIL >" > internal_mailmap/.mailmap &&
374374 echo "<cto@company.xx> <cto@coompany.xx>" >> internal_mailmap/.mailmap &&
375375 echo "Some Dude <some@dude.xx> nick1 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
376376 echo "Other Author <other@author.xx> nick2 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
@@ -384,57 +384,85 @@ test_expect_success 'Shortlog output (complex mapping)' '
384384'
385385
386386# git log with --pretty format which uses the name and email mailmap placemarkers
387- cat > expect << \ EOF
387+ cat > expect << EOF
388388Author CTO <cto@coompany.xx> maps to CTO <cto@company.xx>
389- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
389+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
390390
391391Author claus <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>
392- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
392+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
393393
394394Author santa <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>
395- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
395+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
396396
397397Author nick2 <nick2@company.xx> maps to Other Author <other@author.xx>
398- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
398+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
399399
400400Author nick2 <bugs@company.xx> maps to Other Author <other@author.xx>
401- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
401+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
402402
403403Author nick1 <bugs@company.xx> maps to Some Dude <some@dude.xx>
404- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
404+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
405405
406- Author A U Thor <author@example.com > maps to A U Thor <author@example.com >
407- Committer C O Mitter <committer@example.com > maps to Committed <committer@example.com >
406+ Author $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL > maps to $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL >
407+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
408408EOF
409409
410410test_expect_success ' Log output (complex mapping)' '
411411 git log --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
412412 test_cmp expect actual
413413'
414414
415- cat > expect << \EOF
415+ cat > expect << EOF
416+ Author email cto@coompany.xx has local-part cto
417+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
418+
419+ Author email me@company.xx has local-part me
420+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
421+
422+ Author email me@company.xx has local-part me
423+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
424+
425+ Author email nick2@company.xx has local-part nick2
426+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
427+
428+ Author email bugs@company.xx has local-part bugs
429+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
430+
431+ Author email bugs@company.xx has local-part bugs
432+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
433+
434+ Author email author@example.com has local-part author
435+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
436+ EOF
437+
438+ test_expect_success ' Log output (local-part email address)' '
439+ git log --pretty=format:"Author email %ae has local-part %al%nCommitter email %ce has local-part %cl%n" >actual &&
440+ test_cmp expect actual
441+ '
442+
443+ cat > expect << EOF
416444Author: CTO <cto@company.xx>
417445Author: Santa Claus <santa.claus@northpole.xx>
418446Author: Santa Claus <santa.claus@northpole.xx>
419447Author: Other Author <other@author.xx>
420448Author: Other Author <other@author.xx>
421449Author: Some Dude <some@dude.xx>
422- Author: A U Thor <author@example.com >
450+ Author: $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL >
423451EOF
424452
425453test_expect_success ' Log output with --use-mailmap' '
426454 git log --use-mailmap | grep Author >actual &&
427455 test_cmp expect actual
428456'
429457
430- cat > expect << \ EOF
458+ cat > expect << EOF
431459Author: CTO <cto@company.xx>
432460Author: Santa Claus <santa.claus@northpole.xx>
433461Author: Santa Claus <santa.claus@northpole.xx>
434462Author: Other Author <other@author.xx>
435463Author: Other Author <other@author.xx>
436464Author: Some Dude <some@dude.xx>
437- Author: A U Thor <author@example.com >
465+ Author: $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL >
438466EOF
439467
440468test_expect_success ' Log output with log.mailmap' '
@@ -443,28 +471,28 @@ test_expect_success 'Log output with log.mailmap' '
443471'
444472
445473test_expect_success ' log.mailmap=false disables mailmap' '
446- cat >expect <<-\ EOF &&
474+ cat >expect <<- EOF &&
447475 Author: CTO <cto@coompany.xx>
448476 Author: claus <me@company.xx>
449477 Author: santa <me@company.xx>
450478 Author: nick2 <nick2@company.xx>
451479 Author: nick2 <bugs@company.xx>
452480 Author: nick1 <bugs@company.xx>
453- Author: A U Thor <author@example.com >
481+ Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
454482 EOF
455483 git -c log.mailmap=False log | grep Author > actual &&
456484 test_cmp expect actual
457485'
458486
459487test_expect_success ' --no-use-mailmap disables mailmap' '
460- cat >expect <<-\ EOF &&
488+ cat >expect <<- EOF &&
461489 Author: CTO <cto@coompany.xx>
462490 Author: claus <me@company.xx>
463491 Author: santa <me@company.xx>
464492 Author: nick2 <nick2@company.xx>
465493 Author: nick2 <bugs@company.xx>
466494 Author: nick1 <bugs@company.xx>
467- Author: A U Thor <author@example.com >
495+ Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
468496 EOF
469497 git log --no-use-mailmap | grep Author > actual &&
470498 test_cmp expect actual
@@ -500,8 +528,8 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '
500528'
501529
502530# git blame
503- cat > expect << \ EOF
504- ^OBJI (A U Thor DATE 1) one
531+ cat > expect << EOF
532+ ^OBJI ($GIT_AUTHOR_NAME DATE 1) one
505533OBJID (Some Dude DATE 2) two
506534OBJID (Other Author DATE 3) three
507535OBJID (Other Author DATE 4) four
0 commit comments