]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ps/cat-file-remote-object-info' into next
authorJunio C Hamano <gitster@pobox.com>
Fri, 24 Jul 2026 21:46:47 +0000 (14:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jul 2026 21:46:47 +0000 (14:46 -0700)
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

1  2 
Makefile
builtin/cat-file.c
connect.c
meson.build
object-file.c
odb.h
t/meson.build
t/t1006-cat-file.sh
t/t5701-git-serve.sh
transport-helper.c

diff --cc Makefile
Simple merge
Simple merge
diff --cc connect.c
Simple merge
diff --cc meson.build
Simple merge
diff --cc object-file.c
index 0567b9d5f19d16d57ba18e8631562e96624b93b6,121416c37c6709d36d85d08888d162e05d4adf46..6f48e5e418f3e262b3ecba8ce9de7a64b8105f7c
@@@ -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);
+ }
diff --cc odb.h
Simple merge
diff --cc t/meson.build
Simple merge
Simple merge
Simple merge
Simple merge