[PATCH v2 2/6] t1404: remove "prefix" argument to test_update_rejected

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

 



The tests already set a variable called prefix and passed its value as
the first argument to this function. The old argument handling was
overwriting the global variable with its same value rather than creating
a local variable.

So change test_update_rejected to refer to the global variable rather
than taking the prefix as an argument.

Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>
---
 t/t1404-update-ref-errors.sh | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
index 2818460..541cad1 100755
--- a/t/t1404-update-ref-errors.sh
+++ b/t/t1404-update-ref-errors.sh
@@ -4,11 +4,10 @@ test_description='Test git update-ref error handling'
 . ./test-lib.sh
 
 test_update_rejected () {
-	prefix="$1" &&
-	before="$2" &&
-	pack="$3" &&
-	create="$4" &&
-	error="$5" &&
+	before="$1" &&
+	pack="$2" &&
+	create="$3" &&
+	error="$4" &&
 	printf "create $prefix/%s $C\n" $before |
 	git update-ref --stdin &&
 	git for-each-ref $prefix >unchanged &&
@@ -37,7 +36,7 @@ test_expect_success 'setup' '
 test_expect_success 'existing loose ref is a simple prefix of new' '
 
 	prefix=refs/1l &&
-	test_update_rejected $prefix "a c e" false "b c/x d" \
+	test_update_rejected "a c e" false "b c/x d" \
 		"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q"
 
 '
@@ -45,7 +44,7 @@ test_expect_success 'existing loose ref is a simple prefix of new' '
 test_expect_success 'existing packed ref is a simple prefix of new' '
 
 	prefix=refs/1p &&
-	test_update_rejected $prefix "a c e" true "b c/x d" \
+	test_update_rejected "a c e" true "b c/x d" \
 		"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q"
 
 '
@@ -53,7 +52,7 @@ test_expect_success 'existing packed ref is a simple prefix of new' '
 test_expect_success 'existing loose ref is a deeper prefix of new' '
 
 	prefix=refs/2l &&
-	test_update_rejected $prefix "a c e" false "b c/x/y d" \
+	test_update_rejected "a c e" false "b c/x/y d" \
 		"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q"
 
 '
@@ -61,7 +60,7 @@ test_expect_success 'existing loose ref is a deeper prefix of new' '
 test_expect_success 'existing packed ref is a deeper prefix of new' '
 
 	prefix=refs/2p &&
-	test_update_rejected $prefix "a c e" true "b c/x/y d" \
+	test_update_rejected "a c e" true "b c/x/y d" \
 		"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q"
 
 '
@@ -69,7 +68,7 @@ test_expect_success 'existing packed ref is a deeper prefix of new' '
 test_expect_success 'new ref is a simple prefix of existing loose' '
 
 	prefix=refs/3l &&
-	test_update_rejected $prefix "a c/x e" false "b c d" \
+	test_update_rejected "a c/x e" false "b c d" \
 		"$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q"
 
 '
@@ -77,7 +76,7 @@ test_expect_success 'new ref is a simple prefix of existing loose' '
 test_expect_success 'new ref is a simple prefix of existing packed' '
 
 	prefix=refs/3p &&
-	test_update_rejected $prefix "a c/x e" true "b c d" \
+	test_update_rejected "a c/x e" true "b c d" \
 		"$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q"
 
 '
@@ -85,7 +84,7 @@ test_expect_success 'new ref is a simple prefix of existing packed' '
 test_expect_success 'new ref is a deeper prefix of existing loose' '
 
 	prefix=refs/4l &&
-	test_update_rejected $prefix "a c/x/y e" false "b c d" \
+	test_update_rejected "a c/x/y e" false "b c d" \
 		"$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q"
 
 '
@@ -93,7 +92,7 @@ test_expect_success 'new ref is a deeper prefix of existing loose' '
 test_expect_success 'new ref is a deeper prefix of existing packed' '
 
 	prefix=refs/4p &&
-	test_update_rejected $prefix "a c/x/y e" true "b c d" \
+	test_update_rejected "a c/x/y e" true "b c d" \
 		"$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q"
 
 '
@@ -101,7 +100,7 @@ test_expect_success 'new ref is a deeper prefix of existing packed' '
 test_expect_success 'one new ref is a simple prefix of another' '
 
 	prefix=refs/5 &&
-	test_update_rejected $prefix "a e" false "b c c/x d" \
+	test_update_rejected "a e" false "b c c/x d" \
 		"cannot process $Q$prefix/c$Q and $Q$prefix/c/x$Q at the same time"
 
 '
-- 
2.8.1

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