odb: generic in-memory source
Make the in-memory source generic. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Apr 10, 2026 at 14:12 UTC
fdf74cb2cab6a4a95fd6e7e589ac6a4508bf358f
2 files changed
+5
-5
odb.c
+4
-4
index 24e929f03c..965ef68e4e 100644
--- a/odb.c
+++ b/odb.c
@@ -560,7 +560,7 @@ static int do_oid_object_info_extended(struct object_database *odb,
if (is_null_oid(real))
return -1;
- if (!odb_source_read_object_info(&odb->inmemory_objects->base, oid, oi, flags))
+ if (!odb_source_read_object_info(odb->inmemory_objects, oid, oi, flags))
return 0;
odb_prepare_alternates(odb);
@@ -737,7 +737,7 @@ int odb_pretend_object(struct object_database *odb,
if (odb_has_object(odb, oid, 0))
return 0;
- return odb_source_write_object(&odb->inmemory_objects->base,
+ return odb_source_write_object(odb->inmemory_objects,
buf, len, type, oid, NULL, 0);
}
@@ -1020,7 +1020,7 @@ struct object_database *odb_new(struct repository *repo,
o->sources = odb_source_new(o, primary_source, true);
o->sources_tail = &o->sources->next;
o->alternate_db = xstrdup_or_null(secondary_sources);
- o->inmemory_objects = odb_source_inmemory_new(o);
+ o->inmemory_objects = &odb_source_inmemory_new(o)->base;
free(to_free);
@@ -1045,7 +1045,7 @@ static void odb_free_sources(struct object_database *o)
o->sources = next;
}
- odb_source_free(&o->inmemory_objects->base);
+ odb_source_free(o->inmemory_objects);
o->inmemory_objects = NULL;
kh_destroy_odb_path_map(o->source_by_path);
odb.h
+1
-1
index c3a7edf9c8..73553ed5a7 100644
--- a/odb.h
+++ b/odb.h
@@ -81,7 +81,7 @@ struct object_database {
* to write them into the object store (e.g. a browse-only
* application).
*/
- struct odb_source_inmemory *inmemory_objects;
+ struct odb_source *inmemory_objects;
/*
* A fast, rough count of the number of objects in the repository.