aboutsummaryrefslogtreecommitdiff
path: root/odb/source-files.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-05 15:19:52 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-05 11:45:16 -0800
commit6a38b13fbac73d1a1982f9211c5c3e64e1191696 (patch)
tree5476c9e8b1b91e9189384d434676ea906be52d8e /odb/source-files.c
parentfdefdc2e6979e9e8cb28b34c458f42b44f217bf0 (diff)
downloadgit-6a38b13fbac73d1a1982f9211c5c3e64e1191696.tar.xz
odb/source: make `freshen_object()` 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 d8ef1d8237..a6447909e0 100644
--- a/odb/source-files.c
+++ b/odb/source-files.c
@@ -88,6 +88,16 @@ static int odb_source_files_for_each_object(struct odb_source *source,
return 0;
}
+static int odb_source_files_freshen_object(struct odb_source *source,
+ const struct object_id *oid)
+{
+ struct odb_source_files *files = odb_source_files_downcast(source);
+ if (packfile_store_freshen_object(files->packed, oid) ||
+ odb_source_loose_freshen_object(source, oid))
+ return 1;
+ return 0;
+}
+
struct odb_source_files *odb_source_files_new(struct object_database *odb,
const char *path,
bool local)
@@ -105,6 +115,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
files->base.read_object_info = odb_source_files_read_object_info;
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;
/*
* Ideally, we would only ever store absolute paths in the source. This