refs: rename lookup_ref_store() to lookup_submodule_ref_store()
With get_main_ref_store() being used inside get_ref_store(), lookup_ref_store() is only used for submodule code path. Rename to reflect that and delete dead code. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
24c8407e0a
commit
9476c6ed3d
13
refs.c
13
refs.c
@ -1395,17 +1395,13 @@ static struct ref_store *main_ref_store;
|
|||||||
static struct hashmap submodule_ref_stores;
|
static struct hashmap submodule_ref_stores;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the ref_store instance for the specified submodule (or the
|
* Return the ref_store instance for the specified submodule. If that
|
||||||
* main repository if submodule is NULL). If that ref_store hasn't
|
* ref_store hasn't been initialized yet, return NULL.
|
||||||
* been initialized yet, return NULL.
|
|
||||||
*/
|
*/
|
||||||
static struct ref_store *lookup_ref_store(const char *submodule)
|
static struct ref_store *lookup_submodule_ref_store(const char *submodule)
|
||||||
{
|
{
|
||||||
struct submodule_hash_entry *entry;
|
struct submodule_hash_entry *entry;
|
||||||
|
|
||||||
if (!submodule)
|
|
||||||
return main_ref_store;
|
|
||||||
|
|
||||||
if (!submodule_ref_stores.tablesize)
|
if (!submodule_ref_stores.tablesize)
|
||||||
/* It's initialized on demand in register_ref_store(). */
|
/* It's initialized on demand in register_ref_store(). */
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1471,7 +1467,7 @@ struct ref_store *get_ref_store(const char *submodule)
|
|||||||
if (!submodule || !*submodule) {
|
if (!submodule || !*submodule) {
|
||||||
return get_main_ref_store();
|
return get_main_ref_store();
|
||||||
} else {
|
} else {
|
||||||
refs = lookup_ref_store(submodule);
|
refs = lookup_submodule_ref_store(submodule);
|
||||||
|
|
||||||
if (!refs) {
|
if (!refs) {
|
||||||
struct strbuf submodule_sb = STRBUF_INIT;
|
struct strbuf submodule_sb = STRBUF_INIT;
|
||||||
@ -1482,7 +1478,6 @@ struct ref_store *get_ref_store(const char *submodule)
|
|||||||
strbuf_release(&submodule_sb);
|
strbuf_release(&submodule_sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return refs;
|
return refs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user