3 # Copyright (c) 2009 Junio C Hamano
5 test_description
='git-apply notices removal patches generated by GNU diff'
9 test_expect_success setup
'
11 diff -ruN a/file b/file
19 diff -ruN a/file b/file
26 timeWest="1982-09-16 07:00:00.000000000 -0800" &&
27 timeGMT="1982-09-16 15:00:00.000000000 +0000" &&
28 timeEast="1982-09-17 00:00:00.000000000 +0900" &&
30 epocWest="1969-12-31 16:00:00.000000000 -0800" &&
31 epocGMT="1970-01-01 00:00:00.000000000 +0000" &&
32 epocEast="1970-01-01 09:00:00.000000000 +0900" &&
33 epocWest2="1969-12-31 16:00:00 -08:00" &&
35 sed -e "s/TS0/$epocWest/" -e "s/TS1/$timeWest/" <c >createWest.patch &&
36 sed -e "s/TS0/$epocEast/" -e "s/TS1/$timeEast/" <c >createEast.patch &&
37 sed -e "s/TS0/$epocGMT/" -e "s/TS1/$timeGMT/" <c >createGMT.patch &&
39 sed -e "s/TS0/$timeWest/" -e "s/TS1/$timeWest/" <c >addWest.patch &&
40 sed -e "s/TS0/$timeEast/" -e "s/TS1/$timeEast/" <c >addEast.patch &&
41 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$timeGMT/" <c >addGMT.patch &&
43 sed -e "s/TS0/$timeWest/" -e "s/TS1/$timeWest/" <d >emptyWest.patch &&
44 sed -e "s/TS0/$timeEast/" -e "s/TS1/$timeEast/" <d >emptyEast.patch &&
45 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$timeGMT/" <d >emptyGMT.patch &&
47 sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest/" <d >removeWest.patch &&
48 sed -e "s/TS0/$timeEast/" -e "s/TS1/$epocEast/" <d >removeEast.patch &&
49 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$epocGMT/" <d >removeGMT.patch &&
50 sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest2/" <d >removeWest2.patch &&
52 echo something >something
57 test_expect_success
"test $patch" '
58 rm -f file .git/index &&
61 # must be able to create
62 git apply --index $patch &&
63 test_cmp file something &&
64 # must notice the file is already there
67 test_must_fail git apply $patch
70 # must be able to create or patch
72 test_cmp file something &&
75 test_cmp file something
78 # must leave an empty file
79 cat something >file &&
81 git apply --index $patch &&
83 test_must_be_empty file
86 # must remove the file
87 cat something >file &&
89 git apply --index $patch &&