summaryrefslogtreecommitdiff
path: root/t/t7001-mv.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-01-13 11:33:47 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-01-13 11:33:47 -0800
commita65a53bf04c56ae2365f57702a810af0551899a1 (patch)
treee4dde128458fdb70348adc8164a33a95514196f5 /t/t7001-mv.sh
parentMerge branch 'jk/pull-rebase-using-fork-point' (diff)
parentrm: better document side effects when removing a submodule (diff)
downloadtgif-a65a53bf04c56ae2365f57702a810af0551899a1.tar.xz
Merge branch 'jl/submodule-mv-checkout-caveat'
With a submodule that was initialized in an old fashioned way without gitlinks, switching branches in the superproject between the one with and without the submodule may leave the submodule working tree with its embedded repository behind, as there may be unexpendable state there. Document and warn users about this. * jl/submodule-mv-checkout-caveat: rm: better document side effects when removing a submodule mv: better document side effects when moving a submodule
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 3bfdfed1f7..e3c8c2c1b8 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