Re: [PATCH GSoC v14 09/13] serve: advertise object-info feature
- From
Pablo Sabater <pabloosabaterr@gmail.com>
- Date
- Jun 27, 2026, 17:52 UTC
- Message-ID
- <CAN5EUNTrdNArd5SX9df6x9bOhRfzE4c7dLOuNu7ONUdn4TLsUA@mail.gmail.com>
- In-Reply-To
- <CAOLa=ZShTcHOekT+NuxMwZz-7P5i9aSWXSL6MW9_9aKkNwqsig@mail.gmail.com>
El sáb, 27 jun 2026 a las 0:23, Karthik Nayak (<karthik.188@gmail.com>) escribió:
Show 42 quoted lines
>
> Pablo Sabater <pabloosabaterr@gmail.com> writes:
>
> > From: Calvin Wan <calvinwan@google.com>
> >
> > In order for a client to know what object-info components a server can
> > provide, advertise supported object-info features. This will allow a
> > client to decide whether to query the server for object-info or fetch
> > as a fallback.
> >
> > Helped-by: Jonathan Tan <jonathantanmy@google.com>
> > Helped-by: Christian Couder <chriscool@tuxfamily.org>
> > Signed-off-by: Calvin Wan <calvinwan@google.com>
> > Signed-off-by: Eric Ju <eric.peijian@gmail.com>
> > Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
> > ---
> > serve.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/serve.c b/serve.c
> > index 49a6e39b1d..2b07d922b3 100644
> > --- a/serve.c
> > +++ b/serve.c
> > @@ -89,7 +89,7 @@ static void session_id_receive(struct repository *r UNUSED,
> > trace2_data_string("transfer", NULL, "client-sid", client_sid);
> > }
> >
> > -static int object_info_advertise(struct repository *r, struct strbuf *value UNUSED)
> > +static int object_info_advertise(struct repository *r, struct strbuf *value)
> > {
> > if (advertise_object_info == -1 &&
> > repo_config_get_bool(r, "transfer.advertiseobjectinfo",
> > @@ -97,6 +97,9 @@ static int object_info_advertise(struct repository *r, struct strbuf *value UNUS
> > /* disabled by default */
> > advertise_object_info = 0;
> > }
> > + /* Currently only size is supported */
> > + if (value && advertise_object_info)
> > + strbuf_addstr(value, "size");
>
> So is the plan that further options will be added here to value? If so,
> whats the format we will follow?Hi! The current documented format is at `gitprotocol-v2.adoc`, however I think it could be improved. I have a more complete version in the not-yet-sent %(objecttype) support series, but since the question comes up here, I will update the format documentation in this series for size only:
oid <oid> Indicates to the server an object which the client wants to obtain - information for. + information for. They must be full object IDs.
- info = PKT-LINE(attrs) LF)
+ info = PKT-LINE(attrs LF)
*PKT-LINE(obj-info LF)attrs = attr | attrs SP attrs
+ obj-size = 1*DIGIT + attr = "size"
- obj-info = obj-id SP obj-size + obj-info = obj-id SP [obj-size] + +If the server does not recognize the object id, the response will be +`obj-id SP` regardless of the number of attributes requested.
About the names `size` and future ones `type` they are arbitrarily chosen, so for example: `delta:base` could be `delta`. They are appended to the buffer so in case of adding `type`, it would look like:
strbuf_addstr(value, "size type");
What do you think?
Thanks for the review, Pablo.
Show 7 quoted lines
> > > return advertise_object_info; > > } > > > > > > -- > > 2.54.0