From: Junio C Hamano Date: Wed, 16 Apr 2014 20:38:55 +0000 (-0700) Subject: Merge branch 'km/avoid-cp-a' X-Git-Tag: v2.0.0-rc0~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/51bb8adbc9d59ae042eb9134e5218240a1532bea?hp=-c Merge branch 'km/avoid-cp-a' Portability fix. * km/avoid-cp-a: test: fix t7001 cp to use POSIX options --- 51bb8adbc9d59ae042eb9134e5218240a1532bea diff --combined t/t7001-mv.sh index 34fb1afbb3,9727e79b68..54d78079e8 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@@ -294,8 -294,7 +294,8 @@@ test_expect_success 'setup submodule' git submodule add ./. sub && echo content >file && git add file && - git commit -m "added sub and file" + git commit -m "added sub and file" && + git branch submodule ' test_expect_success 'git mv cannot move a submodule in a file' ' @@@ -308,7 -307,7 +308,7 @@@ test_expect_success 'git mv moves a sub ( cd sub && rm -f .git && - cp -a ../.git/modules/sub .git && + cp -R -P -p ../.git/modules/sub .git && GIT_WORK_TREE=. git config --unset core.worktree ) && mkdir mod && @@@ -331,7 -330,7 +331,7 @@@ test_expect_success 'git mv moves a sub ( cd sub && rm -f .git && - cp -a ../.git/modules/sub .git && + cp -R -P -p ../.git/modules/sub .git && GIT_WORK_TREE=. git config --unset core.worktree ) && mkdir mod && @@@ -443,34 -442,4 +443,34 @@@ 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 && + test_i18ngrep "^warning: unable to rmdir sub2:" 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