]> git.ipfire.org Git - thirdparty/git.git/commit - repository.c
submodule: fixup nested submodules after moving the submodule
authorStefan Beller <sbeller@google.com>
Wed, 28 Mar 2018 22:35:31 +0000 (15:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Mar 2018 16:44:51 +0000 (09:44 -0700)
commitda62f786d2df60f3c8255cf4cbbcd9c1f9458d99
tree9a0a2c11baadcabfbdd1c4044e7252a3b8862af4
parent0c89fdd739183234f86fe2be03a0374705ed93ed
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>
builtin/mv.c
builtin/submodule--helper.c
dir.c
dir.h
repository.c
repository.h
submodule.c
t/t7001-mv.sh