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>
Michael Haggerty committed
Feb 10, 2017 at 12:16 UTC
b4f540b6cefdb33f35ffd5f8b2fb459c184a1bd7
1 file changed
+2
-11
refs.c
+2
-11
@@ -1362,15 +1362,12 @@ static struct ref_store *submodule_ref_stores;
1362
* Return the ref_store instance for the specified submodule (or the
1363
* main repository if submodule is NULL). If that ref_store hasn't
1364
* been initialized yet, return NULL.
1365
- *
1366
- * For backwards compatibility, submodule=="" is treated the same as
1367
- * submodule==NULL.
1365
*/
1366
static struct ref_store *lookup_ref_store(const char *submodule)
1367
{
1368
struct ref_store *refs;
1369
1373
- if (!submodule || !*submodule)
1370
+ if (!submodule)
1371
return main_ref_store;
1372
1373
for (refs = submodule_ref_stores; refs; refs = refs->next) {
@@ -1384,9 +1381,6 @@ static struct ref_store *lookup_ref_store(const char *submodule)
1381
/*
1382
* Create, record, and return a ref_store instance for the specified
1383
* submodule (or the main repository if submodule is NULL).
1387
- *
1388
- * For backwards compatibility, submodule=="" is treated the same as
1389
- * submodule==NULL.
1384
*/
1385
static struct ref_store *ref_store_init(const char *submodule)
1386
{
@@ -1396,10 +1390,7 @@ static struct ref_store *ref_store_init(const char *submodule)
1390
if (!be)
1391
die("BUG: reference backend %s is unknown", be_name);
1392
1399
- if (!submodule || !*submodule)
1400
- return be->init(NULL);
1401
- else
1402
- return be->init(submodule);
1393
+ return be->init(submodule);
1394
}
1395
1396
struct ref_store *get_ref_store(const char *submodule)