Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- refs.c | 13 +++++-------- refs.h | 4 +--- repository.h | 5 +++++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/refs.c b/refs.c index 0352cbdcc1..793b827e19 100644 --- a/refs.c +++ b/refs.c @@ -1608,9 +1608,6 @@ static struct ref_store_hash_entry *alloc_ref_store_hash_entry( return entry; } -/* A pointer to the ref_store for the main repository: */ -static struct ref_store *main_ref_store; - /* A hashmap of ref_stores, stored by submodule name: */ static struct hashmap submodule_ref_stores; @@ -1652,13 +1649,13 @@ static struct ref_store *ref_store_init(const char *gitdir, return refs; } -struct ref_store *get_main_ref_store_the_repository(void) +struct ref_store *get_main_ref_store(struct repository *r) { - if (main_ref_store) - return main_ref_store; + if (r->main_ref_store) + return r->main_ref_store; - main_ref_store = ref_store_init(get_git_dir(), REF_STORE_ALL_CAPS); - return main_ref_store; + r->main_ref_store = ref_store_init(r->gitdir, REF_STORE_ALL_CAPS); + return r->main_ref_store; } /* diff --git a/refs.h b/refs.h index ab3d2bec2f..f5ab68c0ed 100644 --- a/refs.h +++ b/refs.h @@ -760,9 +760,7 @@ int reflog_expire(const char *refname, const struct object_id *oid, int ref_storage_backend_exists(const char *name); -#define get_main_ref_store(r) \ - get_main_ref_store_##r() -struct ref_store *get_main_ref_store_the_repository(void); +struct ref_store *get_main_ref_store(struct repository *r); /* * Return the ref_store instance for the specified submodule. For the * main repository, use submodule==NULL; such a call cannot fail. For diff --git a/repository.h b/repository.h index 09df94a472..2922d3a28b 100644 --- a/repository.h +++ b/repository.h @@ -26,6 +26,11 @@ struct repository { */ struct raw_object_store *objects; + /* + * The store in which the refs are hold. + */ + struct ref_store *main_ref_store; + /* * Path to the repository's graft file. * Cannot be NULL after initialization. -- 2.17.0.484.g0c8726318c-goog