serve: advertise object-info feature
In order for a client to know what object-info components a server can provide, advertise supported object-info features. This allows 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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Calvin Wan committed
Jul 24, 2026 at 12:54 UTC
7dcbd35a120c04e30462407c4c9446aaaba9068f
1 file changed
+4
-1
serve.c
+4
-1
@@ -89,7 +89,7 @@ static void session_id_receive(struct repository *r UNUSED,
89
trace2_data_string("transfer", NULL, "client-sid", client_sid);
90
}
91
92
-static int object_info_advertise(struct repository *r, struct strbuf *value UNUSED)
92
+static int object_info_advertise(struct repository *r, struct strbuf *value)
93
{
94
if (advertise_object_info == -1 &&
95
repo_config_get_bool(r, "transfer.advertiseobjectinfo",
@@ -97,6 +97,9 @@ static int object_info_advertise(struct repository *r, struct strbuf *value UNUS
97
/* disabled by default */
98
advertise_object_info = 0;
99
}
100
+ /* Currently only size is supported */
101
+ if (value && advertise_object_info)
102
+ strbuf_addstr(value, "size");
103
return advertise_object_info;
104
}
105