Calvin Wan <calvinwan@xxxxxxxxxx> writes: > Sometimes it is useful to get information about an object without having > to download it completely. The server logic has already been implemented > as “a2ba162cda (object-info: support for retrieving object info, > 2021-04-20)”. This patch implements the client option for it. Currently, > only 'size' is supported and the server must be v2, however future > patches can implement additional options. > > The question of version mismatch often comes up with client/server > relationships. There are two cases to consider here (assuming either > client or server functionality for object-info changes between the > different versions): > > 1. client version > server version > - client can request additional attributes from server > 2. server version > client version > - server can return additional info to the client > > The second case is a non-issue since the client would never be able to > request additional info from the server. In order to solve the first > case, recall an earlier patch where the server sends back the attributes > even if no object ids are sent by the client. This allows the client to > first check whether the server can accept the requested attributes > before sending the entire request. >From this description, it seems like the intention is to send an object-info request, and then if the server responds in a certain way (here, sending back the attributes - presumably without sending any actual information), then we know that the server doesn't support our request and we need to fall back. As Junio says [1], this requires one RTT more than necessary. We could just determine if the server supports the attributes we want by using capabilities (without needing to send the request to check). [1] https://lore.kernel.org/git/xmqqilqnsaep.fsf@gitster.g/