Hi, Ævar, Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 于2022年7月29日周五 14:33写道: > > > On Thu, Jul 28 2022, Calvin Wan wrote: > > > Since the `info` command in cat-file --batch-command prints object info > > for a given object, it is natural to add another command in cat-file > > --batch-command to print object info for a given object from a remote. > > Is it ?:) > > > Add `remote-object-info` to cat-file --batch-command. > > I realize this bit of implementation changed in v4, i.e. it used to be > in "fetch", and I'm happy to have it moved out of there, we don't need > to overload it more. > > But I remember thinking (and perhaps commenting on-list, I can't > remember) that the "object-info" server verb was a bit odd at the time > that it was implemented. I understand the motivation, but surely it was > stumbling its way towards being something more generic, i.e. being able > to just expose cmd_cat_file() in some form. > > Which is one of the goals I've had in mind with working on fixing memory > leaks in various places, i.e. once you get common commands to clean up > after themselves it usually becomes to have a "command server". > Now I'm starting to agree with you on this: Maybe now git doesn't have a good interface to execute normal git commands (except git-upload-pack, git-receive-pack...) on remote git server. This patch wants to get remote object-info by the git-upload-pack interface. But this thing can easily work by some RPC server e.g. Gitaly in Gitlab. I don't know if git itself has the need to reimplement these remote calls In some secure environment?... Is it perhaps possible to get better performance and versatility than Gitaly? I donno. > So (and I don't mind if this is longer term, just asking), is there a > reason for why we wouldn't want to do away with object-info and this > "cat-file talks to a remote", in favor of just having support for > invoking arbitrary commands from a remote. > > Of course that set of allowed RCE commands would be zero by default, but > if we had some way to define tha "cat-file" was allowed to be called, > and only if you invoked: > > cat-file --batch="%(objectsize)" > > Or whatever, but over the v2 protocol, wouldn't we basically have > object-info in a more roundabout way? ZheNing Hu