mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
odb: introduce parent pointers
In subsequent commits we'll get rid of our use of `the_repository` in "odb.c" in favor of explicitly passing in a `struct object_database` or a `struct odb_source`. In some cases though we'll need access to the repository, for example to read a config value from it, but we don't have a way to access the repository owning a specific object database. Introduce parent pointers for `struct object_database` to its owning repository as well as for `struct odb_source` to its owning object database, which will allow us to adapt those use cases. Note that this change requires us to pass through the object database to `link_alt_odb_entry()` so that we can set up the parent pointers for any source there. The callchain is adapted to pass through the object database accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
8f49151763
commit
2f5181fce6
@@ -52,7 +52,7 @@ static void set_default_hash_algo(struct repository *repo)
|
||||
|
||||
void initialize_repository(struct repository *repo)
|
||||
{
|
||||
repo->objects = odb_new();
|
||||
repo->objects = odb_new(repo);
|
||||
repo->remote_state = remote_state_new();
|
||||
repo->parsed_objects = parsed_object_pool_new(repo);
|
||||
ALLOC_ARRAY(repo->index, 1);
|
||||
@@ -167,6 +167,7 @@ void repo_set_gitdir(struct repository *repo,
|
||||
|
||||
if (!repo->objects->sources) {
|
||||
CALLOC_ARRAY(repo->objects->sources, 1);
|
||||
repo->objects->sources->odb = repo->objects;
|
||||
repo->objects->sources_tail = &repo->objects->sources->next;
|
||||
}
|
||||
expand_base_dir(&repo->objects->sources->path, o->object_dir,
|
||||
|
||||
Reference in New Issue
Block a user