3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git-apply with rejects
12 test_expect_success setup '
13 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
17 cat file1 >saved.file1 &&
18 git update-index --add file1 &&
19 git commit -m initial &&
21 for i in 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21
28 git update-index --add --remove file1 file2 &&
29 git diff -M HEAD >patch.2 &&
32 mv saved.file1 file1 &&
33 git update-index --add --remove file1 file2 &&
35 for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21
40 cat file1 >saved.file1
43 test_expect_success 'apply without --reject should fail' '
51 diff -u file1 saved.file1
54 test_expect_success 'apply with --reject should fail but update the file' '
56 cat saved.file1 >file1
58 if git apply --reject patch.1 >rejects
60 echo "succeeds with --reject?"
64 for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21
67 done >expected.file1 &&
69 diff -u file1 expected.file1
72 test_expect_success 'apply with --reject should fail but update the file' '
74 cat saved.file1 >file1
76 if git apply --reject patch.2 >rejects
78 echo "succeeds with --reject?"
84 for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21
87 done >expected.file2 &&
90 echo "file1 still exists?"
93 diff -u file2 expected.file2