3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git apply handling copy/rename patch.
10 . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh
14 cat >test-patch <<\EOF
15 diff --git a/foo b/bar
26 echo 'This is foo' >foo
29 test_expect_success setup \
30 'git update-index --add foo'
32 test_expect_success apply \
33 'git apply --index --stat --summary --apply test-patch'
35 test_expect_success FILEMODE validate \
36 'test -f bar && ls -l bar | grep "^-..x......"'
38 test_expect_success 'apply reverse' \
39 'git apply -R --index --stat --summary --apply test-patch &&
40 test "$(cat foo)" = "This is foo"'
42 cat >test-patch <<\EOF
43 diff --git a/foo b/bar
54 test_expect_success 'apply copy' \
55 'git apply --index --stat --summary --apply test-patch &&
56 test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"'