diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-10-06 20:40:10 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-06 20:40:11 (GMT) |
commit | 921c795c25577e40df1f607a22748332bfb225ea (patch) | |
tree | e29b9b398d13aeb9b8053f220f584228a87f1b28 /repository.c | |
parent | 0785eb769886ae81e346df10e88bc49ffc0ac64e (diff) | |
parent | 10a0d6ae64ad4fec12ab2c1ed13d1791dde60371 (diff) | |
download | git-921c795c25577e40df1f607a22748332bfb225ea.zip git-921c795c25577e40df1f607a22748332bfb225ea.tar.gz git-921c795c25577e40df1f607a22748332bfb225ea.tar.bz2 |
Merge branch 'jt/add-submodule-odb-clean-up'
More code paths that use the hack to add submodule's object
database to the set of alternate object store have been cleaned up.
* 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 'repository.c')
-rw-r--r-- | repository.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/repository.c b/repository.c index 710a3b4..c5b90ba 100644 --- a/repository.c +++ b/repository.c @@ -190,19 +190,15 @@ error: int repo_submodule_init(struct repository *subrepo, struct repository *superproject, - const struct submodule *sub) + const char *path, + const struct object_id *treeish_name) { struct strbuf gitdir = STRBUF_INIT; struct strbuf worktree = STRBUF_INIT; int ret = 0; - if (!sub) { - ret = -1; - goto out; - } - - strbuf_repo_worktree_path(&gitdir, superproject, "%s/.git", sub->path); - strbuf_repo_worktree_path(&worktree, superproject, "%s", sub->path); + strbuf_repo_worktree_path(&gitdir, superproject, "%s/.git", path); + strbuf_repo_worktree_path(&worktree, superproject, "%s", path); if (repo_init(subrepo, gitdir.buf, worktree.buf)) { /* @@ -212,6 +208,13 @@ int repo_submodule_init(struct repository *subrepo, * in the superproject's 'modules' directory. In this case the * submodule would not have a worktree. */ + const struct submodule *sub = + submodule_from_path(superproject, treeish_name, path); + if (!sub) { + ret = -1; + goto out; + } + strbuf_reset(&gitdir); submodule_name_to_gitdir(&gitdir, superproject, sub->name); @@ -224,7 +227,7 @@ int repo_submodule_init(struct repository *subrepo, subrepo->submodule_prefix = xstrfmt("%s%s/", superproject->submodule_prefix ? superproject->submodule_prefix : - "", sub->path); + "", path); out: strbuf_release(&gitdir); |