Hi Calvin
On 29/07/2022 00:02, Calvin Wan wrote:
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 part of the cover letter seems to have been left over from a
previous iteration. I noticed that in patch 6 there is a reference to
'--object-info' in an error message as well.
This might be a daft question but could we teach cat-file to check if an
object is available locally and if it is not retrieve just the metadata
from the remote rather than adding a new command to --batch-command?
That way it would be transparent to the user and they would not have to
worry about whether they might be querying a remote object or not.
Best Wishes
Phillip
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.
=== Changes since v4 ===
- Instead of making 2 rounds trips to determine whether the server can
handle the client object-info request, the server now advertises the
features it can send back so the client can immediately fallback to
fetch if any feature is not supported
- Fixed nits and clarified some documentation/commit messages
Signed-off-by: Calvin Wan <calvinwan@xxxxxxxxxx>
Helped-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx>
Calvin Wan (6):
fetch-pack: refactor packet writing
fetch-pack: move fetch initialization
protocol-caps: initialization bug fix
serve: advertise object-info feature
transport: add client support for object-info
cat-file: add remote-object-info to batch-command
Documentation/git-cat-file.txt | 16 +-
builtin/cat-file.c | 225 ++++++++++++++++-----
fetch-pack.c | 52 +++--
fetch-pack.h | 10 +
object-file.c | 11 ++
object-store.h | 3 +
protocol-caps.c | 2 +-
serve.c | 10 +-
t/t1006-cat-file.sh | 348 +++++++++++++++++++++++++++++++++
t/t5555-http-smart-common.sh | 2 +-
t/t5701-git-serve.sh | 2 +-
transport-helper.c | 7 +-
transport.c | 110 ++++++++++-
transport.h | 11 ++
14 files changed, 734 insertions(+), 75 deletions(-)
base-commit: 9dd64cb4d310986dd7b8ca7fff92f9b61e0bd21a