From da62f786d2df60f3c8255cf4cbbcd9c1f9458d99 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Wed, 28 Mar 2018 15:35:31 -0700 Subject: submodule: fixup nested submodules after moving the submodule connect_work_tree_and_git_dir is used to connect a submodule worktree with its git directory and vice versa after events that require a reconnection such as moving around the working tree. As submodules can have nested submodules themselves, we'd also want to fix the nested submodules when asked to. Add an option to recurse into the nested submodules and connect them as well. As submodules are identified by their name (which determines their git directory in relation to their superproject's git directory) internally and by their path in the working tree of the superproject, we need to make sure that the mapping of name <-> path is kept intact. We can do that in the git-mv command by writing out the gitmodules file first and then forcing a reload of the submodule config machinery. Signed-off-by: Stefan Beller Reviewed-by: Jonathan Tan Signed-off-by: Junio C Hamano --- repository.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'repository.h') diff --git a/repository.h b/repository.h index 09df94a472..6041367f08 100644 --- a/repository.h +++ b/repository.h @@ -97,6 +97,9 @@ extern void repo_set_gitdir(struct repository *repo, extern void repo_set_worktree(struct repository *repo, const char *path); extern void repo_set_hash_algo(struct repository *repo, int algo); extern void initialize_the_repository(void); +extern int repo_init(struct repository *r, + const char *gitdir, + const char *worktree); extern int repo_submodule_init(struct repository *submodule, struct repository *superproject, const char *path); -- cgit v1.2.3