@@ -13,8 +13,8 @@ fuzz_blame () {
13
13
}
14
14
15
15
test_expect_success setup '
16
- cat >contacts <<-\ EOF &&
17
-
16
+ cat >contacts <<- EOF &&
17
+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
18
18
19
19
EOF
20
20
@@ -33,19 +33,19 @@ test_expect_success 'check-mailmap no arguments' '
33
33
'
34
34
35
35
test_expect_success ' check-mailmap arguments' '
36
- cat >expect <<-\ EOF &&
37
-
36
+ cat >expect <<- EOF &&
37
+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
38
38
39
39
EOF
40
40
git check-mailmap \
41
-
41
+ "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >" \
42
42
"nick1 <[email protected] >" >actual &&
43
43
test_cmp expect actual
44
44
'
45
45
46
46
test_expect_success ' check-mailmap --stdin' '
47
- cat >expect <<-\ EOF &&
48
-
47
+ cat >expect <<- EOF &&
48
+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
49
49
50
50
EOF
51
51
git check-mailmap --stdin <contacts >actual &&
@@ -66,8 +66,8 @@ test_expect_success 'check-mailmap bogus contact' '
66
66
test_must_fail git check-mailmap bogus
67
67
'
68
68
69
- cat > expect << \ EOF
70
- A U Thor (1):
69
+ cat > expect << EOF
70
+ $GIT_AUTHOR_NAME (1):
71
71
initial
72
72
73
73
nick1 (1):
@@ -90,7 +90,7 @@ nick1 (1):
90
90
EOF
91
91
92
92
test_expect_success ' default .mailmap' '
93
- echo "Repo Guy <[email protected] >" > .mailmap &&
93
+ echo "Repo Guy <$GIT_AUTHOR_EMAIL >" > .mailmap &&
94
94
git shortlog HEAD >actual &&
95
95
test_cmp expect actual
96
96
'
@@ -122,7 +122,7 @@ Internal Guy (1):
122
122
123
123
EOF
124
124
test_expect_success ' mailmap.file override' '
125
- echo "External Guy <[email protected] >" >> internal_mailmap/.mailmap &&
125
+ echo "External Guy <$GIT_AUTHOR_EMAIL >" >> internal_mailmap/.mailmap &&
126
126
git config mailmap.file internal_mailmap/.mailmap &&
127
127
git shortlog HEAD >actual &&
128
128
test_cmp expect actual
@@ -178,8 +178,8 @@ test_expect_success 'name entry after email entry, case-insensitive' '
178
178
test_cmp expect actual
179
179
'
180
180
181
- cat > expect << \ EOF
182
- A U Thor (1):
181
+ cat > expect << EOF
182
+ $GIT_AUTHOR_NAME (1):
183
183
initial
184
184
185
185
nick1 (1):
@@ -195,18 +195,18 @@ test_expect_success 'No mailmap files, but configured' '
195
195
test_expect_success ' setup mailmap blob tests' '
196
196
git checkout -b map &&
197
197
test_when_finished "git checkout master" &&
198
- cat >just-bugs <<-\ EOF &&
198
+ cat >just-bugs <<- EOF &&
199
199
200
200
EOF
201
- cat >both <<-\ EOF &&
202
-
201
+ cat >both <<- EOF &&
202
+ Blob Guy <$GIT_AUTHOR_EMAIL >
203
203
204
204
EOF
205
- printf "Tricky Guy <[email protected] >" >no-newline &&
205
+ printf "Tricky Guy <$GIT_AUTHOR_EMAIL >" >no-newline &&
206
206
git add just-bugs both no-newline &&
207
207
git commit -m "my mailmaps" &&
208
- echo "Repo Guy <[email protected] >" >.mailmap &&
209
- echo "Internal Guy <[email protected] >" >internal.map
208
+ echo "Repo Guy <$GIT_AUTHOR_EMAIL >" >.mailmap &&
209
+ echo "Internal Guy <$GIT_AUTHOR_EMAIL >" >internal.map
210
210
'
211
211
212
212
test_expect_success ' mailmap.blob set' '
@@ -266,12 +266,12 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' '
266
266
git init non-bare &&
267
267
(
268
268
cd non-bare &&
269
- test_commit one .mailmap "Fake Name <[email protected] >" &&
269
+ test_commit one .mailmap "Fake Name <$GIT_AUTHOR_EMAIL >" &&
270
270
echo " 1 Fake Name" >expect &&
271
271
git shortlog -ns HEAD >actual &&
272
272
test_cmp expect actual &&
273
273
rm .mailmap &&
274
- echo " 1 A U Thor " >expect &&
274
+ echo " 1 $GIT_AUTHOR_NAME " >expect &&
275
275
git shortlog -ns HEAD >actual &&
276
276
test_cmp expect actual
277
277
)
@@ -305,26 +305,26 @@ test_expect_success 'cleanup after mailmap.blob tests' '
305
305
'
306
306
307
307
test_expect_success ' single-character name' '
308
- echo " 1 A <[email protected] >" >expect &&
308
+ echo " 1 A <$GIT_AUTHOR_EMAIL >" >expect &&
309
309
echo " 1 nick1 <[email protected] >" >>expect &&
310
- echo "A <[email protected] >" >.mailmap &&
310
+ echo "A <$GIT_AUTHOR_EMAIL >" >.mailmap &&
311
311
test_when_finished "rm .mailmap" &&
312
312
git shortlog -es HEAD >actual &&
313
313
test_cmp expect actual
314
314
'
315
315
316
316
test_expect_success ' preserve canonical email case' '
317
- echo " 1 A U Thor <[email protected] >" >expect &&
317
+ echo " 1 $GIT_AUTHOR_NAME <[email protected] >" >expect &&
318
318
echo " 1 nick1 <[email protected] >" >>expect &&
319
-
319
+ echo "<[email protected] > <$GIT_AUTHOR_EMAIL >" >.mailmap &&
320
320
test_when_finished "rm .mailmap" &&
321
321
git shortlog -es HEAD >actual &&
322
322
test_cmp expect actual
323
323
'
324
324
325
325
# Extended mailmap configurations should give us the following output for shortlog
326
- cat > expect << \ EOF
327
-
326
+ cat > expect << EOF
327
+ $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL > (1):
328
328
initial
329
329
330
330
@@ -370,7 +370,7 @@ test_expect_success 'Shortlog output (complex mapping)' '
370
370
git commit --author "CTO <[email protected] >" -m seventh &&
371
371
372
372
mkdir -p internal_mailmap &&
373
- echo "Committed <[email protected] >" > internal_mailmap/.mailmap &&
373
+ echo "Committed <$GIT_COMMITTER_EMAIL >" > internal_mailmap/.mailmap &&
374
374
echo "<[email protected] > <[email protected] >" >> internal_mailmap/.mailmap &&
375
375
echo "Some Dude <[email protected] > nick1 <[email protected] >" >> internal_mailmap/.mailmap &&
376
376
echo "Other Author <[email protected] > nick2 <[email protected] >" >> internal_mailmap/.mailmap &&
@@ -384,57 +384,85 @@ test_expect_success 'Shortlog output (complex mapping)' '
384
384
'
385
385
386
386
# git log with --pretty format which uses the name and email mailmap placemarkers
387
- cat > expect << \ EOF
387
+ cat > expect << EOF
388
388
389
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
389
+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
390
390
391
391
Author claus <[email protected] > maps to Santa Claus <[email protected] >
392
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
392
+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
393
393
394
394
Author santa <[email protected] > maps to Santa Claus <[email protected] >
395
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
395
+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
396
396
397
397
Author nick2 <[email protected] > maps to Other Author <[email protected] >
398
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
398
+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
399
399
400
400
Author nick2 <[email protected] > maps to Other Author <[email protected] >
401
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
401
+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
402
402
403
403
Author nick1 <[email protected] > maps to Some Dude <[email protected] >
404
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
404
+ Committer $GIT_COMMITTER_NAME < $GIT_COMMITTER_EMAIL > maps to Committed <$GIT_COMMITTER_EMAIL >
405
405
406
- Author A U Thor <[email protected] > maps to A U Thor <[email protected] >
407
- Committer C O Mitter <[email protected] > maps to Committed <[email protected] >
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 >
408
408
EOF
409
409
410
410
test_expect_success ' Log output (complex mapping)' '
411
411
git log --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
412
412
test_cmp expect actual
413
413
'
414
414
415
- cat > expect << \EOF
415
+ cat > expect << EOF
416
+ Author email [email protected] has local-part cto
417
+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
418
+
419
+ Author email [email protected] has local-part me
420
+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
421
+
422
+ Author email [email protected] has local-part me
423
+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
424
+
425
+ Author email [email protected] has local-part nick2
426
+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
427
+
428
+ Author email [email protected] has local-part bugs
429
+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
430
+
431
+ Author email [email protected] has local-part bugs
432
+ Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME
433
+
434
+ Author email [email protected] 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
416
444
417
445
Author: Santa Claus <[email protected] >
418
446
Author: Santa Claus <[email protected] >
419
447
Author: Other Author <[email protected] >
420
448
Author: Other Author <[email protected] >
421
449
Author: Some Dude <[email protected] >
422
- Author: A U Thor <[email protected] >
450
+ Author: $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL >
423
451
EOF
424
452
425
453
test_expect_success ' Log output with --use-mailmap' '
426
454
git log --use-mailmap | grep Author >actual &&
427
455
test_cmp expect actual
428
456
'
429
457
430
- cat > expect << \ EOF
458
+ cat > expect << EOF
431
459
432
460
Author: Santa Claus <[email protected] >
433
461
Author: Santa Claus <[email protected] >
434
462
Author: Other Author <[email protected] >
435
463
Author: Other Author <[email protected] >
436
464
Author: Some Dude <[email protected] >
437
- Author: A U Thor <[email protected] >
465
+ Author: $GIT_AUTHOR_NAME < $GIT_AUTHOR_EMAIL >
438
466
EOF
439
467
440
468
test_expect_success ' Log output with log.mailmap' '
@@ -443,28 +471,28 @@ test_expect_success 'Log output with log.mailmap' '
443
471
'
444
472
445
473
test_expect_success ' log.mailmap=false disables mailmap' '
446
- cat >expect <<-\ EOF &&
474
+ cat >expect <<- EOF &&
447
475
448
476
449
477
450
478
451
479
452
480
453
- Author: A U Thor <[email protected] >
481
+ Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
454
482
EOF
455
483
git -c log.mailmap=False log | grep Author > actual &&
456
484
test_cmp expect actual
457
485
'
458
486
459
487
test_expect_success ' --no-use-mailmap disables mailmap' '
460
- cat >expect <<-\ EOF &&
488
+ cat >expect <<- EOF &&
461
489
462
490
463
491
464
492
465
493
466
494
467
- Author: A U Thor <[email protected] >
495
+ Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL >
468
496
EOF
469
497
git log --no-use-mailmap | grep Author > actual &&
470
498
test_cmp expect actual
@@ -500,8 +528,8 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '
500
528
'
501
529
502
530
# 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
505
533
OBJID (Some Dude DATE 2) two
506
534
OBJID (Other Author DATE 3) three
507
535
OBJID (Other Author DATE 4) four
0 commit comments