@matheusbsbs / matheus-bagliano / commits / 45e206f0d8
Fork 0

t4203: use test-lib.sh definitions

Use name and email definitions from test-lib.sh. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Prarit Bhargava committed Oct 24, 2019 at 19:36 UTC 45e206f0d845cfc85c39c98d0090104e72176d71
1 file changed +47 -47
t/t4203-mailmap.sh
+47 -47
@@ -13,8 +13,8 @@ fuzz_blame () {
13 }
14
15 test_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>
18 nick1 <bugs@company.xx>
19 EOF
20
@@ -33,19 +33,19 @@ test_expect_success 'check-mailmap no arguments' '
33 '
34
35 test_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>
38 nick1 <bugs@company.xx>
39 EOF
40 git check-mailmap \
41 - "A U Thor <author@example.com>" \
41 + "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" \
42 "nick1 <bugs@company.xx>" >actual &&
43 test_cmp expect actual
44 '
45
46 test_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>
49 nick1 <bugs@company.xx>
50 EOF
51 git check-mailmap --stdin <contacts >actual &&
@@ -66,8 +66,8 @@ test_expect_success 'check-mailmap bogus contact' '
66 test_must_fail git check-mailmap bogus
67 '
68
69 -cat >expect <<\EOF
70 -A U Thor (1):
69 +cat >expect << EOF
70 +$GIT_AUTHOR_NAME (1):
71 initial
72
73 nick1 (1):
@@ -90,7 +90,7 @@ nick1 (1):
90 EOF
91
92 test_expect_success 'default .mailmap' '
93 - echo "Repo Guy <author@example.com>" > .mailmap &&
93 + echo "Repo Guy <$GIT_AUTHOR_EMAIL>" > .mailmap &&
94 git shortlog HEAD >actual &&
95 test_cmp expect actual
96 '
@@ -122,7 +122,7 @@ Internal Guy (1):
122
123 EOF
124 test_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 &&
126 git config mailmap.file internal_mailmap/.mailmap &&
127 git shortlog HEAD >actual &&
128 test_cmp expect actual
@@ -178,8 +178,8 @@ test_expect_success 'name entry after email entry, case-insensitive' '
178 test_cmp expect actual
179 '
180
181 -cat >expect <<\EOF
182 -A U Thor (1):
181 +cat >expect << EOF
182 +$GIT_AUTHOR_NAME (1):
183 initial
184
185 nick1 (1):
@@ -195,18 +195,18 @@ test_expect_success 'No mailmap files, but configured' '
195 test_expect_success 'setup mailmap blob tests' '
196 git checkout -b map &&
197 test_when_finished "git checkout master" &&
198 - cat >just-bugs <<-\EOF &&
198 + cat >just-bugs <<- EOF &&
199 Blob Guy <bugs@company.xx>
200 EOF
201 - cat >both <<-\EOF &&
202 - Blob Guy <author@example.com>
201 + cat >both <<- EOF &&
202 + Blob Guy <$GIT_AUTHOR_EMAIL>
203 Blob Guy <bugs@company.xx>
204 EOF
205 - printf "Tricky Guy <author@example.com>" >no-newline &&
205 + printf "Tricky Guy <$GIT_AUTHOR_EMAIL>" >no-newline &&
206 git add just-bugs both no-newline &&
207 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
210 '
211
212 test_expect_success 'mailmap.blob set' '
@@ -266,12 +266,12 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' '
266 git init non-bare &&
267 (
268 cd non-bare &&
269 - test_commit one .mailmap "Fake Name <author@example.com>" &&
269 + test_commit one .mailmap "Fake Name <$GIT_AUTHOR_EMAIL>" &&
270 echo " 1 Fake Name" >expect &&
271 git shortlog -ns HEAD >actual &&
272 test_cmp expect actual &&
273 rm .mailmap &&
274 - echo " 1 A U Thor" >expect &&
274 + echo " 1 $GIT_AUTHOR_NAME" >expect &&
275 git shortlog -ns HEAD >actual &&
276 test_cmp expect actual
277 )
@@ -305,26 +305,26 @@ test_expect_success 'cleanup after mailmap.blob tests' '
305 '
306
307 test_expect_success 'single-character name' '
308 - echo " 1 A <author@example.com>" >expect &&
308 + echo " 1 A <$GIT_AUTHOR_EMAIL>" >expect &&
309 echo " 1 nick1 <bugs@company.xx>" >>expect &&
310 - echo "A <author@example.com>" >.mailmap &&
310 + echo "A <$GIT_AUTHOR_EMAIL>" >.mailmap &&
311 test_when_finished "rm .mailmap" &&
312 git shortlog -es HEAD >actual &&
313 test_cmp expect actual
314 '
315
316 test_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 &&
318 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 &&
320 test_when_finished "rm .mailmap" &&
321 git shortlog -es HEAD >actual &&
322 test_cmp expect actual
323 '
324
325 # 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):
328 initial
329
330 CTO <cto@company.xx> (1):
@@ -370,7 +370,7 @@ test_expect_success 'Shortlog output (complex mapping)' '
370 git commit --author "CTO <cto@coompany.xx>" -m seventh &&
371
372 mkdir -p internal_mailmap &&
373 - echo "Committed <committer@example.com>" > internal_mailmap/.mailmap &&
373 + echo "Committed <$GIT_COMMITTER_EMAIL>" > internal_mailmap/.mailmap &&
374 echo "<cto@company.xx> <cto@coompany.xx>" >> internal_mailmap/.mailmap &&
375 echo "Some Dude <some@dude.xx> nick1 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
376 echo "Other Author <other@author.xx> nick2 <bugs@company.xx>" >> internal_mailmap/.mailmap &&
@@ -384,27 +384,27 @@ test_expect_success 'Shortlog output (complex mapping)' '
384 '
385
386 # git log with --pretty format which uses the name and email mailmap placemarkers
387 -cat >expect <<\EOF
387 +cat >expect << EOF
388 Author 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>
390
391 Author 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>
393
394 Author 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>
396
397 Author 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>
399
400 Author 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>
402
403 Author 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>
405
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>
408 EOF
409
410 test_expect_success 'Log output (complex mapping)' '
@@ -412,14 +412,14 @@ test_expect_success 'Log output (complex mapping)' '
412 test_cmp expect actual
413 '
414
415 -cat >expect <<\EOF
415 +cat >expect << EOF
416 Author: CTO <cto@company.xx>
417 Author: Santa Claus <santa.claus@northpole.xx>
418 Author: Santa Claus <santa.claus@northpole.xx>
419 Author: Other Author <other@author.xx>
420 Author: Other Author <other@author.xx>
421 Author: Some Dude <some@dude.xx>
422 -Author: A U Thor <author@example.com>
422 +Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
423 EOF
424
425 test_expect_success 'Log output with --use-mailmap' '
@@ -427,14 +427,14 @@ test_expect_success 'Log output with --use-mailmap' '
427 test_cmp expect actual
428 '
429
430 -cat >expect <<\EOF
430 +cat >expect << EOF
431 Author: CTO <cto@company.xx>
432 Author: Santa Claus <santa.claus@northpole.xx>
433 Author: Santa Claus <santa.claus@northpole.xx>
434 Author: Other Author <other@author.xx>
435 Author: Other Author <other@author.xx>
436 Author: Some Dude <some@dude.xx>
437 -Author: A U Thor <author@example.com>
437 +Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
438 EOF
439
440 test_expect_success 'Log output with log.mailmap' '
@@ -443,28 +443,28 @@ test_expect_success 'Log output with log.mailmap' '
443 '
444
445 test_expect_success 'log.mailmap=false disables mailmap' '
446 - cat >expect <<-\EOF &&
446 + cat >expect <<- EOF &&
447 Author: CTO <cto@coompany.xx>
448 Author: claus <me@company.xx>
449 Author: santa <me@company.xx>
450 Author: nick2 <nick2@company.xx>
451 Author: nick2 <bugs@company.xx>
452 Author: nick1 <bugs@company.xx>
453 - Author: A U Thor <author@example.com>
453 + Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
454 EOF
455 git -c log.mailmap=False log | grep Author > actual &&
456 test_cmp expect actual
457 '
458
459 test_expect_success '--no-use-mailmap disables mailmap' '
460 - cat >expect <<-\EOF &&
460 + cat >expect <<- EOF &&
461 Author: CTO <cto@coompany.xx>
462 Author: claus <me@company.xx>
463 Author: santa <me@company.xx>
464 Author: nick2 <nick2@company.xx>
465 Author: nick2 <bugs@company.xx>
466 Author: nick1 <bugs@company.xx>
467 - Author: A U Thor <author@example.com>
467 + Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
468 EOF
469 git log --no-use-mailmap | grep Author > actual &&
470 test_cmp expect actual
@@ -500,8 +500,8 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '
500 '
501
502 # git blame
503 -cat >expect <<\EOF
504 -^OBJI (A U Thor DATE 1) one
503 +cat >expect <<EOF
504 +^OBJI ($GIT_AUTHOR_NAME DATE 1) one
505 OBJID (Some Dude DATE 2) two
506 OBJID (Other Author DATE 3) three
507 OBJID (Other Author DATE 4) four