]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jt/odb-transaction-write' into seen
authorJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2026 01:22:01 +0000 (10:22 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2026 01:22:01 +0000 (10:22 +0900)
ODB transaction interface is being reworked to explicitly handle
object writes.

* jt/odb-transaction-write:
  odb/transaction: make `write_object_stream()` pluggable
  object-file: generalize packfile writes to use odb_write_stream
  object-file: avoid fd seekback by checking object size upfront
  object-file: remove flags from transaction packfile writes
  odb: update `struct odb_write_stream` read() callback
  odb/transaction: use pluggable `begin_transaction()`
  odb: split `struct odb_transaction` into separate header

1  2 
Makefile
builtin/unpack-objects.c
builtin/update-index.c
cache-tree.c
meson.build
object-file.c
odb.c
odb.h
read-cache.c

diff --cc Makefile
Simple merge
Simple merge
Simple merge
diff --cc cache-tree.c
Simple merge
diff --cc meson.build
Simple merge
diff --cc object-file.c
index 37def5cc5907841418b2294a87950189d8ada125,65356998f3f7855ac66eed6c820bfd71926ba180..4a6f3be244d7837599fdaec0a9fd86b3f3dde02f
@@@ -1435,11 -1458,9 +1464,10 @@@ static void stream_blob_to_pack(struct 
        unsigned char obuf[16384];
        unsigned hdrlen;
        int status = Z_OK;
-       int write_object = (flags & INDEX_WRITE_OBJECT);
-       off_t offset = 0;
 +      struct repo_config_values *cfg = repo_config_values(the_repository);
+       size_t bytes_read = 0;
  
 -      git_deflate_init(&s, pack_compression_level);
 +      git_deflate_init(&s, cfg->pack_compression_level);
  
        hdrlen = encode_in_pack_object_header(obuf, sizeof(obuf), OBJ_BLOB, size);
        s.next_out = obuf + hdrlen;
diff --cc odb.c
Simple merge
diff --cc odb.h
index 3a711f6547bb002739638149e13c49a0a98aed40,6faeaa05891d7bb5682b53c0a687ce940bcde743..9eb8355aca540be9aa9472f0fa2166eaf3aa04e7
--- 1/odb.h
--- 2/odb.h
+++ b/odb.h
@@@ -29,24 -31,10 +29,6 @@@ extern int fetch_if_missing
   */
  char *compute_alternate_path(const char *path, struct strbuf *err);
  
- /*
-  * A transaction may be started for an object database prior to writing new
-  * objects via odb_transaction_begin(). These objects are not committed until
-  * odb_transaction_commit() is invoked. Only a single transaction may be pending
-  * at a time.
-  *
-  * Each ODB source is expected to implement its own transaction handling.
-  */
- struct odb_transaction;
- typedef void (*odb_transaction_commit_fn)(struct odb_transaction *transaction);
- struct odb_transaction {
-       /* The ODB source the transaction is opened against. */
-       struct odb_source *source;
-       /* The ODB source specific callback invoked to commit a transaction. */
-       odb_transaction_commit_fn commit;
- };
 -struct packed_git;
 -struct packfile_store;
 -struct cached_object_entry;
--
  /*
   * The object database encapsulates access to objects in a repository. It
   * manages one or more sources that store the actual objects which are
diff --cc read-cache.c
Simple merge