Skip to content

Commit a1a3dff

Browse files
committed
t5601: basic bundle URI tests
This test demonstrates an end-to-end form of the bundle URI feature given by an HTTP server advertising the 'features' capability with a bundle URI that is a bundle file on that same HTTP server. We verify that we unbundled a bundle, which could only have happened if we successfully downloaded that file. RFC-TODO: Create similar tests throughout the series that perform similar tests, including examples with table of contents and partial clones. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 011739f commit a1a3dff

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

t/t5601-clone.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,65 @@ test_expect_success 'reject cloning shallow repository using HTTP' '
790790
git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo
791791
'
792792

793+
test_expect_success 'auto-discover bundle URI from HTTP clone' '
794+
test_when_finished rm -rf trace.txt repo2 "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" &&
795+
git -C src bundle create "$HTTPD_DOCUMENT_ROOT_PATH/everything.bundle" --all &&
796+
git clone --bare --no-local src "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" &&
797+
798+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
799+
uploadpack.advertiseBundleURIs true &&
800+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
801+
bundle.version 1 &&
802+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
803+
bundle.mode all &&
804+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
805+
bundle.everything.uri "$HTTPD_URL/everything.bundle" &&
806+
807+
GIT_TEST_BUNDLE_URI=1 \
808+
GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
809+
git -c protocol.version=2 clone \
810+
$HTTPD_URL/smart/repo2.git repo2 &&
811+
cat >pattern <<-EOF &&
812+
"event":"child_start".*"argv":\["git-remote-https","origin","$HTTPD_URL/everything.bundle"\]
813+
EOF
814+
grep -f pattern trace.txt
815+
'
816+
817+
test_expect_success 'auto-discover multiple bundles from HTTP clone' '
818+
test_when_finished rm -rf trace.txt repo3 "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" &&
819+
820+
test_commit -C src new &&
821+
git -C src bundle create "$HTTPD_DOCUMENT_ROOT_PATH/new.bundle" HEAD~1..HEAD &&
822+
git clone --bare --no-local src "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" &&
823+
824+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
825+
uploadpack.advertiseBundleURIs true &&
826+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
827+
bundle.version 1 &&
828+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
829+
bundle.mode all &&
830+
831+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
832+
bundle.everything.uri "$HTTPD_URL/everything.bundle" &&
833+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
834+
bundle.new.uri "$HTTPD_URL/new.bundle" &&
835+
836+
GIT_TEST_BUNDLE_URI=1 \
837+
GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
838+
git -c protocol.version=2 clone \
839+
$HTTPD_URL/smart/repo3.git repo3 &&
840+
841+
# We should fetch _both_ bundles
842+
cat >pattern <<-EOF &&
843+
"event":"child_start".*"argv":\["git-remote-https","origin","$HTTPD_URL/everything.bundle"\]
844+
EOF
845+
grep -f pattern trace.txt &&
846+
cat >pattern <<-EOF &&
847+
"event":"child_start".*"argv":\["git-remote-https","origin","$HTTPD_URL/new.bundle"\]
848+
EOF
849+
grep -f pattern trace.txt
850+
'
851+
793852
# DO NOT add non-httpd-specific tests here, because the last part of this
794853
# test script is only executed when httpd is available and enabled.
795854

0 commit comments

Comments
 (0)