diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-09-22 17:11:09 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-22 17:11:09 -0700 |
commit | 6295f87b5f46fcb1037eb12e81afaf0490a00922 (patch) | |
tree | b57cca00fffcb5ce6ff263685794cdbd0c54e819 /submodule.c | |
parent | 99c99ed8259bf070cd8ae7b51a94904b7cf5c161 (diff) | |
parent | 10a0d6ae64ad4fec12ab2c1ed13d1791dde60371 (diff) | |
download | git-6295f87b5f46fcb1037eb12e81afaf0490a00922.tar.gz |
Merge branch 'jt/add-submodule-odb-clean-up' into jt/no-abuse-alternate-odb-for-submodules
* jt/add-submodule-odb-clean-up:
revision: remove "submodule" from opt struct
repository: support unabsorbed in repo_submodule_init
submodule: remove unnecessary unabsorbed fallback
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/submodule.c b/submodule.c index 85ea1c36dd..04bdd0bec2 100644 --- a/submodule.c +++ b/submodule.c @@ -525,9 +525,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. */ @@ -1421,24 +1418,13 @@ 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)) { - /* - * 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); + if (repo_submodule_init(ret, r, path, null_oid())) { + free(ret); + return NULL; } return ret; @@ -1480,7 +1466,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); |