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 <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Mar 18, 2025 at 12:00 UTC
9e05fbe61ba029a3ff9a984709875d76341a217c
1 file changed
+8
-8
t/t5710-promisor-remote-capability.sh
+8
-8
@@ -93,6 +93,7 @@ test_expect_success "setup for testing promisor remote advertisement" '
93
94
test_expect_success "clone with promisor.advertise set to 'true'" '
95
git -C server config promisor.advertise true &&
96
+ test_when_finished "rm -rf client" &&
97
98
# Clone from server to create a client
99
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
@@ -100,7 +101,6 @@ test_expect_success "clone with promisor.advertise set to 'true'" '
101
-c remote.lop.url="file://$(pwd)/lop" \
102
-c promisor.acceptfromserver=All \
103
--no-local --filter="blob:limit=5k" server client &&
103
- test_when_finished "rm -rf client" &&
104
105
# Check that the largest object is still missing on the server
106
check_missing_objects server 1 "$oid"
@@ -108,6 +108,7 @@ test_expect_success "clone with promisor.advertise set to 'true'" '
108
109
test_expect_success "clone with promisor.advertise set to 'false'" '
110
git -C server config promisor.advertise false &&
111
+ test_when_finished "rm -rf client" &&
112
113
# Clone from server to create a client
114
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
@@ -115,7 +116,6 @@ test_expect_success "clone with promisor.advertise set to 'false'" '
116
-c remote.lop.url="file://$(pwd)/lop" \
117
-c promisor.acceptfromserver=All \
118
--no-local --filter="blob:limit=5k" server client &&
118
- test_when_finished "rm -rf client" &&
119
120
# Check that the largest object is not missing on the server
121
check_missing_objects server 0 "" &&
@@ -126,6 +126,7 @@ test_expect_success "clone with promisor.advertise set to 'false'" '
126
127
test_expect_success "clone with promisor.acceptfromserver set to 'None'" '
128
git -C server config promisor.advertise true &&
129
+ test_when_finished "rm -rf client" &&
130
131
# Clone from server to create a client
132
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
@@ -133,7 +134,6 @@ test_expect_success "clone with promisor.acceptfromserver set to 'None'" '
134
-c remote.lop.url="file://$(pwd)/lop" \
135
-c promisor.acceptfromserver=None \
136
--no-local --filter="blob:limit=5k" server client &&
136
- test_when_finished "rm -rf client" &&
137
138
# Check that the largest object is not missing on the server
139
check_missing_objects server 0 "" &&
@@ -144,8 +144,8 @@ test_expect_success "clone with promisor.acceptfromserver set to 'None'" '
144
145
test_expect_success "init + fetch with promisor.advertise set to 'true'" '
146
git -C server config promisor.advertise true &&
147
-
147
test_when_finished "rm -rf client" &&
148
+
149
mkdir client &&
150
git -C client init &&
151
git -C client config remote.lop.promisor true &&
@@ -162,6 +162,7 @@ test_expect_success "init + fetch with promisor.advertise set to 'true'" '
162
163
test_expect_success "clone with promisor.acceptfromserver set to 'KnownName'" '
164
git -C server config promisor.advertise true &&
165
+ test_when_finished "rm -rf client" &&
166
167
# Clone from server to create a client
168
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
@@ -169,7 +170,6 @@ test_expect_success "clone with promisor.acceptfromserver set to 'KnownName'" '
170
-c remote.lop.url="file://$(pwd)/lop" \
171
-c promisor.acceptfromserver=KnownName \
172
--no-local --filter="blob:limit=5k" server client &&
172
- test_when_finished "rm -rf client" &&
173
174
# Check that the largest object is still missing on the server
175
check_missing_objects server 1 "$oid"
@@ -177,6 +177,7 @@ test_expect_success "clone with promisor.acceptfromserver set to 'KnownName'" '
177
178
test_expect_success "clone with 'KnownName' and different remote names" '
179
git -C server config promisor.advertise true &&
180
+ test_when_finished "rm -rf client" &&
181
182
# Clone from server to create a client
183
GIT_NO_LAZY_FETCH=0 git clone -c remote.serverTwo.promisor=true \
@@ -184,7 +185,6 @@ test_expect_success "clone with 'KnownName' and different remote names" '
185
-c remote.serverTwo.url="file://$(pwd)/lop" \
186
-c promisor.acceptfromserver=KnownName \
187
--no-local --filter="blob:limit=5k" server client &&
187
- test_when_finished "rm -rf client" &&
188
189
# Check that the largest object is not missing on the server
190
check_missing_objects server 0 "" &&
@@ -195,6 +195,7 @@ test_expect_success "clone with 'KnownName' and different remote names" '
195
196
test_expect_success "clone with promisor.acceptfromserver set to 'KnownUrl'" '
197
git -C server config promisor.advertise true &&
198
+ test_when_finished "rm -rf client" &&
199
200
# Clone from server to create a client
201
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
@@ -202,7 +203,6 @@ test_expect_success "clone with promisor.acceptfromserver set to 'KnownUrl'" '
203
-c remote.lop.url="file://$(pwd)/lop" \
204
-c promisor.acceptfromserver=KnownUrl \
205
--no-local --filter="blob:limit=5k" server client &&
205
- test_when_finished "rm -rf client" &&
206
207
# Check that the largest object is still missing on the server
208
check_missing_objects server 1 "$oid"
@@ -212,6 +212,7 @@ test_expect_success "clone with 'KnownUrl' and different remote urls" '
212
ln -s lop serverTwo &&
213
214
git -C server config promisor.advertise true &&
215
+ test_when_finished "rm -rf client" &&
216
217
# Clone from server to create a client
218
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
@@ -219,7 +220,6 @@ test_expect_success "clone with 'KnownUrl' and different remote urls" '
220
-c remote.lop.url="file://$(pwd)/serverTwo" \
221
-c promisor.acceptfromserver=KnownUrl \
222
--no-local --filter="blob:limit=5k" server client &&
222
- test_when_finished "rm -rf client" &&
223
224
# Check that the largest object is not missing on the server
225
check_missing_objects server 0 "" &&