aboutsummaryrefslogtreecommitdiff
path: root/odb/source-files.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-05 15:19:50 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-05 11:45:16 -0800
commit1f3fd68e065b0f44432dc78c1b6f6e636929363e (patch)
treee391a7bb379f4233a9b32b032615fff6bcda8fb4 /odb/source-files.c
parent5946a564cddc0bf471f27ae4c3fe205441e3ef65 (diff)
downloadgit-1f3fd68e065b0f44432dc78c1b6f6e636929363e.tar.xz
odb/source: make `read_object_stream()` 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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/odb/source-files.c b/odb/source-files.c
index f2969a1214..b50a1f5492 100644
--- a/odb/source-files.c
+++ b/odb/source-files.c
@@ -55,6 +55,17 @@ static int odb_source_files_read_object_info(struct odb_source *source,
return -1;
}
+static int odb_source_files_read_object_stream(struct odb_read_stream **out,
+ struct odb_source *source,
+ const struct object_id *oid)
+{
+ struct odb_source_files *files = odb_source_files_downcast(source);
+ if (!packfile_store_read_object_stream(out, files->packed, oid) ||
+ !odb_source_loose_read_object_stream(out, source, oid))
+ return 0;
+ return -1;
+}
+
struct odb_source_files *odb_source_files_new(struct object_database *odb,
const char *path,
bool local)
@@ -70,6 +81,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
files->base.close = odb_source_files_close;
files->base.reprepare = odb_source_files_reprepare;
files->base.read_object_info = odb_source_files_read_object_info;
+ files->base.read_object_stream = odb_source_files_read_object_stream;
/*
* Ideally, we would only ever store absolute paths in the source. This