Clean up trailing whitespace when pretty-printing commits
[git/spearce.git] / t / t4110-apply-scan.sh
blob005f74481625e88a4f36bd5f17d339c1924778c4
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 # setup
14 cat > patch1.patch <<\EOF
15 diff --git a/new.txt b/new.txt
16 new file mode 100644
17 --- /dev/null
18 +++ b/new.txt
19 @@ -0,0 +1,12 @@
20 +a1
21 +a11
22 +a111
23 +a1111
24 +b1
25 +b11
26 +b111
27 +b1111
28 +c1
29 +c11
30 +c111
31 +c1111
32 EOF
33 cat > patch2.patch <<\EOF
34 diff --git a/new.txt b/new.txt
35 --- a/new.txt
36 +++ b/new.txt
37 @@ -1,7 +1,3 @@
38 -a1
39 -a11
40 -a111
41 -a1111
43 b11
44 b111
45 EOF
46 cat > patch3.patch <<\EOF
47 diff --git a/new.txt b/new.txt
48 --- a/new.txt
49 +++ b/new.txt
50 @@ -6,6 +6,10 @@
51 b11
52 b111
53 b1111
54 +b2
55 +b22
56 +b222
57 +b2222
59 c11
60 c111
61 EOF
62 cat > patch4.patch <<\EOF
63 diff --git a/new.txt b/new.txt
64 --- a/new.txt
65 +++ b/new.txt
66 @@ -1,3 +1,7 @@
67 +a1
68 +a11
69 +a111
70 +a1111
72 b11
73 b111
74 EOF
75 cat > patch5.patch <<\EOF
76 diff --git a/new.txt b/new.txt
77 --- a/new.txt
78 +++ b/new.txt
79 @@ -10,3 +10,7 @@
80 c11
81 c111
82 c1111
83 +c2
84 +c22
85 +c222
86 +c2222
87 EOF
89 test_expect_success "S = git-apply scan" \
90 'git-apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch'
91 mv new.txt apply.txt
93 test_expect_success "S = patch scan" \
94 'cat patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch | patch'
95 mv new.txt patch.txt
97 test_expect_success "S = cmp" \
98 'cmp apply.txt patch.txt'
100 test_done