mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
90924d55c5
git-mv needs to be run from the base directory so that the check if a file is under revision also covers files outside of a subdirectory. Previously, e.g. in the git repo, cd Documentation; git-mv ../README . produced the error Error: '../README' not under version control The test is extended for this case; it previously only tested one direction. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
41 lines
1 KiB
Bash
Executable file
41 lines
1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='git-mv in subdirs'
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success \
|
|
'prepare reference tree' \
|
|
'mkdir path0 path1 &&
|
|
cp ../../COPYING path0/COPYING &&
|
|
git-add path0/COPYING &&
|
|
git-commit -m add -a'
|
|
|
|
test_expect_success \
|
|
'moving the file out of subdirectory' \
|
|
'cd path0 && git-mv COPYING ../path1/COPYING'
|
|
|
|
# in path0 currently
|
|
test_expect_success \
|
|
'commiting the change' \
|
|
'cd .. && git-commit -m move-out -a'
|
|
|
|
test_expect_success \
|
|
'checking the commit' \
|
|
'git-diff-tree -r -M --name-status HEAD^ HEAD | \
|
|
grep -E "^R100.+path0/COPYING.+path1/COPYING"'
|
|
|
|
test_expect_success \
|
|
'moving the file back into subdirectory' \
|
|
'cd path0 && git-mv ../path1/COPYING COPYING'
|
|
|
|
# in path0 currently
|
|
test_expect_success \
|
|
'commiting the change' \
|
|
'cd .. && git-commit -m move-in -a'
|
|
|
|
test_expect_success \
|
|
'checking the commit' \
|
|
'git-diff-tree -r -M --name-status HEAD^ HEAD | \
|
|
grep -E "^R100.+path1/COPYING.+path0/COPYING"'
|
|
|
|
test_done
|