Re: [PATCH GSoC 1/5] protocol-caps: add type support to object-info
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jul 29, 2026, 22:39 UTC
- Message-ID
- <CAOLa=ZSJvOrTXypnh1Bk_Z3kkXtJVwueSH1U-vHALwS=XQTouQ@mail.gmail.com>
- In-Reply-To
- <20260725-objecttype-support-v1-1-2d4ca3bbabf1@gmail.com>
Pablo Sabater <pabloosabaterr@gmail.com> writes:
Show 41 quoted lines
> 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 <karthik.188@gmail.com>
> Mentored-by: Chandra Pratap <chandrapratap3519@gmail.com>
> Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
> ---
> 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...
Show 6 quoted lines
> 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/