Win32: patch Windows environment on startup
[git/mingw/4msysgit/kblees.git] / t / t4102-apply-rename.sh
blobe3ea3d5114b8f6a09b79c9a1323c563da0c7b170
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git apply handling copy/rename patch.
9 . ./test-lib.sh
10 . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh
12 # setup
14 cat >test-patch <<\EOF
15 diff --git a/foo b/bar
16 similarity index 47%
17 rename from foo
18 rename to bar
19 --- a/foo
20 +++ b/bar
21 @@ -1 +1 @@
22 -This is foo
23 +This is bar
24 EOF
26 echo 'This is foo' >foo
27 chmod +x 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
44 similarity index 47%
45 copy from foo
46 copy to bar
47 --- a/foo
48 +++ b/bar
49 @@ -1 +1 @@
50 -This is foo
51 +This is bar
52 EOF
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"'
58 test_done