Re: [PATCH GSoC v14 09/13] serve: advertise object-info feature
From: Pablo Sabater <hidden>
Date: 2026-06-27 17:53:11
El sáb, 27 jun 2026 a las 0:23, Karthik Nayak ([off-list ref]) escribió:
Pablo Sabater [off-list ref] writes:quoted
From: Calvin Wan <redacted> 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 [off-list ref] Helped-by: Christian Couder [off-list ref] Signed-off-by: Calvin Wan <redacted> Signed-off-by: Eric Ju <redacted> Signed-off-by: Pablo Sabater <redacted> --- 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.
quoted
return advertise_object_info; } -- 2.54.0