From: Junio C Hamano Date: Tue, 28 Apr 2026 01:22:01 +0000 (+0900) Subject: Merge branch 'jt/odb-transaction-write' into seen X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=bc79d784f7ebcc87ee26237437c5fdbcc01d9732;p=thirdparty%2Fgit.git Merge branch 'jt/odb-transaction-write' into seen 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 --- bc79d784f7ebcc87ee26237437c5fdbcc01d9732 diff --cc object-file.c index 37def5cc59,65356998f3..4a6f3be244 --- a/object-file.c +++ b/object-file.c @@@ -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.h index 3a711f6547,6faeaa0589..9eb8355aca --- a/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