mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
clone: unbundle the advertised bundles
A previous change introduced the transport methods to acquire a bundle list from the 'bundle-uri' protocol v2 command, when advertised _and_ when the client has chosen to enable the feature. Teach Git to download and unbundle the data advertised by those bundles during 'git clone'. This takes place between the ref advertisement and the object data download, and stateful connections will linger while the client downloads bundles. In the future, we should consider closing the remote connection during this process. Also, since the --bundle-uri option exists, we do not want to mix the advertised bundles with the user-specified bundles. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
12b0a14b9e
commit
876094ac16
@@ -1271,11 +1271,26 @@ 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);
|
||||
if (!bundle_uri) {
|
||||
/*
|
||||
* Populate transport->got_remote_bundle_uri and
|
||||
* transport->bundle_uri. We might get nothing.
|
||||
*/
|
||||
transport_get_remote_bundle_uri(transport);
|
||||
|
||||
if (transport->bundles &&
|
||||
hashmap_get_size(&transport->bundles->bundles)) {
|
||||
/* At this point, we need the_repository to match the cloned repo. */
|
||||
if (repo_init(the_repository, git_dir, work_tree))
|
||||
warning(_("failed to initialize the repo, skipping bundle URI"));
|
||||
else if (fetch_bundle_list(the_repository,
|
||||
transport->bundles))
|
||||
warning(_("failed to fetch advertised bundles"));
|
||||
} else {
|
||||
clear_bundle_list(transport->bundles);
|
||||
FREE_AND_NULL(transport->bundles);
|
||||
}
|
||||
}
|
||||
|
||||
if (mapped_refs) {
|
||||
int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
|
||||
|
||||
Reference in New Issue
Block a user