Skip to content

fetch: use bundle URIs when having creationToken heuristic

Toon Claes requested to merge toon-fetch-bundle-uri-creationtoken into master

At the moment, bundle URIs are only used by git-clone(1). For a clone the use of bundle URI is trivial, because the repository is empty so downloading bundles will never result in downloading objects that are in the repository already.

For git-fetch(1), this more complicated to use bundle URI. We want to avoid downloading bundles that only contains objects that are in the local repository already.

One way to achieve this is possible when the "creationToken" heuristic is used for bundle URIs. We attempt to download and unbundle the minimum number of bundles by creationToken in decreasing order. If we fail to unbundle (after a successful download) then move to the next non-downloaded bundle and attempt downloading. Once we succeed in applying a bundle, move to the previous unapplied bundle and attempt to unbundle it again. At the end the highest applied creationToken is written to fetch.bundleCreationToken in the git-config. The next time bundles are advertised by the server, bundles with a lower creationToken value are ignored. This was already implemented by 7903efb7 (bundle-uri: download in creationToken order, 2023-01-31) in fetch_bundles_by_token().

Using the creationToken heuristic is optional, but without it the client has no idea which bundles are new, how to sort them, and which only have objects the client already has.

With this knowledge, make git-fetch(1) use bundle URIs from the server, but only when the creationToken heuristic is used.

Signed-off-by: Toon Claes toon@iotcl.com

Edited by Toon Claes

Merge request reports

Loading