From 8eb8dcf94643ca6e7c3f040f3e0bf96e11c7ae47 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Thu, 9 Sep 2021 11:47:28 -0700 Subject: repository: support unabsorbed in repo_submodule_init In preparation for a subsequent commit that migrates code using add_submodule_odb() to repo_submodule_init(), teach repo_submodule_init() to support submodules with unabsorbed gitdirs. (See the documentation for "git submodule absorbgitdirs" for more information about absorbed and unabsorbed gitdirs.) Signed-off-by: Jonathan Tan Signed-off-by: Junio C Hamano --- submodule.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index 3af3da5b5e..ecda0229af 100644 --- a/submodule.c +++ b/submodule.c @@ -520,9 +520,6 @@ static void prepare_submodule_repo_env_in_gitdir(struct strvec *out) /* * Initialize a repository struct for a submodule based on the provided 'path'. * - * Unlike repo_submodule_init, this tolerates submodules not present - * in .gitmodules. This function exists only to preserve historical behavior, - * * Returns the repository struct on success, * NULL when the submodule is not present. */ @@ -1404,11 +1401,11 @@ static void fetch_task_release(struct fetch_task *p) } static struct repository *get_submodule_repo_for(struct repository *r, - const struct submodule *sub) + const char *path) { struct repository *ret = xmalloc(sizeof(*ret)); - if (repo_submodule_init(ret, r, sub)) { + if (repo_submodule_init(ret, r, path, null_oid())) { free(ret); return NULL; } @@ -1452,7 +1449,7 @@ static int get_next_submodule(struct child_process *cp, continue; } - task->repo = get_submodule_repo_for(spf->r, task->sub); + task->repo = get_submodule_repo_for(spf->r, task->sub->path); if (task->repo) { struct strbuf submodule_prefix = STRBUF_INIT; child_process_init(cp); -- cgit v1.2.3