summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorPablo Sabater <pabloosabaterr@gmail.com>2026-08-08 02:02:23 +0200
committerJunio C Hamano <gitster@pobox.com>2026-08-07 18:50:08 -0700
commitafa4ea56fedc3ca04d3b00a3ef930833e7ad68ea (patch)
tree99e102a7c7a3fb7bb88f60be9c365fef90c8fefa /builtin
parent7692fa90199c623629f07e8883f5df8cfa859e03 (diff)
fetch-object-info: parse type from server response
The server can handle type requests but does not advertise the capability yet. Prepare the client to know how to parse the server response once the server advertises the type capability. Mentored-by: Karthik Nayak <karthik.188@gmail.com> Mentored-by: Chandra Pratap <chandrapratap3519@gmail.com> Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/cat-file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 8dcad2f5eb..8502020083 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -842,6 +842,8 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,
if (data->info.sizep)
results.wants_size = 1;
+ if (data->info.typep)
+ results.wants_type = 1;
if (get_remote_info(count, argv, &results, &object_info_oids))
die(_("failed to get object info from the remote: %s"), argv[0]);
@@ -850,6 +852,8 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,
string_list_append(&data->remote_allowed_atoms, "objectname");
if (results.sizes)
string_list_append(&data->remote_allowed_atoms, "objectsize");
+ if (results.types)
+ string_list_append(&data->remote_allowed_atoms, "objecttype");
data->skip_object_info = 1;
for (size_t i = 0; i < results.nr; i++) {
@@ -868,6 +872,9 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,
if (results.sizes)
data->size = results.sizes[i];
+ if (results.types)
+ data->type = results.types[i];
+
opt->batch_mode = BATCH_MODE_INFO;
data->is_remote = 1;
batch_object_write(argv[i + 1], output, opt, data, NULL, 0);