git/odb
Justin Tobler ecdda043e0 odb/transaction: add transaction finalize interface
When committing an ODB transaction via `odb_transaction_commit()`, the
staged objects are made visible and the underlying transaction is freed
at the same time. Coupling these two steps does not leave room for any
post-commit transaction operations to be introduced though. Such a
capability is useful if an ODB transaction backend needs to hold on to
lockfiles after transaction commit until references are updated, as is
the case with the existing "files" backend in git-receive-pack(1).

Stop freeing the transaction in `odb_transaction_commit()` and introduce
`odb_transaction_finalize()` to explicitly clean up the transaction
accordingly. Note that the finalize interface also provides an optional
callback for any backend-specific deferred cleanup. In a subsequent
commit, the "files" transaction backend will use this to remove ".keep"
files generated for packfiles received via git-receive-pack(1) after
references have been updated. In preparation for this, the
`odb_transaction_finalize()` call site in git-receive-pack(1) is made
after the reference updates are finished.

All other callers commit a transaction and immediately finalize it
without any work happening in between those two operations.
Consequently, they cannot meaningfully recover in case either of them
would fail, and spelling out these two separate steps with proper error
handling would be quite repetitive and pointless. Introduce a helper
`odb_transaction_commit_and_finalize_or_die()` for those call sites and
update them accordingly.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-08-20 20:28:01 -07:00
..
source-files.c Merge branch 'ps/odb-pluggable-housekeeping' 2026-08-05 11:10:51 -07:00
source-files.h odb: make optimizations pluggable 2026-07-13 08:13:17 -07:00
source-inmemory.c Merge branch 'jt/receive-pack-use-odb-transactions' 2026-07-22 10:30:53 -07:00
source-inmemory.h odb/source-inmemory: convert to use oidtree 2026-05-15 04:50:45 +09:00
source-loose.c Merge branch 'jt/receive-pack-use-odb-transactions' 2026-07-22 10:30:53 -07:00
source-loose.h odb/source-loose: drop pointer to the "files" source 2026-06-01 18:47:19 +09:00
source-packed.c Merge branch 'ps/odb-move-loose-object-writing' 2026-07-30 10:32:05 -07:00
source-packed.h Merge branch 'ps/odb-generalize-prepare' 2026-07-13 08:27:28 -07:00
source.c odb/source: make `free()` function pluggable 2026-03-05 11:45:15 -08:00
source.h Merge branch 'ps/odb-pluggable-housekeeping' 2026-08-05 11:10:51 -07:00
streaming.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
streaming.h Merge branch 'ps/odb-in-memory' into ps/odb-source-loose 2026-05-21 22:34:55 +09:00
transaction.c odb/transaction: add transaction finalize interface 2026-08-20 20:28:01 -07:00
transaction.h odb/transaction: add transaction finalize interface 2026-08-20 20:28:01 -07:00