Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-04-12 03:21:14 +0300
committerJunio C Hamano <gitster@pobox.com>2018-04-12 05:38:56 +0300
commit64a741619d27ede27788d2d444257635f4af8ffd (patch)
tree5885bcd8f939e2e638fe3b1e80c575de6558141e /refs.c
parent1f2e7ceabcc1559e5b3e49df91036d3106f727f4 (diff)
refs: store the main ref store inside the repository struct
This moves the 'main_ref_store', which was a global variable in refs.c into the repository struct. This patch does not deal with the parts in the refs subsystem which deal with the submodules there. A later patch needs to get rid of the submodule exposure in the refs API, such as 'get_submodule_ref_store(path)'. Acked-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/refs.c b/refs.c
index f58b9fb7df..36df1bc73a 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->refs)
+ return r->refs;
- main_ref_store = ref_store_init(get_git_dir(), REF_STORE_ALL_CAPS);
- return main_ref_store;
+ r->refs = ref_store_init(r->gitdir, REF_STORE_ALL_CAPS);
+ return r->refs;
}
/*