193
initialize_server 1 "$oid"
194
'
195
196
+test_expect_success "clone with 'KnownName' and missing URL in the config" '
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
+ # Lazy fetching by the client from the LOP will fail because of the
202
+ # missing URL in the client config, so the server will have to lazy
203
+ # fetch from the LOP.
204
+ GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
205
+ -c promisor.acceptfromserver=KnownName \
206
+ --no-local --filter="blob:limit=5k" server client &&
207
+
208
+ # Check that the largest object is not missing on the server
209
+ check_missing_objects server 0 "" &&
210
+
211
+ # Reinitialize server so that the largest object is missing again
212
+ initialize_server 1 "$oid"
213
+'
214
+
215
test_expect_success "clone with promisor.acceptfromserver set to 'KnownUrl'" '
216
git -C server config promisor.advertise true &&
217
test_when_finished "rm -rf client" &&
247
initialize_server 1 "$oid"
248
'
249
250
+test_expect_success "clone with 'KnownUrl' and url not configured on the server" '
251
+ git -C server config promisor.advertise true &&
252
+ test_when_finished "rm -rf client" &&
253
+
254
+ test_when_finished "git -C server config set remote.lop.url \"file://$(pwd)/lop\"" &&
255
+ git -C server config unset remote.lop.url &&
256
+
257
+ # Clone from server to create a client
258
+ # It should fail because the client will reject the LOP as URLs are
259
+ # different, and the server cannot lazy fetch as the LOP URL is
260
+ # missing, so the remote name will be used instead which will fail.
261
+ test_must_fail env GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
262
+ -c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
263
+ -c remote.lop.url="file://$(pwd)/lop" \
264
+ -c promisor.acceptfromserver=KnownUrl \
265
+ --no-local --filter="blob:limit=5k" server client &&
266
+
267
+ # Check that the largest object is still missing on the server
268
+ check_missing_objects server 1 "$oid"
269
+'
270
+
271
+test_expect_success "clone with 'KnownUrl' and empty url, so not advertised" '
272
+ git -C server config promisor.advertise true &&
273
+ test_when_finished "rm -rf client" &&
274
+
275
+ test_when_finished "git -C server config set remote.lop.url \"file://$(pwd)/lop\"" &&
276
+ git -C server config set remote.lop.url "" &&
277
+
278
+ # Clone from server to create a client
279
+ # It should fail because the client will reject the LOP as an empty URL is
280
+ # not advertised, and the server cannot lazy fetch as the LOP URL is empty,
281
+ # so the remote name will be used instead which will fail.
282
+ test_must_fail env GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
283
+ -c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
284
+ -c remote.lop.url="file://$(pwd)/lop" \
285
+ -c promisor.acceptfromserver=KnownUrl \
286
+ --no-local --filter="blob:limit=5k" server client &&
287
+
288
+ # Check that the largest object is still missing on the server
289
+ check_missing_objects server 1 "$oid"
290
+'
291
+
292
test_expect_success "clone with promisor.advertise set to 'true' but don't delete the client" '
293
git -C server config promisor.advertise true &&
294