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>
This commit is contained in:
committed by
Junio C Hamano
parent
5df5106e1e
commit
8eb8dcf946
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user