@@ -1263,11 +1263,22 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (refs)
mapped_refs = wanted_peer_refs(refs, &remote->fetch);
- /*
- * Populate transport->got_remote_bundle_uri and
- * transport->bundle_uri. We might get nothing.
- */
- transport_get_remote_bundle_uri(transport, 1);
+ if (!bundle_uri) {
+ /*
+ * Populate transport->got_remote_bundle_uri and
+ * transport->bundle_uri. We might get nothing.
+ */
+ transport_get_remote_bundle_uri(transport, 1);
+
+ if (transport->bundles) {
+ /* At this point, we need the_repository to match the cloned repo. */
+ repo_init(the_repository, git_dir, work_tree);
+ if (fetch_bundle_list(the_repository,
+ remote->url[0],
+ transport->bundles))
+ warning(_("failed to fetch advertised bundles"));
+ }
+ }
if (mapped_refs) {
int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));