t5300-pack-object: Set up the objects for --strict tests only once.
[git/mingw.git] / t / t4110-apply-scan.sh
blobd1c42e104d2b02db7869b8875541bd6fcf7baa6f
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
4 # Copyright (c) 2005 Robert Fitzsimons
7 test_description='git apply test for patches which require scanning forwards and backwards.
10 . ./test-lib.sh
12 cmp () {
13 diff -w "$@"
16 # setup
18 cat > patch1.patch <<\EOF
19 diff --git a/new.txt b/new.txt
20 new file mode 100644
21 --- /dev/null
22 +++ b/new.txt
23 @@ -0,0 +1,12 @@
24 +a1
25 +a11
26 +a111
27 +a1111
28 +b1
29 +b11
30 +b111
31 +b1111
32 +c1
33 +c11
34 +c111
35 +c1111
36 EOF
37 cat > patch2.patch <<\EOF
38 diff --git a/new.txt b/new.txt
39 --- a/new.txt
40 +++ b/new.txt
41 @@ -1,7 +1,3 @@
42 -a1
43 -a11
44 -a111
45 -a1111
47 b11
48 b111
49 EOF
50 cat > patch3.patch <<\EOF
51 diff --git a/new.txt b/new.txt
52 --- a/new.txt
53 +++ b/new.txt
54 @@ -6,6 +6,10 @@
55 b11
56 b111
57 b1111
58 +b2
59 +b22
60 +b222
61 +b2222
63 c11
64 c111
65 EOF
66 cat > patch4.patch <<\EOF
67 diff --git a/new.txt b/new.txt
68 --- a/new.txt
69 +++ b/new.txt
70 @@ -1,3 +1,7 @@
71 +a1
72 +a11
73 +a111
74 +a1111
76 b11
77 b111
78 EOF
79 cat > patch5.patch <<\EOF
80 diff --git a/new.txt b/new.txt
81 --- a/new.txt
82 +++ b/new.txt
83 @@ -10,3 +10,7 @@
84 c11
85 c111
86 c1111
87 +c2
88 +c22
89 +c222
90 +c2222
91 EOF
93 test_expect_success "S = git apply scan" \
94 'git apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch'
95 mv new.txt apply.txt
97 test_expect_success "S = patch scan" \
98 'cat patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch | patch'
99 mv new.txt patch.txt
101 test_expect_success "S = cmp" \
102 'cmp apply.txt patch.txt'
104 test_done