summaryrefslogtreecommitdiff
path: root/t/t5616-partial-clone.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5616-partial-clone.sh')
-rwxr-xr-xt/t5616-partial-clone.sh46
1 files changed, 25 insertions, 21 deletions
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 4650451964..1e354e057f 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -737,18 +737,22 @@ intersperse () {
sed 's/\(..\)/'$1'\1/g'
}
-# Create a one-time-perl command to replace the existing packfile with $1.
+# Create a one-time-script command to replace the existing packfile with $1.
replace_packfile () {
- # The protocol requires that the packfile be sent in sideband 1, hence
- # the extra \x01 byte at the beginning.
- cp $1 "$HTTPD_ROOT_PATH/one-time-pack" &&
- echo 'if (/packfile/) {
- print;
- my $length = -s "one-time-pack";
- printf "%04x\x01", $length + 5;
- print `cat one-time-pack` . "0000";
- last
- }' >"$HTTPD_ROOT_PATH/one-time-perl"
+ cp "$1" one-time-pack &&
+ write_script "$HTTPD_ROOT_PATH/one-time-script" <<-EOF
+ if grep packfile "\$1" >/dev/null
+ then
+ sed '/packfile/q' "\$1" &&
+ # The protocol requires that the packfile be sent in sideband
+ # 1, hence the extra \001 byte at the beginning.
+ printf "%04x\001" \$((\$(wc -c <"$PWD/one-time-pack") + 5)) &&
+ cat "$PWD/one-time-pack" &&
+ printf "0000"
+ else
+ cat "\$1"
+ fi
+ EOF
}
test_expect_success 'upon cloning, check that all refs point to objects' '
@@ -776,12 +780,12 @@ test_expect_success 'upon cloning, check that all refs point to objects' '
# section header.
test_config -C "$SERVER" protocol.version 2 &&
test_must_fail git -c protocol.version=2 clone \
- --filter=blob:none $HTTPD_URL/one_time_perl/server repo 2>err &&
+ --filter=blob:none $HTTPD_URL/one_time_script/server repo 2>err &&
test_grep "did not send all necessary objects" err &&
- # Ensure that the one-time-perl script was used.
- ! test -e "$HTTPD_ROOT_PATH/one-time-perl"
+ # Ensure that the one-time-script script was used.
+ ! test -e "$HTTPD_ROOT_PATH/one-time-script"
'
test_expect_success 'when partial cloning, tolerate server not sending target of tag' '
@@ -818,14 +822,14 @@ test_expect_success 'when partial cloning, tolerate server not sending target of
# Exercise to make sure it works.
git -c protocol.version=2 clone \
- --filter=blob:none $HTTPD_URL/one_time_perl/server repo 2> err &&
+ --filter=blob:none $HTTPD_URL/one_time_script/server repo 2> err &&
! grep "missing object referenced by" err &&
- # Ensure that the one-time-perl script was used.
- ! test -e "$HTTPD_ROOT_PATH/one-time-perl"
+ # Ensure that the one-time-script script was used.
+ ! test -e "$HTTPD_ROOT_PATH/one-time-script"
'
-test_expect_success 'tolerate server sending REF_DELTA against missing promisor objects' '
+test_expect_success PERL_TEST_HELPERS 'tolerate server sending REF_DELTA against missing promisor objects' '
SERVER="$HTTPD_DOCUMENT_ROOT_PATH/server" &&
rm -rf "$SERVER" repo &&
test_create_repo "$SERVER" &&
@@ -845,7 +849,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
# Clone. The client has deltabase_have but not deltabase_missing.
git -c protocol.version=2 clone --no-checkout \
- --filter=blob:none $HTTPD_URL/one_time_perl/server repo &&
+ --filter=blob:none $HTTPD_URL/one_time_script/server repo &&
git -C repo hash-object -w -- "$SERVER/have.txt" &&
# Sanity check to ensure that the client does not have
@@ -899,8 +903,8 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
grep "want $(cat deltabase_missing)" trace &&
! grep "want $(cat deltabase_have)" trace &&
- # Ensure that the one-time-perl script was used.
- ! test -e "$HTTPD_ROOT_PATH/one-time-perl"
+ # Ensure that the one-time-script script was used.
+ ! test -e "$HTTPD_ROOT_PATH/one-time-script"
'
# DO NOT add non-httpd-specific tests here, because the last part of this