diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-09-09 21:47:28 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-10 00:09:30 +0300 |
commit | 8eb8dcf94643ca6e7c3f040f3e0bf96e11c7ae47 (patch) | |
tree | f7e2ee9926bed0f5382f492687ca830a599c993c /submodule.c | |
parent | 5df5106e1e8b52ff54c0726ba6919afa4b745980 (diff) |
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 <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 9 |
1 files changed, 3 insertions, 6 deletions
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); |