diff options
author | Stefan Beller <sbeller@google.com> | 2016-04-19 11:32:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-19 11:54:50 -0700 |
commit | a127331cd812336235cb95b45b7e4c52c433be7f (patch) | |
tree | 81371dd5392e9b10904a4cfd668dad0e06ca996f /t | |
parent | Git 2.6.6 (diff) | |
download | tgif-a127331cd812336235cb95b45b7e4c52c433be7f.tar.xz |
mv: allow moving nested submodules
When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.
submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t7001-mv.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 7b56081137..fcfc953f3d 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -292,6 +292,9 @@ test_expect_success 'setup submodule' ' echo content >file && git add file && git commit -m "added sub and file" && + mkdir -p deep/directory/hierachy && + git submodule add ./. deep/directory/hierachy/sub && + git commit -m "added another submodule" && git branch submodule ' @@ -475,4 +478,17 @@ test_expect_success 'mv -k does not accidentally destroy submodules' ' git checkout . ' +test_expect_success 'moving a submodule in nested directories' ' + ( + cd deep && + git mv directory ../ && + # git status would fail if the update of linking git dir to + # work dir of the submodule failed. + git status && + git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual && + echo "directory/hierachy/sub" >../expect + ) && + test_cmp actual expect +' + test_done |