@@ -429,14 +429,18 @@ intersperse () {
429
429
sed ' s/\(..\)/' $1 ' \1/g'
430
430
}
431
431
432
- # Create a one-time-sed command to replace the existing packfile with $1.
432
+ # Create a one-time-perl command to replace the existing packfile with $1.
433
433
replace_packfile () {
434
434
# The protocol requires that the packfile be sent in sideband 1, hence
435
435
# the extra \x01 byte at the beginning.
436
- printf " 1,/packfile/!c %04x\\\\ x01%s0000" \
437
- " $(( $(wc - c < $1 ) + 5 )) " \
438
- " $( hex_unpack < $1 | intersperse ' \\x' ) " \
439
- > " $HTTPD_ROOT_PATH /one-time-sed"
436
+ cp $1 " $HTTPD_ROOT_PATH /one-time-pack" &&
437
+ echo ' if (/packfile/) {
438
+ print;
439
+ my $length = -s "one-time-pack";
440
+ printf "%04x\x01", $length + 5;
441
+ print `cat one-time-pack` . "0000";
442
+ last
443
+ }' > " $HTTPD_ROOT_PATH /one-time-perl"
440
444
}
441
445
442
446
test_expect_success ' upon cloning, check that all refs point to objects' '
@@ -460,16 +464,16 @@ test_expect_success 'upon cloning, check that all refs point to objects' '
460
464
# \x01 byte at the beginning.
461
465
replace_packfile incomplete.pack &&
462
466
463
- # Use protocol v2 because the sed command looks for the "packfile"
467
+ # Use protocol v2 because the perl command looks for the "packfile"
464
468
# section header.
465
469
test_config -C "$SERVER" protocol.version 2 &&
466
470
test_must_fail git -c protocol.version=2 clone \
467
- --filter=blob:none $HTTPD_URL/one_time_sed /server repo 2>err &&
471
+ --filter=blob:none $HTTPD_URL/one_time_perl /server repo 2>err &&
468
472
469
473
test_i18ngrep "did not send all necessary objects" err &&
470
474
471
- # Ensure that the one-time-sed script was used.
472
- ! test -e "$HTTPD_ROOT_PATH/one-time-sed "
475
+ # Ensure that the one-time-perl script was used.
476
+ ! test -e "$HTTPD_ROOT_PATH/one-time-perl "
473
477
'
474
478
475
479
test_expect_success ' when partial cloning, tolerate server not sending target of tag' '
@@ -500,17 +504,17 @@ test_expect_success 'when partial cloning, tolerate server not sending target of
500
504
# \x01 byte at the beginning.
501
505
replace_packfile incomplete.pack &&
502
506
503
- # Use protocol v2 because the sed command looks for the "packfile"
507
+ # Use protocol v2 because the perl command looks for the "packfile"
504
508
# section header.
505
509
test_config -C "$SERVER" protocol.version 2 &&
506
510
507
511
# Exercise to make sure it works.
508
512
git -c protocol.version=2 clone \
509
- --filter=blob:none $HTTPD_URL/one_time_sed /server repo 2> err &&
513
+ --filter=blob:none $HTTPD_URL/one_time_perl /server repo 2> err &&
510
514
! grep "missing object referenced by" err &&
511
515
512
- # Ensure that the one-time-sed script was used.
513
- ! test -e "$HTTPD_ROOT_PATH/one-time-sed "
516
+ # Ensure that the one-time-perl script was used.
517
+ ! test -e "$HTTPD_ROOT_PATH/one-time-perl "
514
518
'
515
519
516
520
test_expect_success ' tolerate server sending REF_DELTA against missing promisor objects' '
@@ -533,7 +537,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
533
537
534
538
# Clone. The client has deltabase_have but not deltabase_missing.
535
539
git -c protocol.version=2 clone --no-checkout \
536
- --filter=blob:none $HTTPD_URL/one_time_sed /server repo &&
540
+ --filter=blob:none $HTTPD_URL/one_time_perl /server repo &&
537
541
git -C repo hash-object -w -- "$SERVER/have.txt" &&
538
542
539
543
# Sanity check to ensure that the client does not have
@@ -574,7 +578,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
574
578
575
579
replace_packfile thin.pack &&
576
580
577
- # Use protocol v2 because the sed command looks for the "packfile"
581
+ # Use protocol v2 because the perl command looks for the "packfile"
578
582
# section header.
579
583
test_config -C "$SERVER" protocol.version 2 &&
580
584
@@ -587,8 +591,8 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
587
591
grep "want $(cat deltabase_missing)" trace &&
588
592
! grep "want $(cat deltabase_have)" trace &&
589
593
590
- # Ensure that the one-time-sed script was used.
591
- ! test -e "$HTTPD_ROOT_PATH/one-time-sed "
594
+ # Ensure that the one-time-perl script was used.
595
+ ! test -e "$HTTPD_ROOT_PATH/one-time-perl "
592
596
'
593
597
594
598
# DO NOT add non-httpd-specific tests here, because the last part of this
0 commit comments