X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft4102-apply-rename.sh;h=d42abff1ad59343fa1c84bded9a82c3212370da0;hb=a79b8b6623288f7d5409ad749cc6553976a4f0e8;hp=f591a5681dc4ac4abe44cc04a488414481c98ac5;hpb=b30245c8e92ecaf8fb877189d7620a5a9a205120;p=git.git diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh index f591a5681..d42abff1a 100755 --- a/t/t4102-apply-rename.sh +++ b/t/t4102-apply-rename.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply handling copy/rename patch. +test_description='git apply handling copy/rename patch. ' . ./test-lib.sh @@ -13,8 +13,8 @@ test_description='git-apply handling copy/rename patch. cat >test-patch <<\EOF diff --git a/foo b/bar similarity index 47% -copy from foo -copy to bar +rename from foo +rename to bar --- a/foo +++ b/bar @@ -1 +1 @@ @@ -26,12 +26,37 @@ echo 'This is foo' >foo chmod +x foo test_expect_success setup \ - 'git-update-cache --add foo' + 'git update-index --add foo' test_expect_success apply \ - 'git-apply --index --stat --summary --apply test-patch' + 'git apply --index --stat --summary --apply test-patch' + +if [ "$(git config --get core.filemode)" = false ] +then + say 'filemode disabled on the filesystem' +else + test_expect_success validate \ + 'test -f bar && ls -l bar | grep "^-..x......"' +fi + +test_expect_success 'apply reverse' \ + 'git apply -R --index --stat --summary --apply test-patch && + test "$(cat foo)" = "This is foo"' + +cat >test-patch <<\EOF +diff --git a/foo b/bar +similarity index 47% +copy from foo +copy to bar +--- a/foo ++++ b/bar +@@ -1 +1 @@ +-This is foo ++This is bar +EOF -test_expect_success validate \ - 'test -f bar && ls -l bar | grep "^-..x..x..x"' +test_expect_success 'apply copy' \ + 'git apply --index --stat --summary --apply test-patch && + test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"' test_done