On Fri, Feb 21, 2025 at 02:04:49PM -0500, Eric Ju wrote:
+static int get_remote_info(struct batch_options *opt, int argc, const char **argv)
[...]
+ if (gtransport->smart_options) {
+ CALLOC_ARRAY(remote_object_info, object_info_oids.nr);
+ gtransport->smart_options->object_info = 1;
+ gtransport->smart_options->object_info_oids = &object_info_oids;
+
+ /* 'objectsize' is the only option currently supported */
+ if (!strstr(opt->format, "%(objectsize)"))
+ die(_("%s is currently not supported with remote-object-info"), opt->format);
BTW, this strstr() isn't quite sufficient to prevent problems, as it
would not find placeholders which _do_ exist but which aren't handled.
One of the first things I tried was:
git cat-file --batch-command='%(objecttype) %(objectsize)'
and feeding it "remote-object-info /path/to/repo some-oid". And it
segfaulted.
-Peff