Sometimes it is useful to get information about an object without having to download it completely. The server logic has already been implemented as “a2ba162cda (object-info: support for retrieving object info, 2021-04-20)”. This patch implements the client option for it. Add ‘--object-info’ option to fetch. This option allows the client to make an object-info command request to a server that supports protocol v2. If the server is v2, but does not allow for the object-info command request, the entire object is fetched instead and the relevant information is returned. Patch 1 is a small refactor. Patch 2 adds a config option for advertisement of object-info. Patch 3 is the main implementation of fetch object-info. Major changes since v2: * Added a fallback for servers that do not allow object-info * Refactored the fetch object-info code by moving it to fetch_refs in the vtable rather than having its own function in the vtable. This allows for the code to easily transition to the fallback if object-info fails. Calvin Wan (3): fetch-pack: refactor how packet is written to be more generic objectinfo.advertise: add config option to advertise object-info object-info: add option for retrieving object info Documentation/config/transfer.txt | 4 + Documentation/fetch-options.txt | 5 ++ Documentation/git-fetch.txt | 1 + builtin/fetch.c | 36 +++++++- fetch-pack.c | 66 ++++++++++---- fetch-pack.h | 9 ++ protocol-caps.c | 11 +++ protocol-caps.h | 6 ++ serve.c | 2 +- t/t5583-fetch-object-info.sh | 138 ++++++++++++++++++++++++++++++ transport-helper.c | 8 +- transport-internal.h | 1 + transport.c | 75 +++++++++++++++- transport.h | 9 ++ 14 files changed, 349 insertions(+), 22 deletions(-) create mode 100755 t/t5583-fetch-object-info.sh base-commit: f01e51a7cfd75131b7266131b1f7540ce0a8e5c1 -- 2.33.0.664.g0785eb7698