t1404: remove "prefix" argument to test_update_rejected
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>
Michael Haggerty committed
Jun 10, 2016 at 08:50 UTC
0e4b63b5a8b8d369720f0671040113e347221042
1 file changed
+13
-14
t/t1404-update-ref-errors.sh
+13
-14
@@ -4,11 +4,10 @@ test_description='Test git update-ref error handling'
4
. ./test-lib.sh
5
6
test_update_rejected () {
7
- prefix="$1" &&
8
- before="$2" &&
9
- pack="$3" &&
10
- create="$4" &&
11
- error="$5" &&
7
+ before="$1" &&
8
+ pack="$2" &&
9
+ create="$3" &&
10
+ error="$4" &&
11
printf "create $prefix/%s $C\n" $before |
12
git update-ref --stdin &&
13
git for-each-ref $prefix >unchanged &&
@@ -37,7 +36,7 @@ test_expect_success 'setup' '
36
test_expect_success 'existing loose ref is a simple prefix of new' '
37
38
prefix=refs/1l &&
40
- test_update_rejected $prefix "a c e" false "b c/x d" \
39
+ test_update_rejected "a c e" false "b c/x d" \
40
"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q"
41
42
'
@@ -45,7 +44,7 @@ test_expect_success 'existing loose ref is a simple prefix of new' '
44
test_expect_success 'existing packed ref is a simple prefix of new' '
45
46
prefix=refs/1p &&
48
- test_update_rejected $prefix "a c e" true "b c/x d" \
47
+ test_update_rejected "a c e" true "b c/x d" \
48
"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q"
49
50
'
@@ -53,7 +52,7 @@ test_expect_success 'existing packed ref is a simple prefix of new' '
52
test_expect_success 'existing loose ref is a deeper prefix of new' '
53
54
prefix=refs/2l &&
56
- test_update_rejected $prefix "a c e" false "b c/x/y d" \
55
+ test_update_rejected "a c e" false "b c/x/y d" \
56
"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q"
57
58
'
@@ -61,7 +60,7 @@ test_expect_success 'existing loose ref is a deeper prefix of new' '
60
test_expect_success 'existing packed ref is a deeper prefix of new' '
61
62
prefix=refs/2p &&
64
- test_update_rejected $prefix "a c e" true "b c/x/y d" \
63
+ test_update_rejected "a c e" true "b c/x/y d" \
64
"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q"
65
66
'
@@ -69,7 +68,7 @@ test_expect_success 'existing packed ref is a deeper prefix of new' '
68
test_expect_success 'new ref is a simple prefix of existing loose' '
69
70
prefix=refs/3l &&
72
- test_update_rejected $prefix "a c/x e" false "b c d" \
71
+ test_update_rejected "a c/x e" false "b c d" \
72
"$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q"
73
74
'
@@ -77,7 +76,7 @@ test_expect_success 'new ref is a simple prefix of existing loose' '
76
test_expect_success 'new ref is a simple prefix of existing packed' '
77
78
prefix=refs/3p &&
80
- test_update_rejected $prefix "a c/x e" true "b c d" \
79
+ test_update_rejected "a c/x e" true "b c d" \
80
"$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q"
81
82
'
@@ -85,7 +84,7 @@ test_expect_success 'new ref is a simple prefix of existing packed' '
84
test_expect_success 'new ref is a deeper prefix of existing loose' '
85
86
prefix=refs/4l &&
88
- test_update_rejected $prefix "a c/x/y e" false "b c d" \
87
+ test_update_rejected "a c/x/y e" false "b c d" \
88
"$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q"
89
90
'
@@ -93,7 +92,7 @@ test_expect_success 'new ref is a deeper prefix of existing loose' '
92
test_expect_success 'new ref is a deeper prefix of existing packed' '
93
94
prefix=refs/4p &&
96
- test_update_rejected $prefix "a c/x/y e" true "b c d" \
95
+ test_update_rejected "a c/x/y e" true "b c d" \
96
"$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q"
97
98
'
@@ -101,7 +100,7 @@ test_expect_success 'new ref is a deeper prefix of existing packed' '
100
test_expect_success 'one new ref is a simple prefix of another' '
101
102
prefix=refs/5 &&
104
- test_update_rejected $prefix "a e" false "b c c/x d" \
103
+ test_update_rejected "a e" false "b c c/x d" \
104
"cannot process $Q$prefix/c$Q and $Q$prefix/c/x$Q at the same time"
105
106
'