3 # Copyright (c) 2005 Junio C Hamano
4 # Copyright (c) 2005 Robert Fitzsimons
7 test_description
='git-apply test patches with multiple fragments.
18 cat > patch1.
patch <<\EOF
19 diff --git a
/main.c b
/main.c
27 +void print_int
(int num
);
32 + for (i
= 0; i
< 10; i
++) {
43 +void print_int
(int num
) {
48 cat > patch2.
patch <<\EOF
49 diff --git a
/main.c b
/main.c
57 void print_int
(int num
);
80 cat > patch3.
patch <<\EOF
81 diff --git a
/main.c b
/main.c
89 void print_int
(int num
);
112 cat > patch4.
patch <<\EOF
113 diff --git a
/main.c b
/main.c
120 -void print_int
(int num
);
126 for (i
= 0; i
< 10; i
++) {
127 - print_int
(func
(i
));
128 + printf("%d", func
(i
));
129 + printf("%d", func3
(i
));
137 -void print_int
(int num
) {
139 +int func2
(int num
) {
140 + return num
* num
* num
;
145 test_expect_success
"S = git-apply (1)" \
146 'git-apply patch1.patch patch2.patch'
149 test_expect_success
"S = patch (1)" \
150 'cat patch1.patch patch2.patch | patch -p1'
152 test_expect_success
"S = cmp (1)" \
153 'cmp main.c.git main.c'
155 rm -f main.c main.c.git
157 test_expect_success
"S = git-apply (2)" \
158 'git-apply patch1.patch patch2.patch patch3.patch'
161 test_expect_success
"S = patch (2)" \
162 'cat patch1.patch patch2.patch patch3.patch | patch -p1'
164 test_expect_success
"S = cmp (2)" \
165 'cmp main.c.git main.c'
167 rm -f main.c main.c.git
169 test_expect_success
"S = git-apply (3)" \
170 'git-apply patch1.patch patch4.patch'
173 test_expect_success
"S = patch (3)" \
174 'cat patch1.patch patch4.patch | patch -p1'
176 test_expect_success
"S = cmp (3)" \
177 'cmp main.c.git main.c'