diff options
author | Derrick Stolee <derrickstolee@github.com> | 2023-01-31 16:29:15 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-01-31 19:57:48 +0300 |
commit | 4074d3c7e1a3b44c5c02235799d798f8b2613333 (patch) | |
tree | df8df4a1fc8a615c77f6ee63d429973f572f7cfc /bundle-uri.c | |
parent | 7903efb7170ca9704e80ef9188bef37ecf55f2d6 (diff) |
clone: set fetch.bundleURI if appropriate
Bundle providers may organize their bundle lists in a way that is
intended to improve incremental fetches, not just initial clones.
However, they do need to state that they have organized with that in
mind, or else the client will not expect to save time by downloading
bundles after the initial clone. This is done by specifying a
bundle.heuristic value.
There are two types of bundle lists: those at a static URI and those
that are advertised from a Git remote over protocol v2.
The new fetch.bundleURI config value applies for static bundle URIs that
are not advertised over protocol v2. If the user specifies a static URI
via 'git clone --bundle-uri', then Git can set this config as a reminder
for future 'git fetch' operations to check the bundle list before
connecting to the remote(s).
For lists provided over protocol v2, we will want to take a different
approach and create a property of the remote itself by creating a
remote.<id>.* type config key. That is not implemented in this change.
Later changes will update 'git fetch' to consume this option.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle-uri.c')
-rw-r--r-- | bundle-uri.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bundle-uri.c b/bundle-uri.c index af48938d24..7a1b6d94bf 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -736,7 +736,8 @@ static int unlink_bundle(struct remote_bundle_info *info, void *data) return 0; } -int fetch_bundle_uri(struct repository *r, const char *uri) +int fetch_bundle_uri(struct repository *r, const char *uri, + int *has_heuristic) { int result; struct bundle_list list; @@ -756,6 +757,8 @@ int fetch_bundle_uri(struct repository *r, const char *uri) result = unbundle_all_bundles(r, &list); cleanup: + if (has_heuristic) + *has_heuristic = (list.heuristic != BUNDLE_HEURISTIC_NONE); for_all_bundles_in_list(&list, unlink_bundle, NULL); clear_bundle_list(&list); clear_remote_bundle_info(&bundle, NULL); |