From: Junio C Hamano Date: Fri, 24 Jul 2026 21:46:47 +0000 (-0700) Subject: Merge branch 'ps/cat-file-remote-object-info' into next X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e436a42272e5f75bb9ac8df1355c4593652372fe;p=thirdparty%2Fgit.git Merge branch 'ps/cat-file-remote-object-info' into next The 'remote-object-info' command has been added to 'git cat-file --batch-command', allowing clients to request object metadata (currently size) from a remote server via protocol v2 without downloading the entire object. Format placeholders are dynamically filtered on the client based on server-advertised capabilities, returning empty strings for inapplicable or unsupported fields. * ps/cat-file-remote-object-info: cat-file: make remote-object-info allow-list adapt to the server cat-file: add remote-object-info to batch-command transport: add client support for object-info serve: advertise object-info feature protocol-caps: check object existence regardless of the attributes requested fetch-pack: move fetch initialization connect: make write_fetch_command_and_capabilities() more generic fetch-pack: move write_fetch_command_and_capabilities() to connect.c fetch-pack: use unsigned int for hash_algo variable fetch-pack: drop the static advertise_sid variable t1006: extract helper functions into new 'lib-cat-file.sh' cat-file: declare loop counter inside for() transport-helper: fix memory leak of helper on disconnect --- e436a42272e5f75bb9ac8df1355c4593652372fe diff --cc object-file.c index 0567b9d5f1,121416c37c..6f48e5e418 --- a/object-file.c +++ b/object-file.c @@@ -1715,29 -1695,16 +1715,39 @@@ int odb_transaction_files_begin(struct transaction->base.source = source; transaction->base.commit = odb_transaction_files_commit; transaction->base.write_object_stream = odb_transaction_files_write_object_stream; + transaction->base.env = odb_transaction_files_env; + + transaction->prefix = "bulk-fsync"; + if (flags & ODB_TRANSACTION_RECEIVE) { + /* + * ODB transactions for git-receive-pack(1) eagerly create a + * temporary directory and use a different temporary directory + * prefix. + * + * NEEDSWORK: This transaction flag is only used by the "files" + * backend to special case temporary directory set up and + * handling. Ideally transaction users should not have to care + * though. To avoid this, we could eagerly create the temporary + * directory and use the same prefix name for all transactions. + */ + transaction->prefix = "incoming"; + if (odb_transaction_files_prepare(&transaction->base)) { + free(transaction); + return -1; + } + } + + *out = &transaction->base; - return &transaction->base; + return 0; } + + void free_object_info_contents(struct object_info *object_info) + { + if (!object_info) + return; + free(object_info->typep); + free(object_info->sizep); + free(object_info->disk_sizep); + free(object_info->delta_base_oid); + }