Currently on the server side of object-info, if the client does not send any object ids in the request or if the client requests an attribute the server does not support, the server will either not send any packets back or error out. Consider the scenario where the client git version is ahead of the server git version, and the client can request additional object-info besides 'size'. There needs to be a way to tell whether the server can honor all of the client attribute requests before the client sends a request with all of the object ids. In a future patch, if the client were to make an initial command request with only attributes, the server would be able to confirm which attributes it could return. --- protocol-caps.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/protocol-caps.c b/protocol-caps.c index bbde91810a..bc7def0727 100644 --- a/protocol-caps.c +++ b/protocol-caps.c @@ -11,6 +11,7 @@ struct requested_info { unsigned size : 1; + unsigned unknown : 1; }; /* @@ -40,12 +41,12 @@ static void send_info(struct repository *r, struct packet_writer *writer, struct string_list_item *item; struct strbuf send_buffer = STRBUF_INIT; - if (!oid_str_list->nr) - return; - if (info->size) packet_writer_write(writer, "size"); + if (info->unknown || !oid_str_list->nr) + goto release; + for_each_string_list_item (item, oid_str_list) { const char *oid_str = item->string; struct object_id oid; @@ -72,12 +73,13 @@ static void send_info(struct repository *r, struct packet_writer *writer, packet_writer_write(writer, "%s", send_buffer.buf); strbuf_reset(&send_buffer); } +release: strbuf_release(&send_buffer); } int cap_object_info(struct repository *r, struct packet_reader *request) { - struct requested_info info; + struct requested_info info = { 0 }; struct packet_writer writer; struct string_list oid_str_list = STRING_LIST_INIT_DUP; @@ -92,9 +94,7 @@ int cap_object_info(struct repository *r, struct packet_reader *request) if (parse_oid(request->line, &oid_str_list)) continue; - packet_writer_error(&writer, - "object-info: unexpected line: '%s'", - request->line); + info.unknown = 1; } if (request->status != PACKET_READ_FLUSH) { -- 2.36.0.rc2.10170.gb555eefa6f