3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='git apply handling copy/rename patch.
10 TEST_PASSES_SANITIZE_LEAK
=true
15 cat >test-patch
<<\EOF
16 diff --git a
/foo b
/bar
27 echo 'This is foo' >foo
30 test_expect_success setup \
31 'git update-index --add foo'
33 test_expect_success apply \
34 'git apply --index --stat --summary --apply test-patch'
36 test_expect_success FILEMODE validate \
37 'test -f bar && ls -l bar | grep "^-..x......"'
39 test_expect_success
'apply reverse' \
40 'git apply -R --index --stat --summary --apply test-patch &&
41 test "$(cat foo)" = "This is foo"'
43 cat >test-patch
<<\EOF
44 diff --git a
/foo b
/bar
55 test_expect_success
'apply copy' \
56 'git apply --index --stat --summary --apply test-patch &&
57 test "$(cat bar)" = "This is bar" && test "$(cat foo)" = "This is foo"'