Thread (361 messages) 361 messages, 13 authors, 2d ago

Re: [PATCH v11 8/8] cat-file: add remote-object-info to batch-command

From: Jeff King <hidden>
Date: 2025-02-24 23:47:22

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help