[PATCH v3 2/3] t4203: Use test-lib.sh definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use name and email definitions from test-lib.sh.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
---
 t/t4203-mailmap.sh | 94 +++++++++++++++++++++++-----------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 918ada69eb96..e8f9c0f5bc8c 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -13,8 +13,8 @@ fuzz_blame () {
 }
 
 test_expect_success setup '
-	cat >contacts <<-\EOF &&
-	A U Thor <author@xxxxxxxxxxx>
+	cat >contacts <<- EOF &&
+	$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 	nick1 <bugs@xxxxxxxxxx>
 	EOF
 
@@ -33,19 +33,19 @@ test_expect_success 'check-mailmap no arguments' '
 '
 
 test_expect_success 'check-mailmap arguments' '
-	cat >expect <<-\EOF &&
-	A U Thor <author@xxxxxxxxxxx>
+	cat >expect <<- EOF &&
+	$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 	nick1 <bugs@xxxxxxxxxx>
 	EOF
 	git check-mailmap \
-		"A U Thor <author@xxxxxxxxxxx>" \
+		"$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" \
 		"nick1 <bugs@xxxxxxxxxx>" >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'check-mailmap --stdin' '
-	cat >expect <<-\EOF &&
-	A U Thor <author@xxxxxxxxxxx>
+	cat >expect <<- EOF &&
+	$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 	nick1 <bugs@xxxxxxxxxx>
 	EOF
 	git check-mailmap --stdin <contacts >actual &&
@@ -66,8 +66,8 @@ test_expect_success 'check-mailmap bogus contact' '
 	test_must_fail git check-mailmap bogus
 '
 
-cat >expect <<\EOF
-A U Thor (1):
+cat >expect << EOF
+$GIT_AUTHOR_NAME (1):
       initial
 
 nick1 (1):
@@ -90,7 +90,7 @@ nick1 (1):
 EOF
 
 test_expect_success 'default .mailmap' '
-	echo "Repo Guy <author@xxxxxxxxxxx>" > .mailmap &&
+	echo "Repo Guy <$GIT_AUTHOR_EMAIL>" > .mailmap &&
 	git shortlog HEAD >actual &&
 	test_cmp expect actual
 '
@@ -122,7 +122,7 @@ Internal Guy (1):
 
 EOF
 test_expect_success 'mailmap.file override' '
-	echo "External Guy <author@xxxxxxxxxxx>" >> internal_mailmap/.mailmap &&
+	echo "External Guy <$GIT_AUTHOR_EMAIL>" >> internal_mailmap/.mailmap &&
 	git config mailmap.file internal_mailmap/.mailmap &&
 	git shortlog HEAD >actual &&
 	test_cmp expect actual
@@ -178,8 +178,8 @@ test_expect_success 'name entry after email entry, case-insensitive' '
 	test_cmp expect actual
 '
 
-cat >expect <<\EOF
-A U Thor (1):
+cat >expect << EOF
+$GIT_AUTHOR_NAME (1):
       initial
 
 nick1 (1):
@@ -195,18 +195,18 @@ test_expect_success 'No mailmap files, but configured' '
 test_expect_success 'setup mailmap blob tests' '
 	git checkout -b map &&
 	test_when_finished "git checkout master" &&
-	cat >just-bugs <<-\EOF &&
+	cat >just-bugs <<- EOF &&
 	Blob Guy <bugs@xxxxxxxxxx>
 	EOF
-	cat >both <<-\EOF &&
-	Blob Guy <author@xxxxxxxxxxx>
+	cat >both <<- EOF &&
+	Blob Guy <$GIT_AUTHOR_EMAIL>
 	Blob Guy <bugs@xxxxxxxxxx>
 	EOF
-	printf "Tricky Guy <author@xxxxxxxxxxx>" >no-newline &&
+	printf "Tricky Guy <$GIT_AUTHOR_EMAIL>" >no-newline &&
 	git add just-bugs both no-newline &&
 	git commit -m "my mailmaps" &&
-	echo "Repo Guy <author@xxxxxxxxxxx>" >.mailmap &&
-	echo "Internal Guy <author@xxxxxxxxxxx>" >internal.map
+	echo "Repo Guy <$GIT_AUTHOR_EMAIL>" >.mailmap &&
+	echo "Internal Guy <$GIT_AUTHOR_EMAIL>" >internal.map
 '
 
 test_expect_success 'mailmap.blob set' '
@@ -266,12 +266,12 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' '
 	git init non-bare &&
 	(
 		cd non-bare &&
-		test_commit one .mailmap "Fake Name <author@xxxxxxxxxxx>" &&
+		test_commit one .mailmap "Fake Name <$GIT_AUTHOR_EMAIL>" &&
 		echo "     1	Fake Name" >expect &&
 		git shortlog -ns HEAD >actual &&
 		test_cmp expect actual &&
 		rm .mailmap &&
-		echo "     1	A U Thor" >expect &&
+		echo "     1	$GIT_AUTHOR_NAME" >expect &&
 		git shortlog -ns HEAD >actual &&
 		test_cmp expect actual
 	)
@@ -305,26 +305,26 @@ test_expect_success 'cleanup after mailmap.blob tests' '
 '
 
 test_expect_success 'single-character name' '
-	echo "     1	A <author@xxxxxxxxxxx>" >expect &&
+	echo "     1	A <$GIT_AUTHOR_EMAIL>" >expect &&
 	echo "     1	nick1 <bugs@xxxxxxxxxx>" >>expect &&
-	echo "A <author@xxxxxxxxxxx>" >.mailmap &&
+	echo "A <$GIT_AUTHOR_EMAIL>" >.mailmap &&
 	test_when_finished "rm .mailmap" &&
 	git shortlog -es HEAD >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'preserve canonical email case' '
-	echo "     1	A U Thor <AUTHOR@xxxxxxxxxxx>" >expect &&
+	echo "     1	$GIT_AUTHOR_NAME <AUTHOR@xxxxxxxxxxx>" >expect &&
 	echo "     1	nick1 <bugs@xxxxxxxxxx>" >>expect &&
-	echo "<AUTHOR@xxxxxxxxxxx> <author@xxxxxxxxxxx>" >.mailmap &&
+	echo "<AUTHOR@xxxxxxxxxxx> <$GIT_AUTHOR_EMAIL>" >.mailmap &&
 	test_when_finished "rm .mailmap" &&
 	git shortlog -es HEAD >actual &&
 	test_cmp expect actual
 '
 
 # Extended mailmap configurations should give us the following output for shortlog
-cat >expect <<\EOF
-A U Thor <author@xxxxxxxxxxx> (1):
+cat >expect << EOF
+$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1):
       initial
 
 CTO <cto@xxxxxxxxxx> (1):
@@ -370,7 +370,7 @@ test_expect_success 'Shortlog output (complex mapping)' '
 	git commit --author "CTO <cto@xxxxxxxxxxx>" -m seventh &&
 
 	mkdir -p internal_mailmap &&
-	echo "Committed <committer@xxxxxxxxxxx>" > internal_mailmap/.mailmap &&
+	echo "Committed <$GIT_COMMITTER_EMAIL>" > internal_mailmap/.mailmap &&
 	echo "<cto@xxxxxxxxxx>                       <cto@xxxxxxxxxxx>" >> internal_mailmap/.mailmap &&
 	echo "Some Dude <some@xxxxxxx>         nick1 <bugs@xxxxxxxxxx>" >> internal_mailmap/.mailmap &&
 	echo "Other Author <other@xxxxxxxxx>   nick2 <bugs@xxxxxxxxxx>" >> internal_mailmap/.mailmap &&
@@ -384,27 +384,27 @@ test_expect_success 'Shortlog output (complex mapping)' '
 '
 
 # git log with --pretty format which uses the name and email mailmap placemarkers
-cat >expect <<\EOF
+cat >expect << EOF
 Author CTO <cto@xxxxxxxxxxx> maps to CTO <cto@xxxxxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 
 Author claus <me@xxxxxxxxxx> maps to Santa Claus <santa.claus@xxxxxxxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 
 Author santa <me@xxxxxxxxxx> maps to Santa Claus <santa.claus@xxxxxxxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 
 Author nick2 <nick2@xxxxxxxxxx> maps to Other Author <other@xxxxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 
 Author nick2 <bugs@xxxxxxxxxx> maps to Other Author <other@xxxxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 
 Author nick1 <bugs@xxxxxxxxxx> maps to Some Dude <some@xxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 
-Author A U Thor <author@xxxxxxxxxxx> maps to A U Thor <author@xxxxxxxxxxx>
-Committer C O Mitter <committer@xxxxxxxxxxx> maps to Committed <committer@xxxxxxxxxxx>
+Author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> maps to $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
+Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>
 EOF
 
 test_expect_success 'Log output (complex mapping)' '
@@ -412,14 +412,14 @@ test_expect_success 'Log output (complex mapping)' '
 	test_cmp expect actual
 '
 
-cat >expect <<\EOF
+cat >expect << EOF
 Author: CTO <cto@xxxxxxxxxx>
 Author: Santa Claus <santa.claus@xxxxxxxxxxxx>
 Author: Santa Claus <santa.claus@xxxxxxxxxxxx>
 Author: Other Author <other@xxxxxxxxx>
 Author: Other Author <other@xxxxxxxxx>
 Author: Some Dude <some@xxxxxxx>
-Author: A U Thor <author@xxxxxxxxxxx>
+Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 EOF
 
 test_expect_success 'Log output with --use-mailmap' '
@@ -427,14 +427,14 @@ test_expect_success 'Log output with --use-mailmap' '
 	test_cmp expect actual
 '
 
-cat >expect <<\EOF
+cat >expect << EOF
 Author: CTO <cto@xxxxxxxxxx>
 Author: Santa Claus <santa.claus@xxxxxxxxxxxx>
 Author: Santa Claus <santa.claus@xxxxxxxxxxxx>
 Author: Other Author <other@xxxxxxxxx>
 Author: Other Author <other@xxxxxxxxx>
 Author: Some Dude <some@xxxxxxx>
-Author: A U Thor <author@xxxxxxxxxxx>
+Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 EOF
 
 test_expect_success 'Log output with log.mailmap' '
@@ -443,28 +443,28 @@ test_expect_success 'Log output with log.mailmap' '
 '
 
 test_expect_success 'log.mailmap=false disables mailmap' '
-	cat >expect <<-\EOF &&
+	cat >expect <<- EOF &&
 	Author: CTO <cto@xxxxxxxxxxx>
 	Author: claus <me@xxxxxxxxxx>
 	Author: santa <me@xxxxxxxxxx>
 	Author: nick2 <nick2@xxxxxxxxxx>
 	Author: nick2 <bugs@xxxxxxxxxx>
 	Author: nick1 <bugs@xxxxxxxxxx>
-	Author: A U Thor <author@xxxxxxxxxxx>
+	Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 	EOF
 	git -c log.mailmap=False log | grep Author > actual &&
 	test_cmp expect actual
 '
 
 test_expect_success '--no-use-mailmap disables mailmap' '
-	cat >expect <<-\EOF &&
+	cat >expect <<- EOF &&
 	Author: CTO <cto@xxxxxxxxxxx>
 	Author: claus <me@xxxxxxxxxx>
 	Author: santa <me@xxxxxxxxxx>
 	Author: nick2 <nick2@xxxxxxxxxx>
 	Author: nick2 <bugs@xxxxxxxxxx>
 	Author: nick1 <bugs@xxxxxxxxxx>
-	Author: A U Thor <author@xxxxxxxxxxx>
+	Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 	EOF
 	git log --no-use-mailmap | grep Author > actual &&
 	test_cmp expect actual
@@ -500,8 +500,8 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '
 '
 
 # git blame
-cat >expect <<\EOF
-^OBJI (A U Thor     DATE 1) one
+cat >expect <<EOF
+^OBJI ($GIT_AUTHOR_NAME     DATE 1) one
 OBJID (Some Dude    DATE 2) two
 OBJID (Other Author DATE 3) three
 OBJID (Other Author DATE 4) four
-- 
2.21.0





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux