path: root/repository.h
diff options
authorStefan Beller <>2018-03-28 22:35:31 (GMT)
committerJunio C Hamano <>2018-03-29 16:44:51 (GMT)
commitda62f786d2df60f3c8255cf4cbbcd9c1f9458d99 (patch)
tree9a0a2c11baadcabfbdd1c4044e7252a3b8862af4 /repository.h
parent0c89fdd739183234f86fe2be03a0374705ed93ed (diff)
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 <>
Diffstat (limited to 'repository.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/repository.h b/repository.h
index 09df94a..6041367 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);