From: Junio C Hamano Date: Tue, 25 Mar 2014 18:02:01 +0000 (-0700) Subject: Merge branch 'jk/mv-submodules-fix' X-Git-Tag: v2.0.0-rc0~71 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=12de60ac7a870cf0717ebbd9a150100219559f83;p=git-core%2Fgit.git Merge branch 'jk/mv-submodules-fix' "git mv" that moves a submodule forgot to adjust the array that uses to keep track of which submodules were to be moved to update its configuration. * jk/mv-submodules-fix: mv: prevent mismatched data when ignoring errors. builtin/mv: fix out of bounds write --- 12de60ac7a870cf0717ebbd9a150100219559f83 diff --cc t/t7001-mv.sh index e3c8c2c1b,4023b6ec4..215d43d6a --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@@ -442,25 -443,14 +443,35 @@@ test_expect_success 'mv --dry-run does 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_expect_success 'mv -k does not accidentally destroy submodules' ' + git checkout submodule && + mkdir dummy dest && + git mv -k dummy sub dest && + git status --porcelain >actual && + grep "^R sub -> dest/sub" actual && + git reset --hard && + git checkout . + ' + test_done