Skip to content

Commit 82a150f

Browse files
pcloudsgitster
authored andcommitted
refs.c: remove fallback-to-main-store code get_submodule_ref_store()
At this state, there are three get_submodule_ref_store() callers: - for_each_remote_ref_submodule() - handle_revision_pseudo_opt() - resolve_gitlink_ref() The first two deal explicitly with submodules (and we should never fall back to the main ref store as a result). They are only called from submodule.c: - find_first_merges() - submodule_needs_pushing() - push_submodule() The last one, as its name implies, deals only with submodules too, and the "submodule" (path) argument must be a non-NULL, non-empty string. So, this "if NULL or empty string" code block should never ever trigger. And it's wrong to fall back to the main ref store anyway. Delete it. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 32619f9 commit 82a150f

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

refs.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,9 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
15871587
char *to_free = NULL;
15881588
size_t len;
15891589

1590+
if (!submodule)
1591+
return NULL;
1592+
15901593
if (submodule) {
15911594
len = strlen(submodule);
15921595
while (len && is_dir_sep(submodule[len - 1]))
@@ -1595,14 +1598,6 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
15951598
return NULL;
15961599
}
15971600

1598-
if (!submodule || !*submodule) {
1599-
/*
1600-
* FIXME: This case is ideally not allowed. But that
1601-
* can't happen until we clean up all the callers.
1602-
*/
1603-
return get_main_ref_store();
1604-
}
1605-
16061601
if (submodule[len])
16071602
/* We need to strip off one or more trailing slashes */
16081603
submodule = to_free = xmemdupz(submodule, len);

0 commit comments

Comments
 (0)