summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-09-09 11:47:27 -0700
committerJunio C Hamano <gitster@pobox.com>2021-09-09 14:09:30 -0700
commit5df5106e1e8b52ff54c0726ba6919afa4b745980 (patch)
tree41e0ead2b0d6e5ec2dde1695ff2afe28c8739a1e /submodule.c
parent18a2f66d8a5514fec214613a75e6a238532d2664 (diff)
downloadgit-5df5106e1e8b52ff54c0726ba6919afa4b745980.tar.gz
submodule: remove unnecessary unabsorbed fallback
In get_submodule_repo_for(), there is a fallback code path for the case in which a submodule has an unabsorbed gitdir. (See the documentation for "git submodule absorbgitdirs" for more information about absorbed and unabsorbed gitdirs.) However, this code path is unnecessary, because such submodules are already handled: when the fetch_task is created in fetch_task_create(), it will create its own struct submodule with a path and name, and repo_submodule_init() can handle such a struct. This fallback was introduced in 26f80ccfc1 ("submodule: migrate get_next_submodule to use repository structs", 2018-12-05). It was unnecessary even then, but perhaps it escaped notice because its parent commit d5498e0871 ("repository: repo_submodule_init to take a submodule struct", 2018-12-05) was the one that taught repo_submodule_init() to handle such created structs. Before, it took a path and always checked .gitmodules, so it truly would have failed if there were no entry in .gitmodules. (Note to reviewers: in 26f80ccfc1, the "own struct submodule" I mentioned is in get_next_submodule(), not fetch_task_create().) Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/submodule.c b/submodule.c
index 8de1aecaeb..3af3da5b5e 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1409,19 +1409,8 @@ static struct repository *get_submodule_repo_for(struct repository *r,
struct repository *ret = xmalloc(sizeof(*ret));
if (repo_submodule_init(ret, r, sub)) {
- /*
- * No entry in .gitmodules? Technically not a submodule,
- * but historically we supported repositories that happen to be
- * in-place where a gitlink is. Keep supporting them.
- */
- struct strbuf gitdir = STRBUF_INIT;
- strbuf_repo_worktree_path(&gitdir, r, "%s/.git", sub->path);
- if (repo_init(ret, gitdir.buf, NULL)) {
- strbuf_release(&gitdir);
- free(ret);
- return NULL;
- }
- strbuf_release(&gitdir);
+ free(ret);
+ return NULL;
}
return ret;