t1404: remove "prefix" argument to test_update_rejected
authorMichael Haggerty <mhagger@alum.mit.edu>
Fri, 10 Jun 2016 06:50:53 +0000 (08:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Jun 2016 18:49:00 +0000 (11:49 -0700)
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@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1404-update-ref-errors.sh
index 2818460ba9284f132f5bca1e1843d0698b05ca33..541cad12a412e7daba1b3eae4366fc5fda7bb1bd 100755 (executable)
@@ -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"
 
 '