summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-02-10 11:16:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-10 19:13:26 (GMT)
commitb4f540b6cefdb33f35ffd5f8b2fb459c184a1bd7 (patch)
treed6bffab426c26d730e00e320e11aea113007991e /refs.c
parentc468da4e2796868362c2f33b499d9bb6d6cd7043 (diff)
downloadgit-b4f540b6cefdb33f35ffd5f8b2fb459c184a1bd7.zip
git-b4f540b6cefdb33f35ffd5f8b2fb459c184a1bd7.tar.gz
git-b4f540b6cefdb33f35ffd5f8b2fb459c184a1bd7.tar.bz2
refs: remove some unnecessary handling of submodule == ""
The only external entry point to the ref_store lookup functions is get_ref_store(), which ensures that submodule == "" is passed along as NULL. So ref_store_init() and lookup_ref_store() don't have to handle submodule being specified as the empty string. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/refs.c b/refs.c
index d7265cc..6348414 100644
--- a/refs.c
+++ b/refs.c
@@ -1362,15 +1362,12 @@ static struct ref_store *submodule_ref_stores;
* Return the ref_store instance for the specified submodule (or the
* main repository if submodule is NULL). If that ref_store hasn't
* been initialized yet, return NULL.
- *
- * For backwards compatibility, submodule=="" is treated the same as
- * submodule==NULL.
*/
static struct ref_store *lookup_ref_store(const char *submodule)
{
struct ref_store *refs;
- if (!submodule || !*submodule)
+ if (!submodule)
return main_ref_store;
for (refs = submodule_ref_stores; refs; refs = refs->next) {
@@ -1384,9 +1381,6 @@ static struct ref_store *lookup_ref_store(const char *submodule)
/*
* Create, record, and return a ref_store instance for the specified
* submodule (or the main repository if submodule is NULL).
- *
- * For backwards compatibility, submodule=="" is treated the same as
- * submodule==NULL.
*/
static struct ref_store *ref_store_init(const char *submodule)
{
@@ -1396,10 +1390,7 @@ static struct ref_store *ref_store_init(const char *submodule)
if (!be)
die("BUG: reference backend %s is unknown", be_name);
- if (!submodule || !*submodule)
- return be->init(NULL);
- else
- return be->init(submodule);
+ return be->init(submodule);
}
struct ref_store *get_ref_store(const char *submodule)