3 test_description
='test fetching bundles with --bundle-uri'
7 test_expect_success
'fail to clone from non-existent file' '
8 test_when_finished rm -rf test &&
9 git clone --bundle-uri="$(pwd)/does-not-exist" . test 2>err &&
10 grep "failed to download bundle from URI" err
13 test_expect_success
'fail to clone from non-bundle file' '
14 test_when_finished rm -rf test &&
16 git clone --bundle-uri="$(pwd)/bogus" . test 2>err &&
17 grep "is not a bundle" err
20 test_expect_success
'create bundle' '
21 git init clone-from &&
22 git -C clone-from checkout -b topic &&
23 test_commit -C clone-from A &&
24 test_commit -C clone-from B &&
25 git -C clone-from bundle create B.bundle topic
28 test_expect_success
'clone with path bundle' '
29 git clone --bundle-uri="clone-from/B.bundle" \
30 clone-from clone-path &&
31 git -C clone-path rev-parse refs/bundles/topic >actual &&
32 git -C clone-from rev-parse topic >expect &&
33 test_cmp expect actual
36 test_expect_success
'clone with file:// bundle' '
37 git clone --bundle-uri="file://$(pwd)/clone-from/B.bundle" \
38 clone-from clone-file &&
39 git -C clone-file rev-parse refs/bundles/topic >actual &&
40 git -C clone-from rev-parse topic >expect &&
41 test_cmp expect actual
44 #########################################################################
45 # HTTP tests begin here
47 .
"$TEST_DIRECTORY"/lib-httpd.sh
50 test_expect_success
'fail to fetch from non-existent HTTP URL' '
51 test_when_finished rm -rf test &&
52 git clone --bundle-uri="$HTTPD_URL/does-not-exist" . test 2>err &&
53 grep "failed to download bundle from URI" err
56 test_expect_success
'fail to fetch from non-bundle HTTP URL' '
57 test_when_finished rm -rf test &&
58 echo bogus >"$HTTPD_DOCUMENT_ROOT_PATH/bogus" &&
59 git clone --bundle-uri="$HTTPD_URL/bogus" . test 2>err &&
60 grep "is not a bundle" err
63 test_expect_success
'clone HTTP bundle' '
64 cp clone-from/B.bundle "$HTTPD_DOCUMENT_ROOT_PATH/B.bundle" &&
66 git clone --no-local --mirror clone-from \
67 "$HTTPD_DOCUMENT_ROOT_PATH/fetch.git" &&
69 git clone --bundle-uri="$HTTPD_URL/B.bundle" \
70 "$HTTPD_URL/smart/fetch.git" clone-http &&
71 git -C clone-http rev-parse refs/bundles/topic >actual &&
72 git -C clone-from rev-parse topic >expect &&
73 test_cmp expect actual &&
75 test_config -C clone-http log.excludedecoration refs/bundle/
78 # Do not add tests here unless they use the HTTP server, as they will
79 # not run unless the HTTP dependencies exist.