Skip to content

Commit 9e05fbe

Browse files
chriscoolgitster
authored andcommitted
t5710: arrange to delete the client before cloning
If `test_when_finished "rm -rf client"` is run after we clone, it will not run if the clone failed, so the "client" directory might not be removed at the end of the test. `git clone` does try to remove the directory when it fails, but let's be safe and try to protect against possibly weird clone failures by moving `test_when_finished "rm -rf client"` before the clone. It just makes more sense this way around. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5040f9f commit 9e05fbe

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/t5710-promisor-remote-capability.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,29 @@ test_expect_success "setup for testing promisor remote advertisement" '
9393

9494
test_expect_success "clone with promisor.advertise set to 'true'" '
9595
git -C server config promisor.advertise true &&
96+
test_when_finished "rm -rf client" &&
9697
9798
# Clone from server to create a client
9899
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
99100
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
100101
-c remote.lop.url="file://$(pwd)/lop" \
101102
-c promisor.acceptfromserver=All \
102103
--no-local --filter="blob:limit=5k" server client &&
103-
test_when_finished "rm -rf client" &&
104104
105105
# Check that the largest object is still missing on the server
106106
check_missing_objects server 1 "$oid"
107107
'
108108

109109
test_expect_success "clone with promisor.advertise set to 'false'" '
110110
git -C server config promisor.advertise false &&
111+
test_when_finished "rm -rf client" &&
111112
112113
# Clone from server to create a client
113114
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
114115
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
115116
-c remote.lop.url="file://$(pwd)/lop" \
116117
-c promisor.acceptfromserver=All \
117118
--no-local --filter="blob:limit=5k" server client &&
118-
test_when_finished "rm -rf client" &&
119119
120120
# Check that the largest object is not missing on the server
121121
check_missing_objects server 0 "" &&
@@ -126,14 +126,14 @@ test_expect_success "clone with promisor.advertise set to 'false'" '
126126

127127
test_expect_success "clone with promisor.acceptfromserver set to 'None'" '
128128
git -C server config promisor.advertise true &&
129+
test_when_finished "rm -rf client" &&
129130
130131
# Clone from server to create a client
131132
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
132133
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
133134
-c remote.lop.url="file://$(pwd)/lop" \
134135
-c promisor.acceptfromserver=None \
135136
--no-local --filter="blob:limit=5k" server client &&
136-
test_when_finished "rm -rf client" &&
137137
138138
# Check that the largest object is not missing on the server
139139
check_missing_objects server 0 "" &&
@@ -144,8 +144,8 @@ test_expect_success "clone with promisor.acceptfromserver set to 'None'" '
144144

145145
test_expect_success "init + fetch with promisor.advertise set to 'true'" '
146146
git -C server config promisor.advertise true &&
147-
148147
test_when_finished "rm -rf client" &&
148+
149149
mkdir client &&
150150
git -C client init &&
151151
git -C client config remote.lop.promisor true &&
@@ -162,29 +162,29 @@ test_expect_success "init + fetch with promisor.advertise set to 'true'" '
162162

163163
test_expect_success "clone with promisor.acceptfromserver set to 'KnownName'" '
164164
git -C server config promisor.advertise true &&
165+
test_when_finished "rm -rf client" &&
165166
166167
# Clone from server to create a client
167168
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
168169
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
169170
-c remote.lop.url="file://$(pwd)/lop" \
170171
-c promisor.acceptfromserver=KnownName \
171172
--no-local --filter="blob:limit=5k" server client &&
172-
test_when_finished "rm -rf client" &&
173173
174174
# Check that the largest object is still missing on the server
175175
check_missing_objects server 1 "$oid"
176176
'
177177

178178
test_expect_success "clone with 'KnownName' and different remote names" '
179179
git -C server config promisor.advertise true &&
180+
test_when_finished "rm -rf client" &&
180181
181182
# Clone from server to create a client
182183
GIT_NO_LAZY_FETCH=0 git clone -c remote.serverTwo.promisor=true \
183184
-c remote.serverTwo.fetch="+refs/heads/*:refs/remotes/lop/*" \
184185
-c remote.serverTwo.url="file://$(pwd)/lop" \
185186
-c promisor.acceptfromserver=KnownName \
186187
--no-local --filter="blob:limit=5k" server client &&
187-
test_when_finished "rm -rf client" &&
188188
189189
# Check that the largest object is not missing on the server
190190
check_missing_objects server 0 "" &&
@@ -195,14 +195,14 @@ test_expect_success "clone with 'KnownName' and different remote names" '
195195

196196
test_expect_success "clone with promisor.acceptfromserver set to 'KnownUrl'" '
197197
git -C server config promisor.advertise true &&
198+
test_when_finished "rm -rf client" &&
198199
199200
# Clone from server to create a client
200201
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
201202
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
202203
-c remote.lop.url="file://$(pwd)/lop" \
203204
-c promisor.acceptfromserver=KnownUrl \
204205
--no-local --filter="blob:limit=5k" server client &&
205-
test_when_finished "rm -rf client" &&
206206
207207
# Check that the largest object is still missing on the server
208208
check_missing_objects server 1 "$oid"
@@ -212,14 +212,14 @@ test_expect_success "clone with 'KnownUrl' and different remote urls" '
212212
ln -s lop serverTwo &&
213213
214214
git -C server config promisor.advertise true &&
215+
test_when_finished "rm -rf client" &&
215216
216217
# Clone from server to create a client
217218
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
218219
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
219220
-c remote.lop.url="file://$(pwd)/serverTwo" \
220221
-c promisor.acceptfromserver=KnownUrl \
221222
--no-local --filter="blob:limit=5k" server client &&
222-
test_when_finished "rm -rf client" &&
223223
224224
# Check that the largest object is not missing on the server
225225
check_missing_objects server 0 "" &&

0 commit comments

Comments
 (0)