Re: [PATCH GSoC 1/5] protocol-caps: add type support to object-info
Karthik Nayak <[email protected]> Wed, 29 Jul 2026 22:39:06 +0000
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <CAOLa=ZSJvOrTXypnh1Bk_Z3kkXtJVwueSH1U-vHALwS=XQTouQ@mail.gmail.com> |
Pablo Sabater <[email protected]> writes: > 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 <[email protected]> > Mentored-by: Chandra Pratap <[email protected]> > Signed-off-by: Pablo Sabater <[email protected]> > --- > 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/
signature.asc
(application/pgp-signature, 690 B)
-----BEGIN PGP SIGNATURE----- iQHKBAEBCgA0FiEEV85Mf2N1cQ/LZcYGPtWfJI5GjH8FAmpqgQcWHGthcnRoaWsu MTg4QGdtYWlsLmNvbQAKCRA+1Z8kjkaMf2emC/43DI8HvCpOiGm8za2Lzdv03YIa Fy4YeHZDTRJLuMz9y4AEt0Mcys5Q6/Rfq29eu3yi+LxIrnWOfnySSX2sJxx/p1Pu PV0WziI30h9J5ubXe5trZQsL3vAnWwSjZGoggVVHJPkZlhUhJsIufBhzhiOMBsvW SElQw01B/8fj2XhOOjUGyrjmkFOrvyjaIVh564JB6V4OHwcAQyXZIpt+yaHFPaRv cN7XvUVQbl2u5ZZyIRZDT+rWdMQB5FIS4des5OQ134k2LX5SfSyxpuHyMp9g+MhJ 95BtEWv+8wAKHg+HY2X1dW935FRCy6wyiqLnqFfEm+8YjoKOUkdHIwWX7P4sL19D FtXcWx1v2irOf38lhWNnuk2C2g3CDVan3dqlf/SBcmGhujlZqp9wAoS4eAmWAOEo iJgHISrD9uttGu5jbXeDQz1tu78Pp9fhcNVwMvpV2eTHTusi4Zx/7WlV9w51gJnT IMOVYPbqMq48EjyVeq2sYujy3NwEIgRnIPh+uRI= =+Q8Q -----END PGP SIGNATURE-----