diff options
author | Derrick Stolee <derrickstolee@github.com> | 2022-12-22 16:14:16 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-25 08:24:24 +0100 |
commit | 12b0a14b9e5f140a9a4d5a3e3c47fae00a53c6fc (patch) | |
tree | 65ad4f1754e2bab02fc6a13cf3c728ecef21d718 /bundle-uri.h | |
parent | bundle-uri: allow relative URLs in bundle lists (diff) | |
download | git-12b0a14b9e5f140a9a4d5a3e3c47fae00a53c6fc.tar.xz git-12b0a14b9e5f140a9a4d5a3e3c47fae00a53c6fc.zip |
bundle-uri: download bundles from an advertised list
The logic in fetch_bundle_uri() is useful for the --bundle-uri option of
'git clone', but is not helpful when the clone operation discovers a
list of URIs from the bundle-uri protocol v2 command. To actually
download and unbundle the advertised bundles, we need a different
mechanism.
Create the new fetch_bundle_list() method which is very similar to
fetch_bundle_uri() except that it relies on download_bundle_list()
instead of fetch_bundle_uri_internal(). The download_bundle_list()
method will recursively call fetch_bundle_uri_internal() if any of the
advertised URIs serve a bundle list instead of a bundle. This will also
follow the bundle.list.mode setting from the input list: "any" will
download only one such URI while "all" will download data from all of
the URIs.
In an identical way to fetch_bundle_uri(), the bundles are unbundled
after all of the bundle lists have been expanded and all necessary URIs.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | bundle-uri.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bundle-uri.h b/bundle-uri.h index c505444bc7..d5e89f1671 100644 --- a/bundle-uri.h +++ b/bundle-uri.h @@ -108,6 +108,20 @@ int bundle_uri_parse_config_format(const char *uri, int fetch_bundle_uri(struct repository *r, const char *uri); /** + * Given a bundle list that was already advertised (likely by the + * bundle-uri protocol v2 verb) at the given uri, fetch and unbundle the + * bundles according to the bundle strategy of that list. + * + * It is expected that the given 'list' is initialized, including its + * 'baseURI' value. + * + * Returns non-zero if there was an error trying to download the list + * or any of its advertised bundles. + */ +int fetch_bundle_list(struct repository *r, + struct bundle_list *list); + +/** * API for serve.c. */ int bundle_uri_advertise(struct repository *r, struct strbuf *value); |