{"thread":{"id":"66674","subject":"[PATCH RFC 0/3] cat-file: make remote-object-info request in batches","startedAt":"2026-10-27T03:16:50Z","lastAt":"2026-10-28T13:42:27Z","messageCount":12,"participants":["Pablo Sabater","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"556421","messageId":"20261027-remote-object-info-batch-v1-0-ea7a1f0b1df1@gmail.com","threadId":"66674","inReplyTo":null,"subject":"[PATCH RFC 0/3] cat-file: make remote-object-info request in batches","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-27T03:16:50Z","receivedAt":"2026-10-27T03:16:50Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"Currently the command remote-object-info of git cat-file has a hard\nlimit of 10k OIDs to query in the same command. So, if you want to query\n100k objects for example you would have to run the command 10 times.\n\nThis seemed strange to me because git backfill for example has a\ndefault limit of 50k objects and backfill fetches full objects, while\nremote-object-info only requests metadata (size, type, both or none) so\nit should be able to handle at least the same, if not more.\n\nEven if we kept the 10k OID limit for remote-object-info, it is annoying\nhaving to run the command multiple times, so I propose to allow as many\nOIDs as wanted and batch them internally.\n\nRegarding which number of objects should be the limit, I benchmarked\ndifferent batch sizes over a simulated 47ms RTT (details in patch 2):\n\n+------------+---------------------+\n|            | objects requested   |\n| batch size |   100k   |   400k   |\n+------------+----------+----------+\n| 10k        |  1.691s  |  5.862s  |\n| 50k        |  0.981s  |  2.397s  |\n| 100k       |  0.915s  |  2.058s  |\n| 200k       |  0.924s  |  1.889s  |\n| 400k       |  0.908s  |  1.820s  |\n+------------+----------+----------+\n\nA noticeable difference can be seen from a 10k OID batch to a 50k batch.\nAfter that the difference isn't as noticeable (the number of batches to\nbe requested isn't that big).\n\nI propose 50k OIDs as the default number of OIDs for the\nremote-object-info batches. Coincidentally, git backfill's default batch\nsize is 50k as well though it's unrelated.\n\nI have barely done any benchmarking before, so I would appreciate\nany feedback on the one in patch 2. Is there a better way to do it,\nor other things I should take into account?\n\nShould the server also check for a limit on the number of OIDs it\naccepts in a single object-info request?\n\nGitHub CI passed:\nhttps://github.com/pabloosabaterr/git/actions/runs/40424912154\n\nSigned-off-by: Pablo Sabater <pabloosabaterr@gmail.com>\n---\nPablo Sabater (3):\n      cat-file: extract the transport ownership from get_remote_info()\n      cat-file: make remote-object-info request in batches\n      cat-file: add --remote-max-batch option\n\n Documentation/git-cat-file.adoc        |  16 ++-\n builtin/cat-file.c                     | 174 +++++++++++++++++++--------------\n t/t1017-cat-file-remote-object-info.sh |  68 +++++++++++++\n transport-helper.c                     |  13 ++-\n transport-internal.h                   |   6 +-\n transport.c                            |  33 +++----\n transport.h                            |   6 +-\n 7 files changed, 208 insertions(+), 108 deletions(-)\n\n\n---\nbase-commit: 37b3475fb530c14109211faca33716a173db61ed\nchange-id: 20261015-remote-object-info-batch-c65f13fb5a95\n\n\n"},{"id":"556422","messageId":"20261027-remote-object-info-batch-v1-1-ea7a1f0b1df1@gmail.com","threadId":"66674","inReplyTo":"20261027-remote-object-info-batch-v1-0-ea7a1f0b1df1@gmail.com","subject":"[PATCH RFC 1/3] cat-file: extract the transport ownership from get_remote_info()","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-27T03:16:51Z","receivedAt":"2026-10-27T03:16:51Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"get_remote_info() receives the name of the remote and from there it\nbuilds the transport and at the end closes it.\n\nTo be able to reuse the connection for multiple batches in a subsequent\ncommit, it is needed to extract that responsibility from\nget_remote_info() and instead have it in its caller,\nparse_cmd_remote_object_info(), which will handle the batches.\n\nWhile at it, rename the transport variable 'gtransport' to 'transport',\nas it looks like a global when it's not.\n\nget_remote_info() returns -1 when there are no smart options, or\notherwise the result of transport_fetch_object_info(), and its caller\ndies if the result is non-zero. Move the smart options check to its\ncaller and die directly in get_remote_info() if\ntransport_fetch_object_info() fails, so get_remote_info() can return\nvoid.\n\nAt the same time that the smart options check is moved, give it its own\nerror message, since \"failed to get object info from the remote\" used\nto cover both that case and a failure while requesting the object info.\n\nSigned-off-by: Pablo Sabater <pabloosabaterr@gmail.com>\n---\n builtin/cat-file.c | 61 +++++++++++++++++++++++++-----------------------------\n 1 file changed, 28 insertions(+), 33 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 8870a210ec..f7d75a026b 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -680,55 +680,36 @@ static void batch_one_object(const char *obj_name,\n \tobject_context_release(&ctx);\n }\n \n-static int get_remote_info(int argc,\n-\t\t\t   const char **argv,\n-\t\t\t   struct fetch_object_info_results *results,\n-\t\t\t   struct oid_array *object_info_oids)\n+static void get_remote_info(struct transport *transport,\n+\t\t\t    const char **objects,\n+\t\t\t    size_t nr,\n+\t\t\t    struct fetch_object_info_results *results,\n+\t\t\t    struct oid_array *object_info_oids)\n {\n-\tint retval = 0;\n-\tstruct remote *remote = NULL;\n \tstruct object_id oid;\n-\tstruct transport *gtransport;\n-\n-\tremote = remote_get(argv[0]);\n-\tif (!remote)\n-\t\tdie(_(\"must supply valid remote when using remote-object-info\"));\n \n \toid_array_clear(object_info_oids);\n-\tfor (size_t i = 1; i < argc; i++) {\n-\t\tif (get_oid_hex(argv[i], &oid)) {\n-\t\t\tsize_t len = strlen(argv[i]);\n+\tfor (size_t i = 0; i < nr; i++) {\n+\t\tif (get_oid_hex(objects[i], &oid)) {\n+\t\t\tsize_t len = strlen(objects[i]);\n \n \t\t\tif (len < the_hash_algo->hexsz && len >= 4) {\n \t\t\t\tsize_t j;\n \t\t\t\tfor (j = 0; j < len; j++)\n-\t\t\t\t\tif (!isxdigit(argv[i][j]))\n+\t\t\t\t\tif (!isxdigit(objects[i][j]))\n \t\t\t\t\t\tbreak;\n \t\t\t\tif (j == len)\n \t\t\t\t\tdie(_(\"remote-object-info does not support \"\n \t\t\t\t\t      \"short oids, %d characters required\"),\n \t\t\t\t\t    (int)the_hash_algo->hexsz);\n \t\t\t}\n-\t\t\tdie(_(\"not a valid object name '%s'\"), argv[i]);\n+\t\t\tdie(_(\"not a valid object name '%s'\"), objects[i]);\n \t\t}\n \t\toid_array_append(object_info_oids, &oid);\n \t}\n \n-\tif (!object_info_oids->nr)\n-\t\tdie(_(\"remote-object-info requires objects\"));\n-\n-\tgtransport = transport_get(remote, NULL);\n-\n-\tif (!gtransport->smart_options) {\n-\t\tretval = -1;\n-\t\tgoto cleanup;\n-\t}\n-\n-\tretval = transport_fetch_object_info(gtransport, object_info_oids,\n-\t\t\t\t\t     results);\n-cleanup:\n-\ttransport_disconnect(gtransport);\n-\treturn retval;\n+\tif (transport_fetch_object_info(transport, object_info_oids, results))\n+\t\tdie(_(\"failed to get object info from the remote\"));\n }\n \n struct object_cb_data {\n@@ -824,6 +805,8 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \tchar *line_to_split;\n \tstruct fetch_object_info_results results = FETCH_OBJECT_INFO_RESULTS_INIT;\n \tstruct oid_array object_info_oids = OID_ARRAY_INIT;\n+\tstruct transport *transport;\n+\tstruct remote *remote;\n \n \tif (strlen(line) >= MAX_REMOTE_OBJ_INFO_LINE)\n \t\tdie(_(\"remote-object-info command too long\"));\n@@ -837,13 +820,23 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \t\tdie(_(\"remote-object-info supports at most %d objects\"),\n \t\t    MAX_ALLOWED_OBJ_LIMIT);\n \n+\tif (count < 2)\n+\t\tdie(_(\"remote-object-info requires objects\"));\n+\n \tif (data->info.sizep)\n \t\tresults.wants_size = 1;\n \tif (data->info.typep)\n \t\tresults.wants_type = 1;\n \n-\tif (get_remote_info(count, argv, &results, &object_info_oids))\n-\t\tdie(_(\"failed to get object info from the remote: %s\"), argv[0]);\n+\tremote = remote_get(argv[0]);\n+\tif (!remote)\n+\t\tdie(_(\"must supply valid remote when using remote-object-info\"));\n+\n+\ttransport = transport_get(remote, NULL);\n+\n+\tif (!transport->smart_options)\n+\t\tdie(_(\"smart options required\"));\n+\tget_remote_info(transport, argv + 1, count - 1, &results, &object_info_oids);\n \n \tstring_list_clear(&data->remote_allowed_atoms, 0);\n \tstring_list_append(&data->remote_allowed_atoms, \"objectname\");\n@@ -852,6 +845,8 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \tif (results.types)\n \t\tstring_list_append(&data->remote_allowed_atoms, \"objecttype\");\n \n+\ttransport_disconnect(transport);\n+\n \tdata->skip_object_info = 1;\n \tfor (size_t i = 0; i < results.nr; i++) {\n \t\tdata->oid = object_info_oids.oid[i];\n\n-- \n2.56.0\n\n\n"},{"id":"556423","messageId":"20261027-remote-object-info-batch-v1-2-ea7a1f0b1df1@gmail.com","threadId":"66674","inReplyTo":"20261027-remote-object-info-batch-v1-0-ea7a1f0b1df1@gmail.com","subject":"[PATCH RFC 2/3] cat-file: make remote-object-info request in batches","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-27T03:16:52Z","receivedAt":"2026-10-27T03:16:52Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"remote-object-info has a hard limit of a maximum of 10k OIDs per\ncommand, this means that if someone wants to request the object-info\nfrom +10k objects the user is the one who has to batch it.\n\nMake it more comfortable by allowing a user to put all the OIDs in a\nsingle remote-object-info command and then internally, let\nparse_cmd_remote_object_info() handle the batching.\n\nA default max batch size has been set to 50k OIDs. This number comes\nfrom benchmarking with hyperfine against a local git daemon serving a\nbare clone of git.git, requesting 100k and 400k OIDs taken from\n`rev-list --objects --all` with \"%(objectname) %(objectsize)\". A 47ms\ndelay (roughly my connect time to github.com) was added to\nclient-to-server traffic on port 9418 with dummynet, giving an RTT of\nabout 47ms:\n\n+------------+---------------------+\n|            | objects requested   |\n| batch size |   100k   |   400k   |\n+------------+----------+----------+\n| 10k        |  1.691s  |  5.862s  |\n| 50k        |  0.981s  |  2.397s  |\n| 100k       |  0.915s  |  2.058s  |\n| 200k       |  0.924s  |  1.889s  |\n| 400k       |  0.908s  |  1.820s  |\n+------------+----------+----------+\n\nTo request all the batches over the same connection, it must stay open\nbetween them. Currently, the connection to the remote is closed at two\nplaces:\n1. fetch_object_info_via_pack() at transport.c: finish_connect() is\n   called after fetching the object-info data.\n2. parse_cmd_remote_object_info() at cat-file.c: transport_disconnect()\n   is called right after get_remote_info().\n\nAbout 1, make fetch_object_info_via_pack() perform the handshake only\nonce and stop closing the connection, leaving that to\ntransport_disconnect() on its callers.\n\nAbout 2, move transport_disconnect() after the batching loop, so it\nonly disconnects from the remote after all the batches have been\nrequested.\n\nfetch_object_info() is void, so the only failure that\nfetch_object_info_via_pack() could report came from finish_connect().\nThe exit status of the remote process is no longer checked. Any failure\nwhile serving a batch is already caught by fetch_object_info(), either\nthrough an ERR packet or an unexpected EOF, before any output for that\nbatch is written. This matches how ls-remote treats the connection\nafter ls-refs.\n\nMake fetch_object_info_via_pack(), fetch_object_info_helper() and\ntransport_fetch_object_info() return void.\n\nSigned-off-by: Pablo Sabater <pabloosabaterr@gmail.com>\n---\n builtin/cat-file.c   | 87 ++++++++++++++++++++++++++--------------------------\n transport-helper.c   | 13 ++++----\n transport-internal.h |  6 ++--\n transport.c          | 33 +++++++++-----------\n transport.h          |  6 ++--\n 5 files changed, 69 insertions(+), 76 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex f7d75a026b..4f78194bbd 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -39,12 +39,7 @@\n  */\n #define MAX_REMOTE_URL_LEN (8 * 1024)\n \n-/* Maximum number of objects allowed in a single remote-object-info request. */\n-#define MAX_ALLOWED_OBJ_LIMIT 10000\n-\n-/* Maximum input size permitted for the remote-object-info command. */\n-#define MAX_REMOTE_OBJ_INFO_LINE \\\n-\t(MAX_REMOTE_URL_LEN + MAX_ALLOWED_OBJ_LIMIT * (GIT_MAX_HEXSZ + 1))\n+#define DEFAULT_REMOTE_BATCH_SIZE 50000\n \n enum batch_mode {\n \tBATCH_MODE_CONTENTS,\n@@ -708,8 +703,7 @@ static void get_remote_info(struct transport *transport,\n \t\toid_array_append(object_info_oids, &oid);\n \t}\n \n-\tif (transport_fetch_object_info(transport, object_info_oids, results))\n-\t\tdie(_(\"failed to get object info from the remote\"));\n+\ttransport_fetch_object_info(transport, object_info_oids, results);\n }\n \n struct object_cb_data {\n@@ -805,20 +799,15 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \tchar *line_to_split;\n \tstruct fetch_object_info_results results = FETCH_OBJECT_INFO_RESULTS_INIT;\n \tstruct oid_array object_info_oids = OID_ARRAY_INIT;\n+\tsize_t batch_size = DEFAULT_REMOTE_BATCH_SIZE;\n \tstruct transport *transport;\n \tstruct remote *remote;\n \n-\tif (strlen(line) >= MAX_REMOTE_OBJ_INFO_LINE)\n-\t\tdie(_(\"remote-object-info command too long\"));\n-\n \tline_to_split = xstrdup(line);\n \tcount = split_cmdline(line_to_split, &argv);\n \tif (count < 0)\n \t\tdie(_(\"remote-object-info: failed to parse command line: %s\"),\n \t\t    split_cmdline_strerror(count));\n-\tif (count - 1 > MAX_ALLOWED_OBJ_LIMIT)\n-\t\tdie(_(\"remote-object-info supports at most %d objects\"),\n-\t\t    MAX_ALLOWED_OBJ_LIMIT);\n \n \tif (count < 2)\n \t\tdie(_(\"remote-object-info requires objects\"));\n@@ -836,48 +825,58 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \n \tif (!transport->smart_options)\n \t\tdie(_(\"smart options required\"));\n-\tget_remote_info(transport, argv + 1, count - 1, &results, &object_info_oids);\n \n-\tstring_list_clear(&data->remote_allowed_atoms, 0);\n-\tstring_list_append(&data->remote_allowed_atoms, \"objectname\");\n-\tif (results.sizes)\n-\t\tstring_list_append(&data->remote_allowed_atoms, \"objectsize\");\n-\tif (results.types)\n-\t\tstring_list_append(&data->remote_allowed_atoms, \"objecttype\");\n+\tfor (size_t j = 0; j < count - 1; j += batch_size) {\n+\t\tconst char **objects = argv + 1 + j;\n+\t\tsize_t remaining = count - 1 - j;\n+\t\tsize_t objects_nr = batch_size < remaining ? batch_size : remaining;\n \n-\ttransport_disconnect(transport);\n+\t\tget_remote_info(transport, objects, objects_nr, &results, &object_info_oids);\n \n-\tdata->skip_object_info = 1;\n-\tfor (size_t i = 0; i < results.nr; i++) {\n-\t\tdata->oid = object_info_oids.oid[i];\n+\t\tstring_list_clear(&data->remote_allowed_atoms, 0);\n+\t\tstring_list_append(&data->remote_allowed_atoms, \"objectname\");\n+\t\tif (results.sizes)\n+\t\t\tstring_list_append(&data->remote_allowed_atoms, \"objectsize\");\n+\t\tif (results.types)\n+\t\t\tstring_list_append(&data->remote_allowed_atoms, \"objecttype\");\n \n-\t\tif (results.unrecognized[i]) {\n-\t\t\treport_object_status(opt, oid_to_hex(&data->oid),\n-\t\t\t\t\t     &data->oid, \"missing\");\n-\t\t\tcontinue;\n-\t\t}\n+\t\tdata->skip_object_info = 1;\n+\t\tfor (size_t i = 0; i < results.nr; i++) {\n+\t\t\tdata->oid = object_info_oids.oid[i];\n \n-\t\t/*\n-\t\t * When reaching here, it means remote-object-info can retrieve\n-\t\t * information from server without downloading them.\n-\t\t */\n-\t\tif (results.sizes)\n-\t\t\tdata->size = results.sizes[i];\n+\t\t\tif (results.unrecognized[i]) {\n+\t\t\t\treport_object_status(opt, oid_to_hex(&data->oid),\n+\t\t\t\t\t\t     &data->oid, \"missing\");\n+\t\t\t\tcontinue;\n+\t\t\t}\n \n-\t\tif (results.types)\n-\t\t\tdata->type = results.types[i];\n+\t\t\t/*\n+\t\t\t * When reaching here, it means remote-object-info can retrieve\n+\t\t\t * information from server without downloading them.\n+\t\t\t */\n+\t\t\tif (results.sizes)\n+\t\t\t\tdata->size = results.sizes[i];\n \n-\t\topt->batch_mode = BATCH_MODE_INFO;\n-\t\tdata->is_remote = 1;\n-\t\tbatch_object_write(argv[i + 1], output, opt, data, NULL, 0);\n-\t\tdata->is_remote = 0;\n+\t\t\tif (results.types)\n+\t\t\t\tdata->type = results.types[i];\n+\n+\t\t\topt->batch_mode = BATCH_MODE_INFO;\n+\t\t\tdata->is_remote = 1;\n+\t\t\tbatch_object_write(objects[i], output, opt, data, NULL, 0);\n+\t\t\tdata->is_remote = 0;\n+\t\t}\n+\t\tdata->skip_object_info = 0;\n+\t\tFREE_AND_NULL(results.sizes);\n+\t\tFREE_AND_NULL(results.types);\n+\t\tFREE_AND_NULL(results.unrecognized);\n+\t\tresults.nr = 0;\n+\t\toid_array_clear(&object_info_oids);\n \t}\n-\tdata->skip_object_info = 0;\n \n+\ttransport_disconnect(transport);\n \tfree_fetch_object_info_results(&results);\n \tfree(line_to_split);\n \tfree(argv);\n-\toid_array_clear(&object_info_oids);\n }\n \n static void dispatch_calls(struct batch_options *opt,\ndiff --git a/transport-helper.c b/transport-helper.c\nindex d5a064d386..dafe829b50 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -786,16 +786,15 @@ static int fetch_refs(struct transport *transport,\n \treturn -1;\n }\n \n-static int fetch_object_info_helper(struct transport *transport,\n-\t\t\t\t    const struct oid_array *oids,\n-\t\t\t\t    struct fetch_object_info_results *results)\n+static void fetch_object_info_helper(struct transport *transport,\n+\t\t\t\t     const struct oid_array *oids,\n+\t\t\t\t     struct fetch_object_info_results *results)\n {\n \tget_helper(transport);\n \tif (process_connect(transport, 0))\n-\t\treturn transport->vtable->fetch_object_info(transport, oids,\n-\t\t\t\t\t\t\t    results);\n-\n-\tdie(_(\"object-info requires protocol v2\"));\n+\t\ttransport->vtable->fetch_object_info(transport, oids, results);\n+\telse\n+\t\tdie(_(\"object-info requires protocol v2\"));\n }\n \n struct push_update_ref_state {\ndiff --git a/transport-internal.h b/transport-internal.h\nindex a10b27cc81..53ce86ed48 100644\n--- a/transport-internal.h\n+++ b/transport-internal.h\n@@ -53,9 +53,9 @@ struct transport_vtable {\n \t *\n \t * Uses object-info capability of v2 protocol.\n \t */\n-\tint (*fetch_object_info)(struct transport *transport,\n-\t\t\t\t const struct oid_array *oids,\n-\t\t\t\t struct fetch_object_info_results *results);\n+\tvoid (*fetch_object_info)(struct transport *transport,\n+\t\t\t\t  const struct oid_array *oids,\n+\t\t\t\t  struct fetch_object_info_results *results);\n \n \t/**\n \t * Push the objects and refs. Send the necessary objects, and\ndiff --git a/transport.c b/transport.c\nindex 25e2c14a7b..352540492c 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -433,11 +433,10 @@ static int get_bundle_uri(struct transport *transport)\n \t\t\t\t     transport->bundles, stateless_rpc);\n }\n \n-static int fetch_object_info_via_pack(struct transport *transport,\n-\t\t\t\t      const struct oid_array *oids,\n-\t\t\t\t      struct fetch_object_info_results *results)\n+static void fetch_object_info_via_pack(struct transport *transport,\n+\t\t\t\t       const struct oid_array *oids,\n+\t\t\t\t       struct fetch_object_info_results *results)\n {\n-\tint ret = 0;\n \tstruct git_transport_data *data = transport->data;\n \tstruct packet_reader reader;\n \n@@ -447,8 +446,13 @@ static int fetch_object_info_via_pack(struct transport *transport,\n \t\t\t   PACKET_READ_GENTLE_ON_EOF |\n \t\t\t   PACKET_READ_DIE_ON_ERR_PACKET);\n \n-\tdata->version = discover_version(&reader);\n-\ttransport->hash_algo = reader.hash_algo;\n+\tif (!data->finished_handshake) {\n+\t\tdata->version = discover_version(&reader);\n+\t\ttransport->hash_algo = reader.hash_algo;\n+\t\tdata->finished_handshake = 1;\n+\t} else {\n+\t\treader.hash_algo = transport->hash_algo;\n+\t}\n \n \tfetch_object_info(data->version,\n \t\t\t  transport->server_options,\n@@ -456,24 +460,15 @@ static int fetch_object_info_via_pack(struct transport *transport,\n \t\t\t  &reader,\n \t\t\t  results,\n \t\t\t  transport->stateless_rpc, data->fd[1]);\n-\n-\tclose(data->fd[0]);\n-\tif (data->fd[1] >= 0)\n-\t\tclose(data->fd[1]);\n-\tif (finish_connect(data->conn))\n-\t\tret = -1;\n-\tdata->conn = NULL;\n-\n-\treturn ret;\n }\n \n-int transport_fetch_object_info(struct transport *transport,\n-\t\t\t\tconst struct oid_array *oids,\n-\t\t\t\tstruct fetch_object_info_results *results)\n+void transport_fetch_object_info(struct transport *transport,\n+\t\t\t\t const struct oid_array *oids,\n+\t\t\t\t struct fetch_object_info_results *results)\n {\n \tif (!transport->vtable->fetch_object_info)\n \t\tdie(_(\"remote does not support object-info\"));\n-\treturn transport->vtable->fetch_object_info(transport, oids, results);\n+\ttransport->vtable->fetch_object_info(transport, oids, results);\n }\n \n static int fetch_refs_via_pack(struct transport *transport,\ndiff --git a/transport.h b/transport.h\nindex 39193d0077..c7f2b8b87f 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -314,9 +314,9 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs);\n /*\n  * Fetch the object info from remote\n  */\n-int transport_fetch_object_info(struct transport *transport,\n-\t\t\t\tconst struct oid_array *oids,\n-\t\t\t\tstruct fetch_object_info_results *results);\n+void transport_fetch_object_info(struct transport *transport,\n+\t\t\t\t const struct oid_array *oids,\n+\t\t\t\t struct fetch_object_info_results *results);\n \n /*\n  * If this flag is set, unlocking will avoid to call non-async-signal-safe\n\n-- \n2.56.0\n\n\n"},{"id":"556424","messageId":"20261027-remote-object-info-batch-v1-3-ea7a1f0b1df1@gmail.com","threadId":"66674","inReplyTo":"20261027-remote-object-info-batch-v1-0-ea7a1f0b1df1@gmail.com","subject":"[PATCH RFC 3/3] cat-file: add --remote-max-batch option","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-27T03:16:53Z","receivedAt":"2026-10-27T03:16:53Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"Now that remote-object-info works by requesting in batches, a user might\nnot want to use the default of 50k OIDs per batch.\n\nAdd a new --remote-max-batch option that changes the size of the\nbatches.\n\nSigned-off-by: Pablo Sabater <pabloosabaterr@gmail.com>\n---\n Documentation/git-cat-file.adoc        | 16 ++++++--\n builtin/cat-file.c                     | 46 ++++++++++++++++++++---\n t/t1017-cat-file-remote-object-info.sh | 68 ++++++++++++++++++++++++++++++++++\n 3 files changed, 121 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/git-cat-file.adoc b/Documentation/git-cat-file.adoc\nindex c4ea2524cf..a21a4d7fd4 100644\n--- a/Documentation/git-cat-file.adoc\n+++ b/Documentation/git-cat-file.adoc\n@@ -14,7 +14,7 @@ SYNOPSIS\n \t     [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]\n 'git cat-file' (--batch | --batch-check | --batch-command) [--batch-all-objects]\n \t     [--buffer] [--follow-symlinks] [--unordered]\n-\t     [--textconv | --filters] [-Z]\n+\t     [--textconv | --filters] [-Z] [--remote-max-batch=<n>]\n \n DESCRIPTION\n -----------\n@@ -143,8 +143,8 @@ are not of the requested type.\n --batch-command::\n --batch-command=<format>::\n \tEnter a command mode that reads commands and arguments from stdin. May\n-\tonly be combined with `--buffer`, `--textconv`, `--use-mailmap` or\n-\t`--filters`.\n+\tonly be combined with `--buffer`, `--textconv`, `--use-mailmap`,\n+\t`--filters` or `--remote-max-batch`.\n +\n --\n \t* When used with `--textconv` or `--filters`, the input lines must\n@@ -174,6 +174,9 @@ remote-object-info <remote> <object>...::\n \t`<remote>` without downloading objects from the remote.\n \tRaise an error when the `object-info` capability is not supported by the remote.\n \tRaise an error when no object references are provided.\n+\tThere is no limit on the number of objects; they are requested from\n+\tthe remote in batches over a single connection, see\n+\t`--remote-max-batch`.\n \tThis command may be combined with `--buffer`.\n \n flush::\n@@ -215,6 +218,13 @@ flush::\n \tonly once, even if it is stored multiple times in the\n \trepository.\n \n+--remote-max-batch=<n>::\n+\tMaximum number of objects that `remote-object-info` asks for in a\n+\tsingle `object-info` request. If a `remote-object-info` command is\n+\tgiven more objects, the rest are requested in further batches over\n+\tthe same connection. `<n>` must be a positive integer. Defaults\n+\tto 50000. Requires `--batch-command`.\n+\n --follow-symlinks::\n \tWith `--batch` or `--batch-check`, follow symlinks inside the\n \trepository when requesting objects with extended SHA-1\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 4f78194bbd..ca2122c67b 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -59,6 +59,8 @@ struct batch_options {\n \tchar input_delim;\n \tchar output_delim;\n \tconst char *format;\n+\tsize_t remote_max_batch;\n+\tunsigned custom_object_info_batch;\n };\n \n static const char *force_path;\n@@ -799,9 +801,9 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \tchar *line_to_split;\n \tstruct fetch_object_info_results results = FETCH_OBJECT_INFO_RESULTS_INIT;\n \tstruct oid_array object_info_oids = OID_ARRAY_INIT;\n-\tsize_t batch_size = DEFAULT_REMOTE_BATCH_SIZE;\n \tstruct transport *transport;\n \tstruct remote *remote;\n+\tsize_t object_nr;\n \n \tline_to_split = xstrdup(line);\n \tcount = split_cmdline(line_to_split, &argv);\n@@ -811,6 +813,7 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \n \tif (count < 2)\n \t\tdie(_(\"remote-object-info requires objects\"));\n+\tobject_nr = (size_t)count - 1;\n \n \tif (data->info.sizep)\n \t\tresults.wants_size = 1;\n@@ -826,12 +829,16 @@ static void parse_cmd_remote_object_info(struct batch_options *opt,\n \tif (!transport->smart_options)\n \t\tdie(_(\"smart options required\"));\n \n-\tfor (size_t j = 0; j < count - 1; j += batch_size) {\n+\tfor (size_t j = 0; j < object_nr; j += opt->remote_max_batch) {\n \t\tconst char **objects = argv + 1 + j;\n-\t\tsize_t remaining = count - 1 - j;\n-\t\tsize_t objects_nr = batch_size < remaining ? batch_size : remaining;\n+\t\tsize_t objects_in_batch_nr;\n \n-\t\tget_remote_info(transport, objects, objects_nr, &results, &object_info_oids);\n+\t\tif (opt->remote_max_batch < object_nr - j)\n+\t\t\tobjects_in_batch_nr = opt->remote_max_batch;\n+\t\telse\n+\t\t\tobjects_in_batch_nr = object_nr - j;\n+\n+\t\tget_remote_info(transport, objects, objects_in_batch_nr, &results, &object_info_oids);\n \n \t\tstring_list_clear(&data->remote_allowed_atoms, 0);\n \t\tstring_list_append(&data->remote_allowed_atoms, \"objectname\");\n@@ -1145,6 +1152,24 @@ static int git_cat_file_config(const char *var, const char *value,\n \treturn git_default_config(var, value, ctx, cb);\n }\n \n+static int set_remote_batch_size(const struct option *opt,\n+\t\t\t\t const char *arg,\n+\t\t\t\t int unset)\n+{\n+\tstruct batch_options *bo = opt->value;\n+\tsize_t n;\n+\n+\tBUG_ON_OPT_NEG(unset);\n+\n+\tif (!git_parse_size_t(arg, &n) || !n)\n+\t\treturn error(_(\"%s expects a positive number\"), opt->long_name);\n+\n+\tbo->remote_max_batch = n;\n+\tbo->custom_object_info_batch = 1;\n+\n+\treturn 0;\n+}\n+\n static int batch_option_callback(const struct option *opt,\n \t\t\t\t const char *arg,\n \t\t\t\t int unset)\n@@ -1184,6 +1209,7 @@ int cmd_cat_file(int argc,\n \tconst char *exp_type = NULL, *obj_name = NULL;\n \tstruct batch_options batch = {\n \t\t.objects_filter = LIST_OBJECTS_FILTER_INIT,\n+\t\t.remote_max_batch = DEFAULT_REMOTE_BATCH_SIZE,\n \t};\n \tint unknown_type = 0;\n \tint input_nul_terminated = 0;\n@@ -1197,7 +1223,7 @@ int cmd_cat_file(int argc,\n \t\t   \"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]\"),\n \t\tN_(\"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-objects]\\n\"\n \t\t   \"             [--buffer] [--follow-symlinks] [--unordered]\\n\"\n-\t\t   \"             [--textconv | --filters] [-Z]\"),\n+\t\t   \"             [--textconv | --filters] [-Z] [--remote-max-batch=<n>]\"),\n \t\tNULL\n \t};\n \tconst struct option options[] = {\n@@ -1240,6 +1266,9 @@ int cmd_cat_file(int argc,\n \t\t\t N_(\"follow in-tree symlinks\")),\n \t\tOPT_BOOL(0, \"unordered\", &batch.unordered,\n \t\t\t N_(\"do not order objects before emitting them\")),\n+\t\tOPT_CALLBACK_F(0, \"remote-max-batch\", &batch, N_(\"n\"),\n+\t\t\t       N_(\"set a custom object-info batch size\"),\n+\t\t\t       PARSE_OPT_NONEG, set_remote_batch_size),\n \t\t/* Textconv options, stand-ole*/\n \t\tOPT_GROUP(N_(\"Emit object (blob or tree) with conversion or filter (stand-alone, or with batch)\")),\n \t\tOPT_CMDMODE(0, \"textconv\", &opt,\n@@ -1307,6 +1336,11 @@ int cmd_cat_file(int argc,\n \t\tusage_msg_optf(_(\"'%s' requires a batch mode\"), builtin_catfile_usage,\n \t\t\t       options, \"-Z\");\n \n+\tif (batch.custom_object_info_batch &&\n+\t    batch.batch_mode != BATCH_MODE_QUEUE_AND_DISPATCH)\n+\t\tusage_msg_optf(_(\"'%s' requires '%s'\"), builtin_catfile_usage,\n+\t\t\t       options, \"--remote-max-batch\", \"--batch-command\");\n+\n \tbatch.input_delim = batch.output_delim = '\\n';\n \tif (input_nul_terminated)\n \t\tbatch.input_delim = '\\0';\ndiff --git a/t/t1017-cat-file-remote-object-info.sh b/t/t1017-cat-file-remote-object-info.sh\nindex e2919aa061..75624a9498 100755\n--- a/t/t1017-cat-file-remote-object-info.sh\n+++ b/t/t1017-cat-file-remote-object-info.sh\n@@ -61,6 +61,18 @@ set_transport_variables () {\n # Since \"%(objecttype)\" is currently not supported by the command remote-object-info ,\n # the filters are set to \"%(objectname) %(objectsize)\" in some test cases.\n \n+test_expect_success '--remote-max-batch rejects zero and non-numbers' '\n+\ttest_must_fail git cat-file --batch-command --remote-max-batch=0 </dev/null 2>err &&\n+\ttest_grep \"remote-max-batch expects a positive number\" err &&\n+\ttest_must_fail git cat-file --batch-command --remote-max-batch=foo </dev/null 2>err &&\n+\ttest_grep \"remote-max-batch expects a positive number\" err\n+'\n+\n+test_expect_success '--remote-max-batch requires --batch-command' '\n+\ttest_must_fail git cat-file --batch-check --remote-max-batch=2 </dev/null 2>err &&\n+\ttest_grep \"requires .--batch-command.\" err\n+'\n+\n # Test --batch-command remote-object-info with 'git://' transport with\n # transfer.advertiseobjectinfo set to true, i.e. server has object-info capability\n . \"$TEST_DIRECTORY\"/lib-git-daemon.sh\n@@ -134,6 +146,25 @@ test_expect_success 'batch-command remote-object-info git:// multiple sha1 per l\n \t)\n '\n \n+test_expect_success 'remote-object-info git:// across batch boundaries' '\n+\t(\n+\t\tset_transport_variables \"$daemon_parent\" &&\n+\t\tcd \"$daemon_parent/daemon_client_empty\" &&\n+\n+\t\techo \"$hello_oid $hello_size\" >expect &&\n+\t\techo \"$tree_oid $tree_size\" >>expect &&\n+\t\techo \"$unstored_oid missing\" >>expect &&\n+\t\techo \"$commit_oid $commit_size\" >>expect &&\n+\t\techo \"$tag_oid $tag_size\" >>expect &&\n+\n+\t\tgit cat-file --batch-command=\"%(objectname) %(objectsize)\" \\\n+\t\t\t--remote-max-batch=2 >actual <<-EOF &&\n+\t\tremote-object-info \"$GIT_DAEMON_URL/parent\" $hello_oid $tree_oid $unstored_oid $commit_oid $tag_oid\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n test_expect_success 'batch-command remote-object-info git:// default filter' '\n \t(\n \t\tset_transport_variables \"$daemon_parent\" &&\n@@ -461,6 +492,25 @@ test_expect_success 'batch-command remote-object-info file:// default filter' '\n \t)\n '\n \n+test_expect_success 'remote-object-info file:// with objects a multiple of the batch size' '\n+\t(\n+\t\tset_transport_variables \"server\" &&\n+\t\tserver_path=\"$(pwd)/server\" &&\n+\t\tcd file_client_empty &&\n+\n+\t\techo \"$hello_oid $hello_size\" >expect &&\n+\t\techo \"$tree_oid $tree_size\" >>expect &&\n+\t\techo \"$commit_oid $commit_size\" >>expect &&\n+\t\techo \"$tag_oid $tag_size\" >>expect &&\n+\n+\t\tgit cat-file --batch-command=\"%(objectname) %(objectsize)\" \\\n+\t\t\t--remote-max-batch=2 >actual <<-EOF &&\n+\t\tremote-object-info \"file://${server_path}\" $hello_oid $tree_oid $commit_oid $tag_oid\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n test_expect_success 'batch-command -Z remote-object-info file:// default filter' '\n \t(\n \t\tset_transport_variables \"server\" &&\n@@ -741,6 +791,24 @@ test_expect_success 'remote-object-info fails on not providing OID' '\n \t)\n '\n \n+test_expect_success 'remote-object-info http:// across batch boundaries' '\n+\t(\n+\t\tset_transport_variables \"$HTTPD_DOCUMENT_ROOT_PATH/http_parent\" &&\n+\t\tcd \"$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty\" &&\n+\n+\t\techo \"$hello_oid $hello_size\" >expect &&\n+\t\techo \"$tree_oid $tree_size\" >>expect &&\n+\t\techo \"$unstored_oid missing\" >>expect &&\n+\t\techo \"$commit_oid $commit_size\" >>expect &&\n+\t\techo \"$tag_oid $tag_size\" >>expect &&\n+\n+\t\tgit cat-file --batch-command=\"%(objectname) %(objectsize)\" \\\n+\t\t\t--remote-max-batch=2 >actual <<-EOF &&\n+\t\tremote-object-info \"$HTTPD_URL/smart/http_parent\" $hello_oid $tree_oid $unstored_oid $commit_oid $tag_oid\n+\t\tEOF\n+\t\ttest_cmp expect actual\n+\t)\n+'\n \n # Test --batch-command remote-object-info with 'http://' transport and\n # transfer.advertiseobjectinfo set to false, i.e. server does not have object-info capability\n\n-- \n2.56.0\n\n\n"},{"id":"556560","messageId":"xmqqpkwvj7bj.fsf@gitster.g","threadId":"66674","inReplyTo":"20261027-remote-object-info-batch-v1-1-ea7a1f0b1df1@gmail.com","subject":"Re: [PATCH RFC 1/3] cat-file: extract the transport ownership from get_remote_info()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-27T19:02:08Z","receivedAt":"2026-10-27T19:02:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pablo Sabater <pabloosabaterr@gmail.com> writes:\n\n> get_remote_info() receives the name of the remote and from there it\n> builds the transport and at the end closes it.\n>\n> To be able to reuse the connection for multiple batches in a subsequent\n> commit, it is needed to extract that responsibility from\n> get_remote_info() and instead have it in its caller,\n> parse_cmd_remote_object_info(), which will handle the batches.\n\nMakes sense.\n\n> While at it, rename the transport variable 'gtransport' to 'transport',\n> as it looks like a global when it's not.\n\nGood move.  We started (not particularly this program but the\ntransport layer in general) with a global instance of transport\nobject called gtransport, but the ones that we create on demand and\nrelease after we are done are of course local and it is misleading\nto use such a prefix.\n\n> +\tif (!transport->smart_options)\n> +\t\tdie(_(\"smart options required\"));\n\nIs this an end-user facing error message?  I am not sure a user who\nsaw this message can figure out what went wrong or how to correct\nit.\n\n\n"},{"id":"556561","messageId":"xmqqld7jj6u5.fsf@gitster.g","threadId":"66674","inReplyTo":"20261027-remote-object-info-batch-v1-0-ea7a1f0b1df1@gmail.com","subject":"Re: [PATCH RFC 0/3] cat-file: make remote-object-info request in batches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-27T19:12:34Z","receivedAt":"2026-10-27T19:12:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pablo Sabater <pabloosabaterr@gmail.com> writes:\n\n> A noticeable difference can be seen from a 10k OID batch to a 50k batch.\n> After that the difference isn't as noticeable (the number of batches to\n> be requested isn't that big).\n>\n> I propose 50k OIDs as the default number of OIDs for the\n> remote-object-info batches. Coincidentally, git backfill's default batch\n> size is 50k as well though it's unrelated.\n\nInteresting.  We cannot share any code with backfill as we only\nretrieve info on objects while backfill does grab the objects\nthemselves, but using the same number may make it easy to explain in\nthe documentation.\n\n> I have barely done any benchmarking before, so I would appreciate\n> any feedback on the one in patch 2. Is there a better way to do it,\n> or other things I should take into account?\n>\n> Should the server also check for a limit on the number of OIDs it\n> accepts in a single object-info request?\n\nWhat I am more curious about is how this updated code interacts with\nexisting code (i.e., updated \"cat-file --batch\" clients with deployed\nservers, and vice versa).\n\n"},{"id":"556577","messageId":"DMFWYZSCTM1C.ZM3OE2DGCMPC@gmail.com","threadId":"66674","inReplyTo":"xmqqld7jj6u5.fsf@gitster.g","subject":"Re: [PATCH RFC 0/3] cat-file: make remote-object-info request in batches","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-27T20:47:32Z","receivedAt":"2026-10-27T20:47:32Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"On Tue Oct 27, 2026 at 7:12 PM WET, Junio C Hamano wrote:\n> Pablo Sabater <pabloosabaterr@gmail.com> writes:\n>\n>> A noticeable difference can be seen from a 10k OID batch to a 50k batch.\n>> After that the difference isn't as noticeable (the number of batches to\n>> be requested isn't that big).\n>>\n>> I propose 50k OIDs as the default number of OIDs for the\n>> remote-object-info batches. Coincidentally, git backfill's default batch\n>> size is 50k as well though it's unrelated.\n>\n> Interesting.  We cannot share any code with backfill as we only\n> retrieve info on objects while backfill does grab the objects\n> themselves, but using the same number may make it easy to explain in\n> the documentation.\n>\n>> I have barely done any benchmarking before, so I would appreciate\n>> any feedback on the one in patch 2. Is there a better way to do it,\n>> or other things I should take into account?\n>>\n>> Should the server also check for a limit on the number of OIDs it\n>> accepts in a single object-info request?\n>\n> What I am more curious about is how this updated code interacts with\n> existing code (i.e., updated \"cat-file --batch\" clients with deployed\n> servers, and vice versa).\n\nThe code in this series only changes the client side, the server has\nno OID limit. Before this series, what prevented large requests was the\nclient with its 10k hard limit, so the server is fine with any size\nwithout any change.\n\nThe server will see requests of at most 10k OIDs from old clients, and\nbigger ones from new clients.\n\nThe other change compared to an older client is that now multiple\nrequests can be received on the same connection (instead of one per\nconnection), but that should be fine, serve() keeps processing requests\nuntil EOF.\n\nWith this new option there's a risk (that was already there if someone\nmodified their client) of setting a huge amount of OIDs in the same\nrequest, but I'm not sure how bad that is, a 1M OID request vs smaller\nones on the same connection. Could you help me with this?\n\nAnyway, the fix would be to add a cap on the server side. It can't be\nlower than 10k, or older clients would get an error they can't do\nanything about, and if it's lower than the client's batch size it\nshould be advertised so newer clients can adapt.\n\nIIRC clients ignore unknown capability keys, so advertising it shouldn't\nbreak older ones. In this case, it would be advertised on the handshake\nand the client would die() if the user sets a batch size bigger than\nwhat the server advertises. Ideally the default on the client (the\nproposed 50k) would be the min cap on the server, so someone that\ndoesn't manually set the batch size and uses the default value doesn't\nget an error.\n\nIf we don't even want to die() we could set the batch size as:\n\tmin(user-size, advertised-size)\n\nSorry for the brainstorm but I just realised that any client could\nmodify the size and that a cap on the server side could be important.\n\nRegards,\nPablo\n\n"},{"id":"556578","messageId":"xmqq8q3ij25l.fsf@gitster.g","threadId":"66674","inReplyTo":"DMFWYZSCTM1C.ZM3OE2DGCMPC@gmail.com","subject":"Re: [PATCH RFC 0/3] cat-file: make remote-object-info request in batches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-27T20:53:42Z","receivedAt":"2026-10-27T20:53:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Pablo Sabater\" <pabloosabaterr@gmail.com> writes:\n\n> Sorry for the brainstorm but I just realised that any client could\n> modify the size and that a cap on the server side could be important.\n\nNo need to be sorry.  A major role of review comments is to help us\nthink how we can improve the system, including but not necessarily\nlimited to the changes proposed by the reviewed topic.\n\n"},{"id":"556581","messageId":"DMFX8JPX16W8.9VBEJMQVF998@gmail.com","threadId":"66674","inReplyTo":"xmqqpkwvj7bj.fsf@gitster.g","subject":"Re: [PATCH RFC 1/3] cat-file: extract the transport ownership from get_remote_info()","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-27T21:00:01Z","receivedAt":"2026-10-27T21:00:01Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"On Tue Oct 27, 2026 at 7:02 PM WET, Junio C Hamano wrote:\n> Pablo Sabater <pabloosabaterr@gmail.com> writes:\n>\n>> get_remote_info() receives the name of the remote and from there it\n>> builds the transport and at the end closes it.\n>>\n>> To be able to reuse the connection for multiple batches in a subsequent\n>> commit, it is needed to extract that responsibility from\n>> get_remote_info() and instead have it in its caller,\n>> parse_cmd_remote_object_info(), which will handle the batches.\n>\n> Makes sense.\n>\n>> While at it, rename the transport variable 'gtransport' to 'transport',\n>> as it looks like a global when it's not.\n>\n> Good move.  We started (not particularly this program but the\n> transport layer in general) with a global instance of transport\n> object called gtransport, but the ones that we create on demand and\n> release after we are done are of course local and it is misleading\n> to use such a prefix.\n>\n>> +\tif (!transport->smart_options)\n>> +\t\tdie(_(\"smart options required\"));\n>\n> Is this an end-user facing error message?  I am not sure a user who\n> saw this message can figure out what went wrong or how to correct\n> it.\n\nI thought it would be better to say why it fails instead of a generic\nerror. If we drop the check it will die() later with \"remote does not\nsupport object-info\".\n\nSince the smart options check only die()s when the remote is a bundle,\nI could keep it and change the message to \"object-info is not supported\non bundles\".\n\nRegards,\nPablo\n\n"},{"id":"556602","messageId":"xmqqbj8ee3g1.fsf@gitster.g","threadId":"66674","inReplyTo":"DMFX8JPX16W8.9VBEJMQVF998@gmail.com","subject":"Re: [PATCH RFC 1/3] cat-file: extract the transport ownership from get_remote_info()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-28T06:37:02Z","receivedAt":"2026-10-28T06:37:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Pablo Sabater\" <pabloosabaterr@gmail.com> writes:\n\n>>> +\tif (!transport->smart_options)\n>>> +\t\tdie(_(\"smart options required\"));\n>>\n>> Is this an end-user facing error message?  I am not sure a user who\n>> saw this message can figure out what went wrong or how to correct\n>> it.\n>\n> I thought it would be better to say why it fails instead of a generic\n> error. If we drop the check it will die() later with \"remote does not\n> support object-info\".\n>\n> Since the smart options check only die()s when the remote is a bundle,\n> I could keep it and change the message to \"object-info is not supported\n> on bundles\".\n\nI am somewhat torn on this.  It is certainly much better than the\n\"smart options required\" message, which the end user would not know\nhow to act upon.  However, that improvement only holds until we gain\nanother transport other than bundle that also lacks support for\n\"smart options\".  Saying something like \"object-info is not\nsupported by this remote.\" would avoid blindly mentioning \"bundle\"\nwhen the remote that lacks object-info support is actually not a\nbundle, but it loses the clarity your rewritten message provides\nwhen the problematic remote indeed is a bundle.\n\nDo we have the remote information at this point in the code (i.e., the\nURL of the remote that was given to the remote-object-info command)\nthat the user would immediately recognize as the remote they asked\nthe command to access?  If so, \"object-info is not supported by %s\"\nfilled with the remote information would probably work better.\n\nThanks.\n\n\n\n"},{"id":"556657","messageId":"DMGGJIMVUXEG.WJSWR3E4POW1@gmail.com","threadId":"66674","inReplyTo":"xmqqbj8ee3g1.fsf@gitster.g","subject":"Re: [PATCH RFC 1/3] cat-file: extract the transport ownership from get_remote_info()","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-10-28T12:07:42Z","receivedAt":"2026-10-28T12:07:42Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/63864637?v=4"},"body":"On Wed Oct 28, 2026 at 6:37 AM WET, Junio C Hamano wrote:\n> \"Pablo Sabater\" <pabloosabaterr@gmail.com> writes:\n>\n>>>> +\tif (!transport->smart_options)\n>>>> +\t\tdie(_(\"smart options required\"));\n>>>\n>>> Is this an end-user facing error message?  I am not sure a user who\n>>> saw this message can figure out what went wrong or how to correct\n>>> it.\n>>\n>> I thought it would be better to say why it fails instead of a generic\n>> error. If we drop the check it will die() later with \"remote does not\n>> support object-info\".\n>>\n>> Since the smart options check only die()s when the remote is a bundle,\n>> I could keep it and change the message to \"object-info is not supported\n>> on bundles\".\n>\n> I am somewhat torn on this.  It is certainly much better than the\n> \"smart options required\" message, which the end user would not know\n> how to act upon.  However, that improvement only holds until we gain\n> another transport other than bundle that also lacks support for\n> \"smart options\".  Saying something like \"object-info is not\n> supported by this remote.\" would avoid blindly mentioning \"bundle\"\n> when the remote that lacks object-info support is actually not a\n> bundle, but it loses the clarity your rewritten message provides\n> when the problematic remote indeed is a bundle.\n>\n> Do we have the remote information at this point in the code (i.e., the\n> URL of the remote that was given to the remote-object-info command)\n> that the user would immediately recognize as the remote they asked\n> the command to access?  If so, \"object-info is not supported by %s\"\n> filled with the remote information would probably work better.\n\nWe have what the user wrote for the remote in argv[0], so we could have\n\"object-info is not supported by <remote>\", and it would be the same\nfor anything that sets smart_options to NULL.\n\nBut with that in mind, what if in the future there's a transport without\nsmart_options that does support object-info? The smart_options check is\nthere because of \"this transport can't do object-info\", and nothing\non the object-info path reads smart_options from what I checked.\n\nSo I'm going to drop that die(). Later in the code there's already a \ncheck on transport_fetch_object_info(), which looks for \nfetch_object_info in the transport's vtable. It's a bit later, but it \nchecks the real capability and it will give less trouble in the future. \n\nCurrently, it has a generic error but it can print a more detailed \nversion such as: \"object-info is not supported by <remote>\"\n\nI'll send v2 later this week as I have to study for some of my midterms.\n\nRegards,\nPablo\n\n>\n> Thanks.\n\n\n"},{"id":"556661","messageId":"xmqq33tqdjr0.fsf@gitster.g","threadId":"66674","inReplyTo":"DMGGJIMVUXEG.WJSWR3E4POW1@gmail.com","subject":"Re: [PATCH RFC 1/3] cat-file: extract the transport ownership from get_remote_info()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-28T13:42:27Z","receivedAt":"2026-10-28T13:42:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Pablo Sabater\" <pabloosabaterr@gmail.com> writes:\n\n> But with that in mind, what if in the future there's a transport without\n> smart_options that does support object-info? The smart_options check is\n> there because of \"this transport can't do object-info\", and nothing\n> on the object-info path reads smart_options from what I checked.\n>\n> So I'm going to drop that die(). Later in the code there's already a \n> check on transport_fetch_object_info(), which looks for \n> fetch_object_info in the transport's vtable. It's a bit later, but it \n> checks the real capability and it will give less trouble in the future. \n\nThat design decision makes a lot of sense.  Thanks.\n\n"}]}