285
'
286
287
test_expect_success 'clone bundle list (HTTP, no heuristic)' '
288
+ test_when_finished rm -f trace*.txt &&
289
+
290
cp clone-from/bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/" &&
291
cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
292
[bundle]
306
uri = $HTTPD_URL/bundle-4.bundle
307
EOF
308
307
- git clone --bundle-uri="$HTTPD_URL/bundle-list" \
309
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" \
310
+ git clone --bundle-uri="$HTTPD_URL/bundle-list" \
311
clone-from clone-list-http 2>err &&
312
! grep "Repository lacks these prerequisite commits" err &&
313
314
git -C clone-from for-each-ref --format="%(objectname)" >oids &&
312
- git -C clone-list-http cat-file --batch-check <oids
315
+ git -C clone-list-http cat-file --batch-check <oids &&
316
+
317
+ cat >expect <<-EOF &&
318
+ $HTTPD_URL/bundle-1.bundle
319
+ $HTTPD_URL/bundle-2.bundle
320
+ $HTTPD_URL/bundle-3.bundle
321
+ $HTTPD_URL/bundle-4.bundle
322
+ $HTTPD_URL/bundle-list
323
+ EOF
324
+
325
+ # Sort the list, since the order is not well-defined
326
+ # without a heuristic.
327
+ test_remote_https_urls <trace-clone.txt | sort >actual &&
328
+ test_cmp expect actual
329
'
330
331
test_expect_success 'clone bundle list (HTTP, any mode)' '
366
test_cmp expect actual
367
'
368
369
+test_expect_success 'clone bundle list (http, creationToken)' '
370
+ test_when_finished rm -f trace*.txt &&
371
+
372
+ cp clone-from/bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/" &&
373
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
374
+ [bundle]
375
+ version = 1
376
+ mode = all
377
+ heuristic = creationToken
378
+
379
+ [bundle "bundle-1"]
380
+ uri = bundle-1.bundle
381
+ creationToken = 1
382
+
383
+ [bundle "bundle-2"]
384
+ uri = bundle-2.bundle
385
+ creationToken = 2
386
+
387
+ [bundle "bundle-3"]
388
+ uri = bundle-3.bundle
389
+ creationToken = 3
390
+
391
+ [bundle "bundle-4"]
392
+ uri = bundle-4.bundle
393
+ creationToken = 4
394
+ EOF
395
+
396
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" git \
397
+ clone --bundle-uri="$HTTPD_URL/bundle-list" \
398
+ "$HTTPD_URL/smart/fetch.git" clone-list-http-2 &&
399
+
400
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
401
+ git -C clone-list-http-2 cat-file --batch-check <oids &&
402
+
403
+ cat >expect <<-EOF &&
404
+ $HTTPD_URL/bundle-1.bundle
405
+ $HTTPD_URL/bundle-2.bundle
406
+ $HTTPD_URL/bundle-3.bundle
407
+ $HTTPD_URL/bundle-4.bundle
408
+ $HTTPD_URL/bundle-list
409
+ EOF
410
+
411
+ # Since the creationToken heuristic is not yet understood by the
412
+ # client, the order cannot be verified at this moment. Sort the
413
+ # list for consistent results.
414
+ test_remote_https_urls <trace-clone.txt | sort >actual &&
415
+ test_cmp expect actual
416
+'
417
+
418
# Do not add tests here unless they use the HTTP server, as they will
419
# not run unless the HTTP dependencies exist.
420