summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-03-28 22:35:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-29 16:44:51 (GMT)
commitda62f786d2df60f3c8255cf4cbbcd9c1f9458d99 (patch)
tree9a0a2c11baadcabfbdd1c4044e7252a3b8862af4 /repository.c
parent0c89fdd739183234f86fe2be03a0374705ed93ed (diff)
downloadgit-da62f786d2df60f3c8255cf4cbbcd9c1f9458d99.zip
git-da62f786d2df60f3c8255cf4cbbcd9c1f9458d99.tar.gz
git-da62f786d2df60f3c8255cf4cbbcd9c1f9458d99.tar.bz2
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 <sbeller@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/repository.c b/repository.c
index eb5b8e9..beff3ca 100644
--- a/repository.c
+++ b/repository.c
@@ -135,9 +135,9 @@ static int read_and_verify_repository_format(struct repository_format *format,
* Initialize 'repo' based on the provided 'gitdir'.
* Return 0 upon success and a non-zero value upon failure.
*/
-static int repo_init(struct repository *repo,
- const char *gitdir,
- const char *worktree)
+int repo_init(struct repository *repo,
+ const char *gitdir,
+ const char *worktree)
{
struct repository_format format;
memset(repo, 0, sizeof(*repo));