Re: [PATCH GSoC 1/5] protocol-caps: add type support to object-info
From: Karthik Nayak <hidden>
Date: 2026-07-29 22:39:09
Pablo Sabater [off-list ref] writes:
quoted hunk ↗ jump to hunk
Teach the server-side object-info handler to accept type as a requested field. When the client includes type in its object-info request, the server returns the requested object type. While at it, fix requested_info->size bit field style. Mentored-by: Karthik Nayak [off-list ref] Mentored-by: Chandra Pratap [off-list ref] Signed-off-by: Pablo Sabater <redacted> --- protocol-caps.c | 21 ++++++++++++++++++--- t/t5701-git-serve.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-)diff --git a/protocol-caps.c b/protocol-caps.c index 02261be14d..5531d388f0 100644 --- a/protocol-caps.c +++ b/protocol-caps.c@@ -11,7 +11,8 @@ #include "strbuf.h" struct requested_info { - unsigned size : 1; + unsigned size:1; + unsigned type:1; }; /*@@ -73,15 +74,20 @@ static void send_info(struct repository *r, struct packet_writer *writer, if (info->size) packet_writer_write(writer, "size"); + if (info->type) + packet_writer_write(writer, "type"); + for_each_string_list_item (item, oid_str_list) { const char *oid_str = item->string; struct object_id oid; size_t object_size; + enum object_type object_type;
This is fine, but If you do reiterate, maybe we can follow the reverse christmas tree [1] format and move this field up? Or maybe its just me...
if (get_oid_hex_algop(oid_str, &oid, r->hash_algo) < 0) {
packet_writer_error(
writer,
- "object-info: protocol error, expected to get oid, not '%s'",
+ "object-info: protocol error, expected to get "
+ "oid, not '%s'",I know this is to fix styling, but we generally don't do such changes unless we're touching the code or around it. It just tends to be a distraction :) [snip] [1]: https://lwn.net/Articles/758613/
Attachments
- signature.asc [application/pgp-signature] 690 bytes