diff --git a/bundle-uri.c b/bundle-uri.c index 57cccfc6b8ee1fe95e1d4b6e239336d6ad8f9049..a1120508bf063433f340a22c8dbe7c76e40d5272 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -745,6 +745,9 @@ static int fetch_bundle_uri_internal(struct repository *r, int result = 0; struct remote_bundle_info *bcopy; + if (!bundle->uri) + return -1; + if (depth >= max_bundle_uri_depth) { warning(_("exceeded bundle URI recursion limit (%d)"), max_bundle_uri_depth); diff --git a/connect.c b/connect.c index 8352b71faf0931a65f174c8b60149315b979625b..d2e2bd8cce6d21ee4107d338fd37873e1b9c69e4 100644 --- a/connect.c +++ b/connect.c @@ -536,8 +536,8 @@ int get_remote_bundle_uri(int fd_out, struct packet_reader *reader, if (!bundle_uri_parse_line(bundles, line)) continue; - return error(_("error on bundle-uri response line %d: %s"), - line_nr, line); + warning(_("ignore invalid bundle-uri response line %d: %s"), + line_nr, line); } if (reader->status != PACKET_READ_FLUSH) diff --git a/t/t5558-clone-bundle-uri.sh b/t/t5558-clone-bundle-uri.sh index 7a0943bd365a1ac5049d980b293039b31906c904..73aebd0b81d1e7be778ad7d197cdefa43d7725da 100755 --- a/t/t5558-clone-bundle-uri.sh +++ b/t/t5558-clone-bundle-uri.sh @@ -468,6 +468,30 @@ test_expect_success 'negotiation: bundle list with all wanted commits' ' test_grep ! "clone> want " trace-packet.txt ' +test_expect_success 'negotiation: bundle list with heuristic but uri missing' ' + cat >bundle-list <<-EOF && + [bundle] + version = 1 + mode = all + heuristic = creationToken + + [bundle "bundle-1"] + creationToken = 1 + EOF + + git clone --no-local --single-branch --branch=left --no-tags \ + --bundle-uri="file://$(pwd)/bundle-list" \ + clone-from nego-bundle-list-uri-missing && + + git -C nego-bundle-list-all for-each-ref --format="%(refname)" >refs && + grep "refs/bundles/heads/" refs >actual && + cat >expect <<-\EOF && + refs/bundles/heads/base + refs/bundles/heads/left + EOF + test_cmp expect actual +' + ######################################################################### # HTTP tests begin here @@ -1302,6 +1326,31 @@ test_expect_success 'bundles with newline in target path are rejected' ' test_path_is_missing escape ' +test_expect_success 'bundles advertised with missing URI' ' + git clone --no-local --mirror clone-from \ + "$HTTPD_DOCUMENT_ROOT_PATH/no-uri.git" && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/no-uri.git" config uploadpack.advertiseBundleURIs true && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/no-uri.git" config bundle.version 1 && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/no-uri.git" config bundle.mode all && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/no-uri.git" config bundle.bundle-1.creationToken 1 && + + git -c transfer.bundleURI=true clone \ + "$HTTPD_URL/smart/no-uri.git" target-no-uri +' + +test_expect_success 'bundles advertised with empty URI' ' + git clone --no-local --mirror clone-from \ + "$HTTPD_DOCUMENT_ROOT_PATH/empty-uri.git" && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/empty-uri.git" config uploadpack.advertiseBundleURIs true && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/empty-uri.git" config bundle.version 1 && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/empty-uri.git" config bundle.mode all && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/empty-uri.git" config bundle.bundle-1.uri "" && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/empty-uri.git" config bundle.bundle-1.creationToken 1 && + + git -c transfer.bundleURI=true clone \ + "$HTTPD_URL/smart/empty-uri.git" target-empty-uri +' + # Do not add tests here unless they use the HTTP server, as they will # not run unless the HTTP dependencies exist.