Re: [PATCH GSoC RFC v13 00/12] cat-file: add remote-object-info to batch-command
- From
- Chandra Pratap <chandrapratap3519@gmail.com>
- Date
- Jun 21, 2026, 05:25 UTC
- Message-ID
- <CA+J6zkRam3hPutyFnQ+RVrPczT+O6cM+e-aZL0m0t3a5ABo8VQ@mail.gmail.com>
- In-Reply-To
- <20260619-ps-eric-work-rebase-v13-0-3d4c7315d2f8@gmail.com>
On Fri, 19 Jun 2026 at 20:26, Pablo Sabater <pabloosabaterr@gmail.com> wrote:
> > This path series is a continuation of Eric Ju's (eric.peijian@gmail.com) and
s/path/patch
Show 44 quoted lines
> Calvin Wan's (calvinwan@google.com) patch series [1] and [2] respectively. > > Sometimes it is beneficial to retrieve information about an object without > having to download it completely. The server logic for retrieving size has > already been implemented and merged in "a2ba162cda (object-info: support for > retrieving object info, 2021-04-20)"[3]. This patch series implement the client > option for it. > > Eric's series adds the `remote-object-info` command to > `cat-file --batch-command`. This command allows the client to make an > object-info command request to a server that supports protocol v2. > > If the server uses protocol v2 but does not support the object-info capability, > `cat-file --batch-command` will die. > > If a user attempts to use `remote-object-info` with protocol v1, > `cat-file --batch-command` will die. > > Currently, only the size (%(objectsize)) is supported end to end in this > implementation. The type (%(objecttype)) is known by the client's allow-list > and request path but is not supported on the server side nor the response > parsing. A follow up series will add full end-to-end support for %(objecttype). > > The default format for remote-object-info is set to %(objectname) %(objectsize). > Once %(objecttype) is supported, the default format will be unified accordingly. > > If the batch command format includes unsupported fields such as %(objecttype), > %(objectsize:disk), or %(deltabase), the command will return empty strings for > each unsupported field. > > This series completes Eric's work mainly with the refactor of the validation > of the placeholder with an allow-list that filters what the client asks with > what the server is capable of provide following Jeff King's idea [4]. > > I have a question for the design: > > 1. If the format includes unsupported fields such as %(objecttype) or > %(deltabase) it currently returns an empty string for each unsupported > field, this follows what for-each-ref does with known but inapplicable > atoms. However future placeholders that will be implemented: %(rest), > %(objectmode) can return empty strings. How should we differentiate > "unsupported" vs "no data". > Eric proposed to use a placeholder like "???" [5]. > Should a placeholder be used?
Maybe it's best to fail cleanly if the user requests an unsupported atom? I don't really like the placeholder idea though. If a placeholder like "???" is introduced, any script/test parsing the output must add explicit logic to check for literal question marks, and that sounds flaky. Not to mention some atom's response may legitimately contain "???".
Show 9 quoted lines
> 2. _tangent/not related with this series_ > 'a2ba162cda' is designed to only work with full OIDs, which is > inconsistent with local `info` that does support short OIDs and in > case of being ambiguous returns a list of what possibly the user meant. > > Because V2 protocol is thought to be stateless supporting short OIDs > could become more inconsistent with other remote commands that do not > support short OIDs. Maybe a --pick-first option? That does accept > short oids and picks the first match.
We might return the wrong object's info if we do this. With the server giving us no information to verify whether the returned value _really_ corresponds to our intended object, I'd say this isn't the right choice.
> Alternatively, would sending a list of possible OIDs to the client so > it can re-request with the correct one be ok?
As far as I know, disambiguation like this is treated purely as a local UI convenience in Git, never a network-level operation.
`fetch` already requires users to input exact, full OIDs for their `want` lines (obtained via a prior `ls-remote` or ref advertisement), and dies if one isn't provided. Thus, I think erroring out is fine here.