aboutsummaryrefslogtreecommitdiff
path: root/odb/source-files.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-05 15:19:57 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-05 11:45:17 -0800
commitd6fc6fe6f8b74e663d6013f830b535f50bfc1414 (patch)
tree6360ce844a2fc18c5b83dfb341ce3b3558708c27 /odb/source-files.c
parenteb9635d83b7ef16df527db3e84def9d0c772344d (diff)
downloadgit-d6fc6fe6f8b74e663d6013f830b535f50bfc1414.tar.xz
odb/source: make `begin_transaction()` function pluggable
Introduce a new callback function in `struct odb_source` to make the function pluggable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb/source-files.c')
-rw-r--r--odb/source-files.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/odb/source-files.c b/odb/source-files.c
index c32cd67b26..14cb9adeca 100644
--- a/odb/source-files.c
+++ b/odb/source-files.c
@@ -122,6 +122,16 @@ static int odb_source_files_write_object_stream(struct odb_source *source,
return odb_source_loose_write_stream(source, stream, len, oid);
}
+static int odb_source_files_begin_transaction(struct odb_source *source,
+ struct odb_transaction **out)
+{
+ struct odb_transaction *tx = odb_transaction_files_begin(source);
+ if (!tx)
+ return -1;
+ *out = tx;
+ return 0;
+}
+
static int odb_source_files_read_alternates(struct odb_source *source,
struct strvec *out)
{
@@ -213,6 +223,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
files->base.freshen_object = odb_source_files_freshen_object;
files->base.write_object = odb_source_files_write_object;
files->base.write_object_stream = odb_source_files_write_object_stream;
+ files->base.begin_transaction = odb_source_files_begin_transaction;
files->base.read_alternates = odb_source_files_read_alternates;
files->base.write_alternate = odb_source_files_write_alternate;