[RFC/PATCH 4/4] t4203: consolidate test-repository setup

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

 



The simple two-commit test-repository created by 'setup' is no longer
needed by any of the tests retrofitted to use check-mailmap. Subsequent,
more complex tests of git-shortlog, git-log, and git-blame functionality
expand the repository by adding five commits. Consolidate the creation
of this seven-commit repository into a single repository-setup function.

Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
---

The code near the top of the file which creates two commits, and the
code later which creates five commits have been consolidated into a
single repository-setup function. The patch is primarily code movement,
but the noisy diff makes it look more busy than it actually is.


 t/t4203-mailmap.sh | 69 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 38 insertions(+), 31 deletions(-)

diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 48a000b..7e8b3cc 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -13,19 +13,10 @@ fuzz_blame () {
 }
 
 test_expect_success setup '
-	cat >contacts <<-\EOF &&
+	cat >contacts <<-\EOF
 	A U Thor <author@xxxxxxxxxxx>
 	nick1 <bugs@xxxxxxxxxx>
 	EOF
-
-	echo one >one &&
-	git add one &&
-	test_tick &&
-	git commit -m initial &&
-	echo two >>one &&
-	git add one &&
-	test_tick &&
-	git commit --author "nick1 <bugs@xxxxxxxxxx>" -m second
 '
 
 test_expect_success 'check-mailmap no arguments' '
@@ -168,8 +159,10 @@ test_expect_success 'No mailmap files, but configured' '
 '
 
 test_expect_success 'setup mailmap blob tests' '
+	git checkout --orphan empty &&
+	git commit --allow-empty --allow-empty-message &&
 	git checkout -b map &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout empty" &&
 	cat >just-bugs <<-\EOF &&
 	Blob Guy <bugs@xxxxxxxxxx>
 	EOF
@@ -254,28 +247,19 @@ test_expect_success 'cleanup after mailmap.blob tests' '
 	rm -f .mailmap
 '
 
-# Extended mailmap configurations should give us the following output for shortlog
-cat >expect <<\EOF
-A U Thor <author@xxxxxxxxxxx> (1):
-      initial
-
-CTO <cto@xxxxxxxxxx> (1):
-      seventh
+test_expect_success 'setup mailmap test repo' '
+	git checkout --orphan master &&
 
-Other Author <other@xxxxxxxxx> (2):
-      third
-      fourth
-
-Santa Claus <santa.claus@xxxxxxxxxxxx> (2):
-      fifth
-      sixth
-
-Some Dude <some@xxxxxxx> (1):
-      second
+	echo one >one &&
+	git add one &&
+	test_tick &&
+	git commit -m initial &&
 
-EOF
+	echo two >>one &&
+	git add one &&
+	test_tick &&
+	git commit --author "nick1 <bugs@xxxxxxxxxx>" -m second &&
 
-test_expect_success 'Shortlog output (complex mapping)' '
 	echo three >>one &&
 	git add one &&
 	test_tick &&
@@ -299,8 +283,31 @@ test_expect_success 'Shortlog output (complex mapping)' '
 	echo seven >>one &&
 	git add one &&
 	test_tick &&
-	git commit --author "CTO <cto@xxxxxxxxxxx>" -m seventh &&
+	git commit --author "CTO <cto@xxxxxxxxxxx>" -m seventh
+'
+
+# Extended mailmap configurations should give us the following output for shortlog
+cat >expect <<\EOF
+A U Thor <author@xxxxxxxxxxx> (1):
+      initial
+
+CTO <cto@xxxxxxxxxx> (1):
+      seventh
 
+Other Author <other@xxxxxxxxx> (2):
+      third
+      fourth
+
+Santa Claus <santa.claus@xxxxxxxxxxxx> (2):
+      fifth
+      sixth
+
+Some Dude <some@xxxxxxx> (1):
+      second
+
+EOF
+
+test_expect_success 'Shortlog output (complex mapping)' '
 	mkdir -p internal_mailmap &&
 	echo "Committed <committer@xxxxxxxxxxx>" > internal_mailmap/.mailmap &&
 	echo "<cto@xxxxxxxxxx>                       <cto@xxxxxxxxxxx>" >> internal_mailmap/.mailmap &&
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]