aboutsummaryrefslogtreecommitdiffstats
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-06 13:40:10 -0700
committerJunio C Hamano <gitster@pobox.com>2021-10-06 13:40:11 -0700
commit921c795c25577e40df1f607a22748332bfb225ea (patch)
treee29b9b398d13aeb9b8053f220f584228a87f1b28 /submodule.c
parent0785eb769886ae81e346df10e88bc49ffc0ac64e (diff)
parent10a0d6ae64ad4fec12ab2c1ed13d1791dde60371 (diff)
downloadgit-921c795c25577e40df1f607a22748332bfb225ea.tar.gz
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 'submodule.c')
-rw-r--r--submodule.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/submodule.c b/submodule.c
index 78aed03d92..62beb8fd5f 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);