Re: [PATCH v11 8/8] cat-file: add remote-object-info to batch-command
- From
Jeff King <peff@peff.net>
- Date
- Feb 24, 2025, 23:47 UTC
- Message-ID
- <20250224234720.GC729825@coredump.intra.peff.net>
- In-Reply-To
- <20250221190451.12536-9-eric.peijian@gmail.com>
On Fri, Feb 21, 2025 at 02:04:49PM -0500, Eric Ju wrote:
Show 10 quoted lines
> +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