diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-03-26 09:42:25 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:23:39 -0700 |
commit | 24c8407e0aab839a2de57573fd6dd6320f172af3 (patch) | |
tree | e5715b577090d2d9020b065e088a092764379a99 | |
parent | files-backend: remove the use of git_path() (diff) | |
download | tgif-24c8407e0aab839a2de57573fd6dd6320f172af3.tar.xz |
refs.c: introduce get_main_ref_store()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1456,15 +1456,20 @@ static struct ref_store *ref_store_init(const char *submodule) return refs; } +static struct ref_store *get_main_ref_store(void) +{ + if (main_ref_store) + return main_ref_store; + + return ref_store_init(NULL); +} + struct ref_store *get_ref_store(const char *submodule) { struct ref_store *refs; if (!submodule || !*submodule) { - refs = lookup_ref_store(NULL); - - if (!refs) - refs = ref_store_init(NULL); + return get_main_ref_store(); } else { refs = lookup_ref_store(submodule); |