aboutsummaryrefslogtreecommitdiff
path: root/odb.c
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2026-02-02 18:10:01 -0600
committerJunio C Hamano <gitster@pobox.com>2026-02-02 17:14:03 -0800
commitfa7d067923a342c298b7723935c60217a5244e4e (patch)
tree1a6244c91017c049a74e3cfd9ddc7d1d76b31b57 /odb.c
parent8bf06d05a581dfb552cd0e290680f75d3676eb1d (diff)
downloadgit-fa7d067923a342c298b7723935c60217a5244e4e.tar.xz
odb: prepare `struct odb_transaction` to become generic
An ODB transaction handles how objects are stored temporarily and eventually committed. Due to object storage being implemented differently for a given ODB source, the ODB transactions must be implemented in a manner specific to the source the objects are being written to. To provide generic transactions, `struct odb_transaction` is updated to store a commit callback that can be configured to support a specific ODB source. For now `struct odb_transaction_files` is the only transaction type and what is always returned when starting a transaction. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb.c')
-rw-r--r--odb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/odb.c b/odb.c
index a5e6fd01a9..349b4218a5 100644
--- a/odb.c
+++ b/odb.c
@@ -1158,5 +1158,8 @@ struct odb_transaction *odb_transaction_begin(struct object_database *odb)
void odb_transaction_commit(struct odb_transaction *transaction)
{
- odb_transaction_files_commit(transaction);
+ if (!transaction)
+ return;
+
+ transaction->commit(transaction);
}