From 6e76c3ab69f9b30530d50550a2feb7d8bda935db Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 5 Mar 2026 15:19:53 +0100 Subject: odb/source: make `write_object()` function pluggable Introduce a new callback function in `struct odb_source` to make the function pluggable. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- odb/source-files.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'odb/source-files.c') diff --git a/odb/source-files.c b/odb/source-files.c index a6447909e0..67c2aff659 100644 --- a/odb/source-files.c +++ b/odb/source-files.c @@ -98,6 +98,17 @@ static int odb_source_files_freshen_object(struct odb_source *source, return 0; } +static int odb_source_files_write_object(struct odb_source *source, + const void *buf, unsigned long len, + enum object_type type, + struct object_id *oid, + struct object_id *compat_oid, + unsigned flags) +{ + return odb_source_loose_write_object(source, buf, len, type, + oid, compat_oid, flags); +} + struct odb_source_files *odb_source_files_new(struct object_database *odb, const char *path, bool local) @@ -116,6 +127,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb, files->base.read_object_stream = odb_source_files_read_object_stream; files->base.for_each_object = odb_source_files_for_each_object; files->base.freshen_object = odb_source_files_freshen_object; + files->base.write_object = odb_source_files_write_object; /* * Ideally, we would only ever store absolute paths in the source. This -- cgit v1.3