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 `cat-file --batch-command`. 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 and the relevant object info is returned. Summary of changes ================== Patches 1, 2, 3, and 7 are small changes that setup the main implementation. Patch 4 sets up object-info to be backwards compatible for future patch series that adds additional attributes. Patch 5 adds internal trasnport functions to send and receive object-info command request packets. Patch 6 adds the fallback if object-info is not supported or fails. Patch 8 adds the cat-file implementation. Changes since V3 ================ * Object-info is now implemented in cat-file --batch-command rather than fetch (new base commit) * Removed config option to advertise object-info * Added forwards and backwards compability for object-info * Split up some patches to better describe and visualize changes Signed-off-by: Calvin Wan <calvinwan@xxxxxxxxxx> Helped-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx> Calvin Wan (8): fetch-pack: refactor packet writing fetch-pack: move fetch default settings object-store: add function to free object_info contents object-info: send attribute packet regardless of object ids transport: add client side capability to request object-info transport: add object-info fallback to fetch cat-file: move parse_cmd and DEFAULT_FORMAT up cat-file: add --batch-command remote-object-info command Documentation/git-cat-file.txt | 16 +- builtin/cat-file.c | 225 ++++++++++++++++----- fetch-pack.c | 61 ++++-- fetch-pack.h | 10 + object-file.c | 16 ++ object-store.h | 3 + protocol-caps.c | 14 +- t/t1006-cat-file.sh | 347 +++++++++++++++++++++++++++++++++ transport-helper.c | 7 +- transport.c | 97 ++++++++- transport.h | 11 ++ 11 files changed, 728 insertions(+), 79 deletions(-) -- 2.36.0.rc2.10170.gb555eefa6f