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>
This commit is contained in:
Patrick Steinhardt
2026-04-10 14:12:46 +02:00
committed by Junio C Hamano
parent 314fa0199d
commit fdf74cb2ca
2 changed files with 5 additions and 5 deletions

8
odb.c
View File

@@ -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);

2
odb.h
View File

@@ -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.