aboutsummaryrefslogtreecommitdiff
path: root/t/t7001-mv.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2014-01-07 22:31:32 +0100
committerJunio C Hamano <gitster@pobox.com>2014-01-07 14:33:04 -0800
commit1cbd18300a8755ba46791b2aa6249fa537a1d651 (patch)
treefc770d1d8fbd67441ec085435995554187d54031 /t/t7001-mv.sh
parent932f7e47699993de0f6ad2af92be613994e40afe (diff)
downloadgit-1cbd18300a8755ba46791b2aa6249fa537a1d651.tar.gz
git-1cbd18300a8755ba46791b2aa6249fa537a1d651.tar.xz
mv: better document side effects when moving a submodule
The "Submodules" section of the "git mv" documentation mentions what will happen when a submodule with a gitfile gets moved with newer git. But it doesn't talk about what happens when the user changes between commits before and after the move, which does not update the work tree like using the mv command did the first time. Explain what happens and what the user has to do manually to fix that in the new BUGS section. Also document this behavior in a new test. Reported-by: George Papanikolaou <g3orge.app@gmail.com> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7001-mv.sh')
-rwxr-xr-xt/t7001-mv.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 3bfdfed1f..e3c8c2c1b 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
git diff-files --quiet -- sub .gitmodules
'
+test_expect_success 'checking out a commit before submodule moved needs manual updates' '
+ git mv sub sub2 &&
+ git commit -m "moved sub to sub2" &&
+ git checkout -q HEAD^ 2>actual &&
+ echo "warning: unable to rmdir sub2: Directory not empty" >expected &&
+ test_i18ncmp expected actual &&
+ git status -s sub2 >actual &&
+ echo "?? sub2/" >expected &&
+ test_cmp expected actual &&
+ ! test -f sub/.git &&
+ test -f sub2/.git &&
+ git submodule update &&
+ test -f sub/.git &&
+ rm -rf sub2 &&
+ git diff-index --exit-code HEAD &&
+ git update-index --refresh &&
+ git diff-files --quiet -- sub .gitmodules &&
+ git status -s sub2 >actual &&
+ ! test -s actual
+'
+
test_done