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:
Jonathan Tan
2021-09-09 11:47:28 -07:00
committed by Junio C Hamano
parent 5df5106e1e
commit 8eb8dcf946
7 changed files with 28 additions and 37 deletions

View File

@ -209,10 +209,8 @@ static void show_submodule(struct repository *superproject,
struct dir_struct *dir, const char *path)
{
struct repository subrepo;
const struct submodule *sub = submodule_from_path(superproject,
null_oid(), path);
if (repo_submodule_init(&subrepo, superproject, sub))
if (repo_submodule_init(&subrepo, superproject, path, null_oid()))
return;
if (repo_read_index(&subrepo) < 0)