Blame


1 e9ce266e 2022-03-07 op #!/bin/sh
2 e9ce266e 2022-03-07 op #
3 e9ce266e 2022-03-07 op # Copyright (c) 2022 Omar Polo <op@openbsd.org>
4 e9ce266e 2022-03-07 op #
5 e9ce266e 2022-03-07 op # Permission to use, copy, modify, and distribute this software for any
6 e9ce266e 2022-03-07 op # purpose with or without fee is hereby granted, provided that the above
7 e9ce266e 2022-03-07 op # copyright notice and this permission notice appear in all copies.
8 e9ce266e 2022-03-07 op #
9 e9ce266e 2022-03-07 op # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 e9ce266e 2022-03-07 op # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 e9ce266e 2022-03-07 op # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 e9ce266e 2022-03-07 op # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 e9ce266e 2022-03-07 op # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 e9ce266e 2022-03-07 op # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 e9ce266e 2022-03-07 op # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 e9ce266e 2022-03-07 op
17 e9ce266e 2022-03-07 op . ./common.sh
18 e9ce266e 2022-03-07 op
19 ed2ff8b9 2022-07-02 op test_patch_add_file() {
20 ed2ff8b9 2022-07-02 op local testroot=`test_init patch_add_file`
21 e9ce266e 2022-03-07 op
22 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
23 e9ce266e 2022-03-07 op ret=$?
24 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
25 e9ce266e 2022-03-07 op test_done $testroot $ret
26 e9ce266e 2022-03-07 op return 1
27 e9ce266e 2022-03-07 op fi
28 e9ce266e 2022-03-07 op
29 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
30 e9ce266e 2022-03-07 op --- /dev/null
31 e9ce266e 2022-03-07 op +++ eta
32 ed2ff8b9 2022-07-02 op @@ -0,0 +5,5 @@
33 ed2ff8b9 2022-07-02 op +1
34 ed2ff8b9 2022-07-02 op +2
35 ed2ff8b9 2022-07-02 op +3
36 ed2ff8b9 2022-07-02 op +4
37 ed2ff8b9 2022-07-02 op +5
38 e9ce266e 2022-03-07 op EOF
39 e9ce266e 2022-03-07 op
40 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
41 e9ce266e 2022-03-07 op ret=$?
42 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
43 e9ce266e 2022-03-07 op test_done $testroot $ret
44 e9ce266e 2022-03-07 op return 1
45 e9ce266e 2022-03-07 op fi
46 e9ce266e 2022-03-07 op
47 e9ce266e 2022-03-07 op echo "A eta" > $testroot/stdout.expected
48 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
49 e9ce266e 2022-03-07 op ret=$?
50 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
51 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
52 e9ce266e 2022-03-07 op test_done $testroot $ret
53 e9ce266e 2022-03-07 op return 1
54 e9ce266e 2022-03-07 op fi
55 e9ce266e 2022-03-07 op
56 ed2ff8b9 2022-07-02 op jot 5 > $testroot/wt/eta.expected
57 e9ce266e 2022-03-07 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
58 e9ce266e 2022-03-07 op ret=$?
59 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
60 e9ce266e 2022-03-07 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
61 e9ce266e 2022-03-07 op fi
62 e9ce266e 2022-03-07 op test_done $testroot $ret
63 e9ce266e 2022-03-07 op }
64 e9ce266e 2022-03-07 op
65 f5b0315f 2022-07-02 op test_patch_rm_file() {
66 f5b0315f 2022-07-02 op local testroot=`test_init patch_rm_file`
67 e9ce266e 2022-03-07 op
68 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
69 e9ce266e 2022-03-07 op ret=$?
70 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
71 e9ce266e 2022-03-07 op test_done $testroot $ret
72 e9ce266e 2022-03-07 op return 1
73 e9ce266e 2022-03-07 op fi
74 e9ce266e 2022-03-07 op
75 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
76 e9ce266e 2022-03-07 op --- alpha
77 e9ce266e 2022-03-07 op +++ /dev/null
78 e9ce266e 2022-03-07 op @@ -1 +0,0 @@
79 e9ce266e 2022-03-07 op -alpha
80 e9ce266e 2022-03-07 op EOF
81 e9ce266e 2022-03-07 op
82 e9ce266e 2022-03-07 op echo "D alpha" > $testroot/stdout.expected
83 e9ce266e 2022-03-07 op
84 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
85 e9ce266e 2022-03-07 op ret=$?
86 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
87 e9ce266e 2022-03-07 op test_done $testroot $ret
88 e9ce266e 2022-03-07 op return 1
89 e9ce266e 2022-03-07 op fi
90 e9ce266e 2022-03-07 op
91 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
92 e9ce266e 2022-03-07 op ret=$?
93 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
94 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
95 e9ce266e 2022-03-07 op test_done $testroot $ret
96 e9ce266e 2022-03-07 op return 1
97 e9ce266e 2022-03-07 op fi
98 e9ce266e 2022-03-07 op
99 e9ce266e 2022-03-07 op if [ -f $testroot/wt/alpha ]; then
100 e9ce266e 2022-03-07 op ret=1
101 e9ce266e 2022-03-07 op echo "alpha still exists!"
102 e9ce266e 2022-03-07 op fi
103 e9ce266e 2022-03-07 op test_done $testroot $ret
104 e9ce266e 2022-03-07 op }
105 e9ce266e 2022-03-07 op
106 e9ce266e 2022-03-07 op test_patch_simple_edit_file() {
107 e9ce266e 2022-03-07 op local testroot=`test_init patch_simple_edit_file`
108 e9ce266e 2022-03-07 op
109 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
110 e9ce266e 2022-03-07 op ret=$?
111 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
112 e9ce266e 2022-03-07 op test_done $testroot $ret
113 e9ce266e 2022-03-07 op return 1
114 e9ce266e 2022-03-07 op fi
115 e9ce266e 2022-03-07 op
116 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
117 e9ce266e 2022-03-07 op --- alpha
118 e9ce266e 2022-03-07 op +++ alpha
119 e9ce266e 2022-03-07 op @@ -1 +1 @@
120 e9ce266e 2022-03-07 op -alpha
121 e9ce266e 2022-03-07 op +alpha is my favourite character
122 e9ce266e 2022-03-07 op EOF
123 e9ce266e 2022-03-07 op
124 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
125 e9ce266e 2022-03-07 op
126 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
127 e9ce266e 2022-03-07 op ret=$?
128 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
129 e9ce266e 2022-03-07 op test_done $testroot $ret
130 e9ce266e 2022-03-07 op return 1
131 e9ce266e 2022-03-07 op fi
132 e9ce266e 2022-03-07 op
133 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
134 e9ce266e 2022-03-07 op ret=$?
135 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
136 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
137 e9ce266e 2022-03-07 op test_done $testroot $ret
138 e9ce266e 2022-03-07 op return 1
139 e9ce266e 2022-03-07 op fi
140 e9ce266e 2022-03-07 op
141 e9ce266e 2022-03-07 op echo 'alpha is my favourite character' > $testroot/wt/alpha.expected
142 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
143 e9ce266e 2022-03-07 op ret=$?
144 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
145 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
146 e9ce266e 2022-03-07 op fi
147 e9ce266e 2022-03-07 op test_done $testroot $ret
148 e9ce266e 2022-03-07 op }
149 e9ce266e 2022-03-07 op
150 e9ce266e 2022-03-07 op test_patch_prepend_line() {
151 e9ce266e 2022-03-07 op local testroot=`test_init patch_prepend_line`
152 e9ce266e 2022-03-07 op
153 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
154 e9ce266e 2022-03-07 op ret=$?
155 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
156 e9ce266e 2022-03-07 op test_done $testroot $ret
157 e9ce266e 2022-03-07 op return 1
158 e9ce266e 2022-03-07 op fi
159 e9ce266e 2022-03-07 op
160 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
161 e9ce266e 2022-03-07 op --- alpha
162 e9ce266e 2022-03-07 op +++ alpha
163 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
164 e9ce266e 2022-03-07 op +hatsuseno
165 e9ce266e 2022-03-07 op alpha
166 e9ce266e 2022-03-07 op EOF
167 e9ce266e 2022-03-07 op
168 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
169 e9ce266e 2022-03-07 op
170 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
171 e9ce266e 2022-03-07 op ret=$?
172 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
173 e9ce266e 2022-03-07 op test_done $testroot $ret
174 e9ce266e 2022-03-07 op return 1
175 e9ce266e 2022-03-07 op fi
176 e9ce266e 2022-03-07 op
177 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
178 e9ce266e 2022-03-07 op ret=$?
179 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
180 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
181 e9ce266e 2022-03-07 op test_done $testroot $ret
182 e9ce266e 2022-03-07 op return 1
183 e9ce266e 2022-03-07 op fi
184 e9ce266e 2022-03-07 op
185 e9ce266e 2022-03-07 op echo hatsuseno > $testroot/wt/alpha.expected
186 e9ce266e 2022-03-07 op echo alpha >> $testroot/wt/alpha.expected
187 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
188 e9ce266e 2022-03-07 op ret=$?
189 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
190 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
191 e9ce266e 2022-03-07 op fi
192 e9ce266e 2022-03-07 op test_done $testroot $ret
193 e9ce266e 2022-03-07 op }
194 e9ce266e 2022-03-07 op
195 e9ce266e 2022-03-07 op test_patch_replace_line() {
196 e9ce266e 2022-03-07 op local testroot=`test_init patch_replace_line`
197 e9ce266e 2022-03-07 op
198 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
199 e9ce266e 2022-03-07 op ret=$?
200 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
201 e9ce266e 2022-03-07 op test_done $testroot $ret
202 e9ce266e 2022-03-07 op return 1
203 e9ce266e 2022-03-07 op fi
204 e9ce266e 2022-03-07 op
205 e9ce266e 2022-03-07 op jot 10 > $testroot/wt/numbers
206 e9ce266e 2022-03-07 op (cd $testroot/wt/ && got add numbers && got ci -m 'add numbers') \
207 e9ce266e 2022-03-07 op >/dev/null
208 e9ce266e 2022-03-07 op ret=$?
209 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
210 e9ce266e 2022-03-07 op test_done $testroot $ret
211 e9ce266e 2022-03-07 op return 1
212 e9ce266e 2022-03-07 op fi
213 e9ce266e 2022-03-07 op
214 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
215 e9ce266e 2022-03-07 op --- numbers
216 e9ce266e 2022-03-07 op +++ numbers
217 e9ce266e 2022-03-07 op @@ -3,7 +3,7 @@
218 e9ce266e 2022-03-07 op 3
219 e9ce266e 2022-03-07 op 4
220 e9ce266e 2022-03-07 op 5
221 e9ce266e 2022-03-07 op -6
222 e9ce266e 2022-03-07 op +foo
223 e9ce266e 2022-03-07 op 7
224 e9ce266e 2022-03-07 op 8
225 e9ce266e 2022-03-07 op 9
226 e9ce266e 2022-03-07 op EOF
227 e9ce266e 2022-03-07 op
228 e9ce266e 2022-03-07 op echo "M numbers" > $testroot/stdout.expected
229 e9ce266e 2022-03-07 op
230 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
231 e9ce266e 2022-03-07 op ret=$?
232 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
233 e9ce266e 2022-03-07 op test_done $testroot $ret
234 e9ce266e 2022-03-07 op return 1
235 e9ce266e 2022-03-07 op fi
236 e9ce266e 2022-03-07 op
237 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
238 e9ce266e 2022-03-07 op ret=$?
239 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
240 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
241 e9ce266e 2022-03-07 op test_done $testroot $ret
242 e9ce266e 2022-03-07 op return 1
243 e9ce266e 2022-03-07 op fi
244 e9ce266e 2022-03-07 op
245 e9ce266e 2022-03-07 op jot 10 | sed 's/6/foo/' > $testroot/wt/numbers.expected
246 e9ce266e 2022-03-07 op cmp -s $testroot/wt/numbers.expected $testroot/wt/numbers
247 e9ce266e 2022-03-07 op ret=$?
248 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
249 e9ce266e 2022-03-07 op diff -u $testroot/wt/numbers.expected $testroot/wt/numbers
250 e9ce266e 2022-03-07 op fi
251 e9ce266e 2022-03-07 op test_done $testroot $ret
252 e9ce266e 2022-03-07 op }
253 e9ce266e 2022-03-07 op
254 e9ce266e 2022-03-07 op test_patch_multiple_hunks() {
255 fd79e2e0 2022-03-08 op local testroot=`test_init patch_replace_multiple_hunks`
256 e9ce266e 2022-03-07 op
257 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
258 e9ce266e 2022-03-07 op ret=$?
259 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
260 e9ce266e 2022-03-07 op test_done $testroot $ret
261 e9ce266e 2022-03-07 op return 1
262 e9ce266e 2022-03-07 op fi
263 e9ce266e 2022-03-07 op
264 e9ce266e 2022-03-07 op jot 100 > $testroot/wt/numbers
265 e9ce266e 2022-03-07 op (cd $testroot/wt/ && got add numbers && got ci -m 'add numbers') \
266 e9ce266e 2022-03-07 op >/dev/null
267 e9ce266e 2022-03-07 op ret=$?
268 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
269 e9ce266e 2022-03-07 op test_done $testroot $ret
270 e9ce266e 2022-03-07 op return 1
271 e9ce266e 2022-03-07 op fi
272 e9ce266e 2022-03-07 op
273 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
274 e9ce266e 2022-03-07 op --- numbers
275 e9ce266e 2022-03-07 op +++ numbers
276 e9ce266e 2022-03-07 op @@ -3,7 +3,7 @@
277 e9ce266e 2022-03-07 op 3
278 e9ce266e 2022-03-07 op 4
279 e9ce266e 2022-03-07 op 5
280 e9ce266e 2022-03-07 op -6
281 e9ce266e 2022-03-07 op +foo
282 e9ce266e 2022-03-07 op 7
283 e9ce266e 2022-03-07 op 8
284 e9ce266e 2022-03-07 op 9
285 e9ce266e 2022-03-07 op @@ -57,7 +57,7 @@
286 e9ce266e 2022-03-07 op 57
287 e9ce266e 2022-03-07 op 58
288 e9ce266e 2022-03-07 op 59
289 e9ce266e 2022-03-07 op -60
290 e9ce266e 2022-03-07 op +foo foo
291 e9ce266e 2022-03-07 op 61
292 e9ce266e 2022-03-07 op 62
293 e9ce266e 2022-03-07 op 63
294 e9ce266e 2022-03-07 op @@ -98,3 +98,6 @@
295 e9ce266e 2022-03-07 op 98
296 e9ce266e 2022-03-07 op 99
297 e9ce266e 2022-03-07 op 100
298 e9ce266e 2022-03-07 op +101
299 e9ce266e 2022-03-07 op +102
300 e9ce266e 2022-03-07 op +...
301 e9ce266e 2022-03-07 op EOF
302 e9ce266e 2022-03-07 op
303 e9ce266e 2022-03-07 op echo "M numbers" > $testroot/stdout.expected
304 e9ce266e 2022-03-07 op
305 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
306 e9ce266e 2022-03-07 op ret=$?
307 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
308 e9ce266e 2022-03-07 op test_done $testroot $ret
309 e9ce266e 2022-03-07 op return 1
310 e9ce266e 2022-03-07 op fi
311 e9ce266e 2022-03-07 op
312 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
313 e9ce266e 2022-03-07 op ret=$?
314 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
315 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
316 e9ce266e 2022-03-07 op test_done $testroot $ret
317 e9ce266e 2022-03-07 op return 1
318 e9ce266e 2022-03-07 op fi
319 e9ce266e 2022-03-07 op
320 e9ce266e 2022-03-07 op jot 100 | sed -e 's/^6$/foo/' -e 's/^60$/foo foo/' \
321 e9ce266e 2022-03-07 op > $testroot/wt/numbers.expected
322 e9ce266e 2022-03-07 op echo "101" >> $testroot/wt/numbers.expected
323 e9ce266e 2022-03-07 op echo "102" >> $testroot/wt/numbers.expected
324 e9ce266e 2022-03-07 op echo "..." >> $testroot/wt/numbers.expected
325 e9ce266e 2022-03-07 op
326 e9ce266e 2022-03-07 op cmp -s $testroot/wt/numbers.expected $testroot/wt/numbers
327 e9ce266e 2022-03-07 op ret=$?
328 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
329 e9ce266e 2022-03-07 op diff -u $testroot/wt/numbers.expected $testroot/wt/numbers
330 e9ce266e 2022-03-07 op fi
331 e9ce266e 2022-03-07 op test_done $testroot $ret
332 e9ce266e 2022-03-07 op }
333 e9ce266e 2022-03-07 op
334 e9ce266e 2022-03-07 op test_patch_multiple_files() {
335 e9ce266e 2022-03-07 op local testroot=`test_init patch_multiple_files`
336 e9ce266e 2022-03-07 op
337 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
338 e9ce266e 2022-03-07 op ret=$?
339 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
340 e9ce266e 2022-03-07 op test_done $testroot $ret
341 e9ce266e 2022-03-07 op return 1
342 e9ce266e 2022-03-07 op fi
343 e9ce266e 2022-03-07 op
344 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
345 e9ce266e 2022-03-07 op --- alpha Mon Mar 7 19:02:07 2022
346 e9ce266e 2022-03-07 op +++ alpha Mon Mar 7 19:01:53 2022
347 e9ce266e 2022-03-07 op @@ -1 +1,3 @@
348 e9ce266e 2022-03-07 op +new
349 e9ce266e 2022-03-07 op alpha
350 e9ce266e 2022-03-07 op +available
351 e9ce266e 2022-03-07 op --- beta Mon Mar 7 19:02:11 2022
352 e9ce266e 2022-03-07 op +++ beta Mon Mar 7 19:01:46 2022
353 e9ce266e 2022-03-07 op @@ -1 +1,3 @@
354 e9ce266e 2022-03-07 op beta
355 e9ce266e 2022-03-07 op +was
356 e9ce266e 2022-03-07 op +improved
357 e9ce266e 2022-03-07 op --- gamma/delta Mon Mar 7 19:02:17 2022
358 e9ce266e 2022-03-07 op +++ gamma/delta Mon Mar 7 19:01:37 2022
359 e9ce266e 2022-03-07 op @@ -1 +1 @@
360 e9ce266e 2022-03-07 op -delta
361 e9ce266e 2022-03-07 op +delta new
362 e9ce266e 2022-03-07 op EOF
363 e9ce266e 2022-03-07 op
364 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
365 e9ce266e 2022-03-07 op echo "M beta" >> $testroot/stdout.expected
366 e9ce266e 2022-03-07 op echo "M gamma/delta" >> $testroot/stdout.expected
367 e9ce266e 2022-03-07 op
368 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
369 e9ce266e 2022-03-07 op ret=$?
370 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
371 fd79e2e0 2022-03-08 op test_done $testroot $ret
372 e9ce266e 2022-03-07 op return 1
373 e9ce266e 2022-03-07 op fi
374 e9ce266e 2022-03-07 op
375 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
376 e9ce266e 2022-03-07 op ret=$?
377 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
378 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
379 e9ce266e 2022-03-07 op test_done $testroot $ret
380 e9ce266e 2022-03-07 op return 1
381 e9ce266e 2022-03-07 op fi
382 e9ce266e 2022-03-07 op
383 e9ce266e 2022-03-07 op printf 'new\nalpha\navailable\n' > $testroot/wt/alpha.expected
384 e9ce266e 2022-03-07 op printf 'beta\nwas\nimproved\n' > $testroot/wt/beta.expected
385 e9ce266e 2022-03-07 op printf 'delta new\n' > $testroot/wt/gamma/delta.expected
386 e9ce266e 2022-03-07 op
387 e9ce266e 2022-03-07 op for f in alpha beta gamma/delta; do
388 e9ce266e 2022-03-07 op cmp -s $testroot/wt/$f.expected $testroot/wt/$f
389 e9ce266e 2022-03-07 op ret=$?
390 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
391 e9ce266e 2022-03-07 op diff -u $testroot/wt/$f.expected $testroot/wt/$f
392 e9ce266e 2022-03-07 op test_done $testroot $ret
393 e9ce266e 2022-03-07 op return 1
394 e9ce266e 2022-03-07 op fi
395 e9ce266e 2022-03-07 op done
396 e9ce266e 2022-03-07 op
397 e9ce266e 2022-03-07 op test_done $testroot 0
398 e9ce266e 2022-03-07 op }
399 e9ce266e 2022-03-07 op
400 e9ce266e 2022-03-07 op test_patch_dont_apply() {
401 e9ce266e 2022-03-07 op local testroot=`test_init patch_dont_apply`
402 e9ce266e 2022-03-07 op
403 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
404 e9ce266e 2022-03-07 op ret=$?
405 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
406 e9ce266e 2022-03-07 op test_done $testroot $ret
407 e9ce266e 2022-03-07 op return 1
408 e9ce266e 2022-03-07 op fi
409 e9ce266e 2022-03-07 op
410 5b67f96e 2022-03-13 op jot 100 > $testroot/wt/numbers
411 5b67f96e 2022-03-13 op (cd $testroot/wt && got add numbers && got commit -m 'add numbers') \
412 5b67f96e 2022-03-13 op >/dev/null
413 5b67f96e 2022-03-13 op ret=$?
414 5b67f96e 2022-03-13 op if [ $ret -ne 0 ]; then
415 5b67f96e 2022-03-13 op test_done $testroot $ret
416 5b67f96e 2022-03-13 op return 1
417 5b67f96e 2022-03-13 op fi
418 5b67f96e 2022-03-13 op
419 5b67f96e 2022-03-13 op cat <<EOF > $testroot/wt/patch
420 60aa1fa0 2022-03-17 op --- alpha
421 60aa1fa0 2022-03-17 op +++ alpha
422 60aa1fa0 2022-03-17 op @@ -1 +1,2 @@
423 60aa1fa0 2022-03-17 op +hatsuseno
424 60aa1fa0 2022-03-17 op alpha something
425 5b67f96e 2022-03-13 op --- numbers
426 5b67f96e 2022-03-13 op +++ /dev/null
427 5b67f96e 2022-03-13 op @@ -1,9 +0,0 @@
428 5b67f96e 2022-03-13 op -1
429 5b67f96e 2022-03-13 op -2
430 5b67f96e 2022-03-13 op -3
431 5b67f96e 2022-03-13 op -4
432 5b67f96e 2022-03-13 op -5
433 5b67f96e 2022-03-13 op -6
434 5b67f96e 2022-03-13 op -7
435 5b67f96e 2022-03-13 op -8
436 5b67f96e 2022-03-13 op -9
437 5b67f96e 2022-03-13 op EOF
438 5b67f96e 2022-03-13 op
439 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout 2> /dev/null
440 5b67f96e 2022-03-13 op ret=$?
441 5b67f96e 2022-03-13 op if [ $ret -eq 0 ]; then # should fail
442 5b67f96e 2022-03-13 op test_done $testroot 1
443 e9ce266e 2022-03-07 op return 1
444 e9ce266e 2022-03-07 op fi
445 e9ce266e 2022-03-07 op
446 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
447 60aa1fa0 2022-03-17 op # alpha
448 60aa1fa0 2022-03-17 op @@ -1,1 +1,2 @@ hunk failed to apply
449 60aa1fa0 2022-03-17 op # numbers
450 60aa1fa0 2022-03-17 op @@ -1,9 +0,0 @@ hunk failed to apply
451 60aa1fa0 2022-03-17 op EOF
452 60aa1fa0 2022-03-17 op
453 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
454 5b67f96e 2022-03-13 op ret=$?
455 5b67f96e 2022-03-13 op if [ $ret -ne 0 ]; then
456 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
457 5b67f96e 2022-03-13 op fi
458 e9ce266e 2022-03-07 op test_done $testroot $ret
459 e9ce266e 2022-03-07 op }
460 e9ce266e 2022-03-07 op
461 e9ce266e 2022-03-07 op test_patch_malformed() {
462 e9ce266e 2022-03-07 op local testroot=`test_init patch_malformed`
463 e9ce266e 2022-03-07 op
464 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
465 e9ce266e 2022-03-07 op ret=$?
466 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
467 e9ce266e 2022-03-07 op test_done $testroot $ret
468 e9ce266e 2022-03-07 op return 1
469 e9ce266e 2022-03-07 op fi
470 e9ce266e 2022-03-07 op
471 e9ce266e 2022-03-07 op # missing "@@"
472 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
473 e9ce266e 2022-03-07 op --- alpha
474 e9ce266e 2022-03-07 op +++ alpha
475 e9ce266e 2022-03-07 op @@ -1 +1,2
476 e9ce266e 2022-03-07 op +hatsuseno
477 e9ce266e 2022-03-07 op alpha
478 e9ce266e 2022-03-07 op EOF
479 e9ce266e 2022-03-07 op
480 e9ce266e 2022-03-07 op echo -n > $testroot/stdout.expected
481 e9ce266e 2022-03-07 op echo "got: malformed patch" > $testroot/stderr.expected
482 e9ce266e 2022-03-07 op
483 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
484 e9ce266e 2022-03-07 op > $testroot/stdout \
485 e9ce266e 2022-03-07 op 2> $testroot/stderr
486 e9ce266e 2022-03-07 op ret=$?
487 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then
488 e9ce266e 2022-03-07 op echo "got managed to apply an invalid patch"
489 e9ce266e 2022-03-07 op test_done $testroot 1
490 e9ce266e 2022-03-07 op return 1
491 e9ce266e 2022-03-07 op fi
492 e9ce266e 2022-03-07 op
493 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
494 e9ce266e 2022-03-07 op ret=$?
495 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
496 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
497 e9ce266e 2022-03-07 op test_done $testroot $ret
498 e9ce266e 2022-03-07 op return 1
499 e9ce266e 2022-03-07 op fi
500 e9ce266e 2022-03-07 op
501 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
502 e9ce266e 2022-03-07 op ret=$?
503 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
504 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
505 e9ce266e 2022-03-07 op test_done $testroot $ret
506 e9ce266e 2022-03-07 op return 1
507 e9ce266e 2022-03-07 op fi
508 e9ce266e 2022-03-07 op
509 e9ce266e 2022-03-07 op # wrong first character
510 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
511 e9ce266e 2022-03-07 op --- alpha
512 e9ce266e 2022-03-07 op +++ alpha
513 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
514 e9ce266e 2022-03-07 op +hatsuseno
515 e9ce266e 2022-03-07 op alpha
516 be33dff7 2022-05-13 op EOF
517 be33dff7 2022-05-13 op
518 be33dff7 2022-05-13 op (cd $testroot/wt && got patch patch) \
519 be33dff7 2022-05-13 op > $testroot/stdout \
520 be33dff7 2022-05-13 op 2> $testroot/stderr
521 be33dff7 2022-05-13 op ret=$?
522 be33dff7 2022-05-13 op if [ $ret -eq 0 ]; then
523 be33dff7 2022-05-13 op echo "got managed to apply an invalid patch"
524 be33dff7 2022-05-13 op test_done $testroot 1
525 be33dff7 2022-05-13 op return 1
526 be33dff7 2022-05-13 op fi
527 be33dff7 2022-05-13 op
528 be33dff7 2022-05-13 op cmp -s $testroot/stdout.expected $testroot/stdout
529 be33dff7 2022-05-13 op ret=$?
530 be33dff7 2022-05-13 op if [ $ret -ne 0 ]; then
531 be33dff7 2022-05-13 op diff -u $testroot/stdout.expected $testroot/stdout
532 be33dff7 2022-05-13 op test_done $testroot $ret
533 be33dff7 2022-05-13 op return 1
534 be33dff7 2022-05-13 op fi
535 be33dff7 2022-05-13 op
536 be33dff7 2022-05-13 op cmp -s $testroot/stderr.expected $testroot/stderr
537 be33dff7 2022-05-13 op ret=$?
538 be33dff7 2022-05-13 op if [ $ret -ne 0 ]; then
539 be33dff7 2022-05-13 op diff -u $testroot/stderr.expected $testroot/stderr
540 be33dff7 2022-05-13 op test_done $testroot $ret
541 be33dff7 2022-05-13 op return 1
542 be33dff7 2022-05-13 op fi
543 be33dff7 2022-05-13 op
544 be33dff7 2022-05-13 op # empty hunk
545 be33dff7 2022-05-13 op cat <<EOF > $testroot/wt/patch
546 be33dff7 2022-05-13 op diff --git a/alpha b/iota
547 be33dff7 2022-05-13 op --- a/alpha
548 be33dff7 2022-05-13 op +++ b/iota
549 be33dff7 2022-05-13 op @@ -0,0 +0,0 @@
550 e9ce266e 2022-03-07 op EOF
551 e9ce266e 2022-03-07 op
552 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
553 e9ce266e 2022-03-07 op > $testroot/stdout \
554 e9ce266e 2022-03-07 op 2> $testroot/stderr
555 e9ce266e 2022-03-07 op ret=$?
556 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then
557 e9ce266e 2022-03-07 op echo "got managed to apply an invalid patch"
558 e9ce266e 2022-03-07 op test_done $testroot 1
559 e9ce266e 2022-03-07 op return 1
560 e9ce266e 2022-03-07 op fi
561 e9ce266e 2022-03-07 op
562 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
563 e9ce266e 2022-03-07 op ret=$?
564 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
565 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
566 e9ce266e 2022-03-07 op test_done $testroot $ret
567 e9ce266e 2022-03-07 op return 1
568 e9ce266e 2022-03-07 op fi
569 e9ce266e 2022-03-07 op
570 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
571 e9ce266e 2022-03-07 op ret=$?
572 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
573 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
574 e9ce266e 2022-03-07 op test_done $testroot $ret
575 e9ce266e 2022-03-07 op return 1
576 e9ce266e 2022-03-07 op fi
577 e9ce266e 2022-03-07 op
578 e9ce266e 2022-03-07 op test_done $testroot $ret
579 e9ce266e 2022-03-07 op }
580 e9ce266e 2022-03-07 op
581 e9ce266e 2022-03-07 op test_patch_no_patch() {
582 e9ce266e 2022-03-07 op local testroot=`test_init patch_no_patch`
583 e9ce266e 2022-03-07 op
584 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
585 e9ce266e 2022-03-07 op ret=$?
586 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
587 e9ce266e 2022-03-07 op test_done $testroot $ret
588 e9ce266e 2022-03-07 op return 1
589 e9ce266e 2022-03-07 op fi
590 e9ce266e 2022-03-07 op
591 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
592 e9ce266e 2022-03-07 op hello world!
593 e9ce266e 2022-03-07 op ...
594 e9ce266e 2022-03-07 op
595 e9ce266e 2022-03-07 op some other nonsense
596 e9ce266e 2022-03-07 op ...
597 e9ce266e 2022-03-07 op
598 e9ce266e 2022-03-07 op there's no patch in here!
599 e9ce266e 2022-03-07 op EOF
600 e9ce266e 2022-03-07 op
601 e9ce266e 2022-03-07 op echo -n > $testroot/stdout.expected
602 e9ce266e 2022-03-07 op echo "got: no patch found" > $testroot/stderr.expected
603 e9ce266e 2022-03-07 op
604 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
605 e9ce266e 2022-03-07 op > $testroot/stdout \
606 e9ce266e 2022-03-07 op 2> $testroot/stderr
607 e9ce266e 2022-03-07 op ret=$?
608 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then # should fail
609 e9ce266e 2022-03-07 op test_done $testroot 1
610 e9ce266e 2022-03-07 op return 1
611 e9ce266e 2022-03-07 op fi
612 3313bcd8 2022-04-19 op
613 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
614 e9ce266e 2022-03-07 op ret=$?
615 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
616 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
617 e9ce266e 2022-03-07 op test_done $testroot $ret
618 e9ce266e 2022-03-07 op return 1
619 e9ce266e 2022-03-07 op fi
620 e9ce266e 2022-03-07 op
621 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
622 e9ce266e 2022-03-07 op ret=$?
623 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
624 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
625 e9ce266e 2022-03-07 op test_done $testroot $ret
626 e9ce266e 2022-03-07 op return 1
627 e9ce266e 2022-03-07 op fi
628 e9ce266e 2022-03-07 op
629 e9ce266e 2022-03-07 op test_done $testroot $ret
630 e9ce266e 2022-03-07 op }
631 e9ce266e 2022-03-07 op
632 e9ce266e 2022-03-07 op test_patch_equals_for_context() {
633 f1d6cebb 2022-04-23 op local testroot=`test_init patch_equals_for_context`
634 e9ce266e 2022-03-07 op
635 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
636 e9ce266e 2022-03-07 op ret=$?
637 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
638 e9ce266e 2022-03-07 op test_done $testroot $ret
639 e9ce266e 2022-03-07 op return 1
640 e9ce266e 2022-03-07 op fi
641 e9ce266e 2022-03-07 op
642 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
643 e9ce266e 2022-03-07 op --- alpha
644 e9ce266e 2022-03-07 op +++ alpha
645 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
646 e9ce266e 2022-03-07 op +hatsuseno
647 e9ce266e 2022-03-07 op =alpha
648 e9ce266e 2022-03-07 op EOF
649 e9ce266e 2022-03-07 op
650 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
651 e9ce266e 2022-03-07 op
652 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
653 e9ce266e 2022-03-07 op ret=$?
654 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
655 e9ce266e 2022-03-07 op test_done $testroot $ret
656 e9ce266e 2022-03-07 op return 1
657 e9ce266e 2022-03-07 op fi
658 e9ce266e 2022-03-07 op
659 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
660 e9ce266e 2022-03-07 op ret=$?
661 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
662 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
663 e9ce266e 2022-03-07 op test_done $testroot $ret
664 e9ce266e 2022-03-07 op return 1
665 e9ce266e 2022-03-07 op fi
666 e9ce266e 2022-03-07 op
667 e9ce266e 2022-03-07 op echo hatsuseno > $testroot/wt/alpha.expected
668 e9ce266e 2022-03-07 op echo alpha >> $testroot/wt/alpha.expected
669 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
670 e9ce266e 2022-03-07 op ret=$?
671 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
672 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
673 e9ce266e 2022-03-07 op fi
674 e9ce266e 2022-03-07 op test_done $testroot $ret
675 e9ce266e 2022-03-07 op }
676 6e96b326 2022-03-12 op
677 6e96b326 2022-03-12 op test_patch_rename() {
678 6e96b326 2022-03-12 op local testroot=`test_init patch_rename`
679 6e96b326 2022-03-12 op
680 6e96b326 2022-03-12 op got checkout $testroot/repo $testroot/wt > /dev/null
681 6e96b326 2022-03-12 op ret=$?
682 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
683 6e96b326 2022-03-12 op test_done $testroot $ret
684 6e96b326 2022-03-12 op return 1
685 6e96b326 2022-03-12 op fi
686 6e96b326 2022-03-12 op
687 6e96b326 2022-03-12 op cat <<EOF > $testroot/wt/patch
688 4379a9aa 2022-05-02 op diff --git a/beta b/iota
689 4379a9aa 2022-05-02 op similarity index 100%
690 4379a9aa 2022-05-02 op rename from beta
691 4379a9aa 2022-05-02 op rename to iota
692 7a30b5cb 2022-03-20 op diff --git a/alpha b/eta
693 7a30b5cb 2022-03-20 op --- a/alpha
694 7a30b5cb 2022-03-20 op +++ b/eta
695 4379a9aa 2022-05-02 op @@ -1 +1 @@
696 4379a9aa 2022-05-02 op -alpha
697 4379a9aa 2022-05-02 op +eta
698 6e96b326 2022-03-12 op EOF
699 e9ce266e 2022-03-07 op
700 4379a9aa 2022-05-02 op echo 'D beta' > $testroot/stdout.expected
701 4379a9aa 2022-05-02 op echo 'A iota' >> $testroot/stdout.expected
702 4379a9aa 2022-05-02 op echo 'D alpha' >> $testroot/stdout.expected
703 4379a9aa 2022-05-02 op echo 'A eta' >> $testroot/stdout.expected
704 6e96b326 2022-03-12 op
705 6e96b326 2022-03-12 op (cd $testroot/wt && got patch patch) > $testroot/stdout
706 6e96b326 2022-03-12 op ret=$?
707 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
708 6e96b326 2022-03-12 op test_done $testroot $ret
709 6e96b326 2022-03-12 op return 1
710 6e96b326 2022-03-12 op fi
711 6e96b326 2022-03-12 op
712 6e96b326 2022-03-12 op cmp -s $testroot/stdout.expected $testroot/stdout
713 6e96b326 2022-03-12 op ret=$?
714 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
715 6e96b326 2022-03-12 op diff -u $testroot/stdout.expected $testroot/stdout
716 6e96b326 2022-03-12 op test_done $testroot $ret
717 6e96b326 2022-03-12 op return 1
718 6e96b326 2022-03-12 op fi
719 6e96b326 2022-03-12 op
720 4379a9aa 2022-05-02 op if [ -f $testroot/wt/alpha -o -f $testroot/wt/beta ]; then
721 4379a9aa 2022-05-02 op echo "alpha or beta were not removed" >&2
722 6e96b326 2022-03-12 op test_done $testroot 1
723 6e96b326 2022-03-12 op return 1
724 6e96b326 2022-03-12 op fi
725 4379a9aa 2022-05-02 op if [ ! -f $testroot/wt/iota -o ! -f $testroot/wt/eta ]; then
726 4379a9aa 2022-05-02 op echo "iota or eta were not created" >&2
727 6e96b326 2022-03-12 op test_done $testroot 1
728 6e96b326 2022-03-12 op return 1
729 6e96b326 2022-03-12 op fi
730 6e96b326 2022-03-12 op
731 4379a9aa 2022-05-02 op echo beta > $testroot/wt/iota.expected
732 4379a9aa 2022-05-02 op cmp -s $testroot/wt/iota.expected $testroot/wt/iota
733 6e96b326 2022-03-12 op ret=$?
734 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
735 4379a9aa 2022-05-02 op diff -u $testroot/wt/iota.expected $testroot/wt/iota
736 6e96b326 2022-03-12 op test_done $testroot $ret
737 6e96b326 2022-03-12 op return 1
738 6e96b326 2022-03-12 op fi
739 6e96b326 2022-03-12 op
740 4379a9aa 2022-05-02 op echo eta > $testroot/wt/eta.expected
741 4379a9aa 2022-05-02 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
742 6e96b326 2022-03-12 op ret=$?
743 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
744 4379a9aa 2022-05-02 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
745 6e96b326 2022-03-12 op test_done $testroot $ret
746 6e96b326 2022-03-12 op return 1
747 6e96b326 2022-03-12 op fi
748 6e96b326 2022-03-12 op
749 6e96b326 2022-03-12 op test_done $testroot $ret
750 6e96b326 2022-03-12 op }
751 dbda770b 2022-03-13 op
752 dbda770b 2022-03-13 op test_patch_illegal_status() {
753 dbda770b 2022-03-13 op local testroot=`test_init patch_illegal_status`
754 dbda770b 2022-03-13 op
755 dbda770b 2022-03-13 op got checkout $testroot/repo $testroot/wt > /dev/null
756 dbda770b 2022-03-13 op ret=$?
757 dbda770b 2022-03-13 op if [ $ret -ne 0 ]; then
758 dbda770b 2022-03-13 op test_done $testroot $ret
759 dbda770b 2022-03-13 op return 1
760 dbda770b 2022-03-13 op fi
761 dbda770b 2022-03-13 op
762 60aa1fa0 2022-03-17 op # try to patch an obstructed file, add a versioned one, edit a
763 60aa1fa0 2022-03-17 op # non existent file and an unversioned one, and remove a
764 60aa1fa0 2022-03-17 op # non existent file.
765 dbda770b 2022-03-13 op cat <<EOF > $testroot/wt/patch
766 60aa1fa0 2022-03-17 op --- alpha
767 60aa1fa0 2022-03-17 op +++ alpha
768 60aa1fa0 2022-03-17 op @@ -1 +1,2 @@
769 60aa1fa0 2022-03-17 op alpha
770 60aa1fa0 2022-03-17 op +was edited
771 60aa1fa0 2022-03-17 op --- /dev/null
772 60aa1fa0 2022-03-17 op +++ beta
773 60aa1fa0 2022-03-17 op @@ -0,0 +1 @@
774 60aa1fa0 2022-03-17 op +beta
775 dbda770b 2022-03-13 op --- iota
776 dbda770b 2022-03-13 op +++ iota
777 dbda770b 2022-03-13 op @@ -1 +1 @@
778 60aa1fa0 2022-03-17 op -iota
779 60aa1fa0 2022-03-17 op +IOTA
780 60aa1fa0 2022-03-17 op --- kappa
781 60aa1fa0 2022-03-17 op +++ kappa
782 60aa1fa0 2022-03-17 op @@ -1 +1 @@
783 60aa1fa0 2022-03-17 op -kappa
784 60aa1fa0 2022-03-17 op +KAPPA
785 60aa1fa0 2022-03-17 op --- lambda
786 60aa1fa0 2022-03-17 op +++ /dev/null
787 60aa1fa0 2022-03-17 op @@ -1 +0,0 @@
788 60aa1fa0 2022-03-17 op -lambda
789 dbda770b 2022-03-13 op EOF
790 6e96b326 2022-03-12 op
791 60aa1fa0 2022-03-17 op echo kappa > $testroot/wt/kappa
792 dbda770b 2022-03-13 op rm $testroot/wt/alpha
793 dbda770b 2022-03-13 op mkdir $testroot/wt/alpha
794 dbda770b 2022-03-13 op
795 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout \
796 dbda770b 2022-03-13 op 2> $testroot/stderr
797 dbda770b 2022-03-13 op ret=$?
798 dbda770b 2022-03-13 op if [ $ret -eq 0 ]; then
799 dbda770b 2022-03-13 op echo "edited a missing file" >&2
800 a19f439c 2022-06-03 op test_done $testroot 1
801 dbda770b 2022-03-13 op return 1
802 dbda770b 2022-03-13 op fi
803 dbda770b 2022-03-13 op
804 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
805 60aa1fa0 2022-03-17 op # alpha
806 60aa1fa0 2022-03-17 op # beta
807 60aa1fa0 2022-03-17 op # iota
808 60aa1fa0 2022-03-17 op # kappa
809 60aa1fa0 2022-03-17 op # lambda
810 60aa1fa0 2022-03-17 op EOF
811 dbda770b 2022-03-13 op
812 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stderr.expected
813 60aa1fa0 2022-03-17 op got: alpha: file has unexpected status
814 60aa1fa0 2022-03-17 op got: beta: file has unexpected status
815 60aa1fa0 2022-03-17 op got: iota: No such file or directory
816 60aa1fa0 2022-03-17 op got: kappa: file has unexpected status
817 60aa1fa0 2022-03-17 op got: lambda: No such file or directory
818 60aa1fa0 2022-03-17 op got: patch failed to apply
819 dbda770b 2022-03-13 op EOF
820 dbda770b 2022-03-13 op
821 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
822 dbda770b 2022-03-13 op ret=$?
823 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
824 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
825 dbda770b 2022-03-13 op test_done $testroot $ret
826 dbda770b 2022-03-13 op return 1
827 dbda770b 2022-03-13 op fi
828 dbda770b 2022-03-13 op
829 dbda770b 2022-03-13 op cmp -s $testroot/stderr.expected $testroot/stderr
830 dbda770b 2022-03-13 op ret=$?
831 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
832 dbda770b 2022-03-13 op diff -u $testroot/stderr.expected $testroot/stderr
833 78f5ac24 2022-03-19 op test_done $testroot $ret
834 78f5ac24 2022-03-19 op return 1
835 dbda770b 2022-03-13 op fi
836 78f5ac24 2022-03-19 op
837 78f5ac24 2022-03-19 op (cd $testroot/wt && got status) > $testroot/stdout
838 78f5ac24 2022-03-19 op cat <<EOF > $testroot/stdout.expected
839 78f5ac24 2022-03-19 op ~ alpha
840 78f5ac24 2022-03-19 op ? kappa
841 78f5ac24 2022-03-19 op ? patch
842 78f5ac24 2022-03-19 op EOF
843 78f5ac24 2022-03-19 op
844 78f5ac24 2022-03-19 op cmp -s $testroot/stdout.expected $testroot/stdout
845 78f5ac24 2022-03-19 op ret=$?
846 78f5ac24 2022-03-19 op if [ $ret -ne 0 ]; then
847 78f5ac24 2022-03-19 op diff -u $testroot/stdout.expected $testroot/stdout
848 78f5ac24 2022-03-19 op fi
849 899fcfdf 2022-03-13 op test_done $testroot $ret
850 899fcfdf 2022-03-13 op }
851 899fcfdf 2022-03-13 op
852 899fcfdf 2022-03-13 op test_patch_nop() {
853 899fcfdf 2022-03-13 op local testroot=`test_init patch_nop`
854 899fcfdf 2022-03-13 op
855 899fcfdf 2022-03-13 op got checkout $testroot/repo $testroot/wt > /dev/null
856 899fcfdf 2022-03-13 op ret=$?
857 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
858 899fcfdf 2022-03-13 op test_done $testroot $ret
859 899fcfdf 2022-03-13 op return 1
860 899fcfdf 2022-03-13 op fi
861 899fcfdf 2022-03-13 op
862 899fcfdf 2022-03-13 op cat <<EOF > $testroot/wt/patch
863 899fcfdf 2022-03-13 op --- alpha
864 899fcfdf 2022-03-13 op +++ alpha
865 899fcfdf 2022-03-13 op @@ -1 +1 @@
866 899fcfdf 2022-03-13 op -alpha
867 899fcfdf 2022-03-13 op +cafe alpha
868 899fcfdf 2022-03-13 op --- beta
869 899fcfdf 2022-03-13 op +++ /dev/null
870 899fcfdf 2022-03-13 op @@ -1 +0,0 @@
871 899fcfdf 2022-03-13 op -beta
872 7a30b5cb 2022-03-20 op diff --git a/gamma/delta b/gamma/delta.new
873 899fcfdf 2022-03-13 op --- gamma/delta
874 899fcfdf 2022-03-13 op +++ gamma/delta.new
875 899fcfdf 2022-03-13 op @@ -1 +1 @@
876 899fcfdf 2022-03-13 op -delta
877 899fcfdf 2022-03-13 op +delta updated and renamed!
878 899fcfdf 2022-03-13 op EOF
879 899fcfdf 2022-03-13 op
880 899fcfdf 2022-03-13 op (cd $testroot/wt && got patch -n patch)
881 899fcfdf 2022-03-13 op ret=$?
882 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
883 899fcfdf 2022-03-13 op test_done $testroot $ret
884 899fcfdf 2022-03-13 op return 1
885 dbda770b 2022-03-13 op fi
886 899fcfdf 2022-03-13 op
887 899fcfdf 2022-03-13 op # remove the patch to avoid the ? entry
888 899fcfdf 2022-03-13 op rm $testroot/wt/patch
889 899fcfdf 2022-03-13 op
890 899fcfdf 2022-03-13 op (cd $testroot/wt && got status) > $testroot/stdout
891 899fcfdf 2022-03-13 op ret=$?
892 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
893 899fcfdf 2022-03-13 op test_done $testroot $ret
894 899fcfdf 2022-03-13 op return 1
895 899fcfdf 2022-03-13 op fi
896 899fcfdf 2022-03-13 op
897 899fcfdf 2022-03-13 op echo -n > $testroot/stdout.expected
898 899fcfdf 2022-03-13 op cmp -s $testroot/stdout.expected $testroot/stdout
899 899fcfdf 2022-03-13 op ret=$?
900 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
901 899fcfdf 2022-03-13 op diff -u $testroot/stdout.expected $testroot/stdout
902 899fcfdf 2022-03-13 op fi
903 dbda770b 2022-03-13 op test_done $testroot $ret
904 2be5e1a2 2022-03-16 op }
905 2be5e1a2 2022-03-16 op
906 2be5e1a2 2022-03-16 op test_patch_preserve_perm() {
907 2be5e1a2 2022-03-16 op local testroot=`test_init patch_preserve_perm`
908 2be5e1a2 2022-03-16 op
909 2be5e1a2 2022-03-16 op got checkout $testroot/repo $testroot/wt > /dev/null
910 2be5e1a2 2022-03-16 op ret=$?
911 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
912 2be5e1a2 2022-03-16 op test_done $testroot $ret
913 2be5e1a2 2022-03-16 op return 1
914 2be5e1a2 2022-03-16 op fi
915 2be5e1a2 2022-03-16 op
916 2be5e1a2 2022-03-16 op chmod +x $testroot/wt/alpha
917 2be5e1a2 2022-03-16 op (cd $testroot/wt && got commit -m 'alpha executable') > /dev/null
918 2be5e1a2 2022-03-16 op ret=$?
919 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
920 2be5e1a2 2022-03-16 op test_done $testroot $ret
921 2be5e1a2 2022-03-16 op return 1
922 2be5e1a2 2022-03-16 op fi
923 2be5e1a2 2022-03-16 op
924 2be5e1a2 2022-03-16 op cat <<EOF > $testroot/wt/patch
925 2be5e1a2 2022-03-16 op --- alpha
926 2be5e1a2 2022-03-16 op +++ alpha
927 2be5e1a2 2022-03-16 op @@ -1 +1,2 @@
928 2be5e1a2 2022-03-16 op alpha
929 2be5e1a2 2022-03-16 op +was edited
930 2be5e1a2 2022-03-16 op EOF
931 2be5e1a2 2022-03-16 op
932 2be5e1a2 2022-03-16 op (cd $testroot/wt && got patch patch) > /dev/null
933 2be5e1a2 2022-03-16 op ret=$?
934 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
935 2be5e1a2 2022-03-16 op test_done $testroot $ret
936 2be5e1a2 2022-03-16 op return 1
937 2be5e1a2 2022-03-16 op fi
938 2be5e1a2 2022-03-16 op
939 2be5e1a2 2022-03-16 op if [ ! -x $testroot/wt/alpha ]; then
940 2be5e1a2 2022-03-16 op echo "alpha is no more executable!" >&2
941 2be5e1a2 2022-03-16 op test_done $testroot 1
942 95d68340 2022-03-16 op return 1
943 95d68340 2022-03-16 op fi
944 95d68340 2022-03-16 op test_done $testroot 0
945 95d68340 2022-03-16 op }
946 95d68340 2022-03-16 op
947 95d68340 2022-03-16 op test_patch_create_dirs() {
948 95d68340 2022-03-16 op local testroot=`test_init patch_create_dirs`
949 95d68340 2022-03-16 op
950 95d68340 2022-03-16 op got checkout $testroot/repo $testroot/wt > /dev/null
951 95d68340 2022-03-16 op ret=$?
952 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
953 95d68340 2022-03-16 op test_done $testroot $ret
954 95d68340 2022-03-16 op return 1
955 95d68340 2022-03-16 op fi
956 95d68340 2022-03-16 op
957 95d68340 2022-03-16 op cat <<EOF > $testroot/wt/patch
958 95d68340 2022-03-16 op --- /dev/null
959 95d68340 2022-03-16 op +++ iota/kappa/lambda
960 95d68340 2022-03-16 op @@ -0,0 +1 @@
961 95d68340 2022-03-16 op +lambda
962 95d68340 2022-03-16 op EOF
963 95d68340 2022-03-16 op
964 95d68340 2022-03-16 op (cd $testroot/wt && got patch patch) > $testroot/stdout
965 95d68340 2022-03-16 op ret=$?
966 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
967 95d68340 2022-03-16 op test_done $testroot $ret
968 2be5e1a2 2022-03-16 op return 1
969 2be5e1a2 2022-03-16 op fi
970 95d68340 2022-03-16 op
971 95d68340 2022-03-16 op echo 'A iota/kappa/lambda' >> $testroot/stdout.expected
972 95d68340 2022-03-16 op cmp -s $testroot/stdout.expected $testroot/stdout
973 95d68340 2022-03-16 op ret=$?
974 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
975 95d68340 2022-03-16 op diff -u $testroot/stdout.expected $testroot/stdout
976 95d68340 2022-03-16 op test_done $testroot $ret
977 95d68340 2022-03-16 op return 1
978 95d68340 2022-03-16 op fi
979 95d68340 2022-03-16 op
980 95d68340 2022-03-16 op if [ ! -f $testroot/wt/iota/kappa/lambda ]; then
981 95d68340 2022-03-16 op echo "file not created!" >&2
982 95d68340 2022-03-16 op test_done $testroot $ret
983 95d68340 2022-03-16 op return 1
984 95d68340 2022-03-16 op fi
985 2be5e1a2 2022-03-16 op test_done $testroot 0
986 dbda770b 2022-03-13 op }
987 dbda770b 2022-03-13 op
988 60aa1fa0 2022-03-17 op test_patch_with_offset() {
989 60aa1fa0 2022-03-17 op local testroot=`test_init patch_with_offset`
990 60aa1fa0 2022-03-17 op
991 60aa1fa0 2022-03-17 op got checkout $testroot/repo $testroot/wt > /dev/null
992 60aa1fa0 2022-03-17 op ret=$?
993 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
994 60aa1fa0 2022-03-17 op test_done $testroot $ret
995 60aa1fa0 2022-03-17 op return 1
996 60aa1fa0 2022-03-17 op fi
997 60aa1fa0 2022-03-17 op
998 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/wt/patch
999 60aa1fa0 2022-03-17 op --- numbers
1000 60aa1fa0 2022-03-17 op +++ numbers
1001 60aa1fa0 2022-03-17 op @@ -47,7 +47,7 @@
1002 60aa1fa0 2022-03-17 op 47
1003 60aa1fa0 2022-03-17 op 48
1004 60aa1fa0 2022-03-17 op 49
1005 60aa1fa0 2022-03-17 op -50
1006 60aa1fa0 2022-03-17 op +midway tru it!
1007 60aa1fa0 2022-03-17 op 51
1008 60aa1fa0 2022-03-17 op 52
1009 60aa1fa0 2022-03-17 op 53
1010 60aa1fa0 2022-03-17 op @@ -87,7 +87,7 @@
1011 60aa1fa0 2022-03-17 op 87
1012 60aa1fa0 2022-03-17 op 88
1013 60aa1fa0 2022-03-17 op 89
1014 60aa1fa0 2022-03-17 op -90
1015 60aa1fa0 2022-03-17 op +almost there!
1016 60aa1fa0 2022-03-17 op 91
1017 60aa1fa0 2022-03-17 op 92
1018 60aa1fa0 2022-03-17 op 93
1019 60aa1fa0 2022-03-17 op EOF
1020 60aa1fa0 2022-03-17 op
1021 60aa1fa0 2022-03-17 op jot 100 > $testroot/wt/numbers
1022 60aa1fa0 2022-03-17 op ed $testroot/wt/numbers <<EOF > /dev/null 2> /dev/null
1023 60aa1fa0 2022-03-17 op 1,10d
1024 60aa1fa0 2022-03-17 op 50r !jot 20
1025 60aa1fa0 2022-03-17 op w
1026 60aa1fa0 2022-03-17 op q
1027 60aa1fa0 2022-03-17 op EOF
1028 60aa1fa0 2022-03-17 op
1029 60aa1fa0 2022-03-17 op (cd $testroot/wt && got add numbers && got commit -m '+numbers') \
1030 60aa1fa0 2022-03-17 op > /dev/null
1031 60aa1fa0 2022-03-17 op ret=$?
1032 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
1033 60aa1fa0 2022-03-17 op test_done $testroot $ret
1034 60aa1fa0 2022-03-17 op return 1
1035 60aa1fa0 2022-03-17 op fi
1036 60aa1fa0 2022-03-17 op
1037 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1038 60aa1fa0 2022-03-17 op ret=$?
1039 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
1040 60aa1fa0 2022-03-17 op test_done $testroot/wt $ret
1041 60aa1fa0 2022-03-17 op return 1
1042 60aa1fa0 2022-03-17 op fi
1043 60aa1fa0 2022-03-17 op
1044 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
1045 60aa1fa0 2022-03-17 op M numbers
1046 60aa1fa0 2022-03-17 op @@ -47,7 +47,7 @@ applied with offset -10
1047 60aa1fa0 2022-03-17 op @@ -87,7 +87,7 @@ applied with offset 10
1048 7a30b5cb 2022-03-20 op EOF
1049 7a30b5cb 2022-03-20 op
1050 7a30b5cb 2022-03-20 op cmp -s $testroot/stdout.expected $testroot/stdout
1051 7a30b5cb 2022-03-20 op ret=$?
1052 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
1053 7a30b5cb 2022-03-20 op diff -u $testroot/stdout.expected $testroot/stdout
1054 7a30b5cb 2022-03-20 op fi
1055 7a30b5cb 2022-03-20 op test_done $testroot $ret
1056 7a30b5cb 2022-03-20 op }
1057 7a30b5cb 2022-03-20 op
1058 7a30b5cb 2022-03-20 op test_patch_prefer_new_path() {
1059 7a30b5cb 2022-03-20 op local testroot=`test_init patch_orig`
1060 7a30b5cb 2022-03-20 op
1061 7a30b5cb 2022-03-20 op got checkout $testroot/repo $testroot/wt > /dev/null
1062 7a30b5cb 2022-03-20 op ret=$?
1063 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
1064 7a30b5cb 2022-03-20 op test_done $testroot $ret
1065 7a30b5cb 2022-03-20 op return 1
1066 7a30b5cb 2022-03-20 op fi
1067 7a30b5cb 2022-03-20 op
1068 7a30b5cb 2022-03-20 op cat <<EOF > $testroot/wt/patch
1069 7a30b5cb 2022-03-20 op --- alpha.orig
1070 7a30b5cb 2022-03-20 op +++ alpha
1071 7a30b5cb 2022-03-20 op @@ -1 +1,2 @@
1072 7a30b5cb 2022-03-20 op alpha
1073 7a30b5cb 2022-03-20 op +was edited
1074 60aa1fa0 2022-03-17 op EOF
1075 60aa1fa0 2022-03-17 op
1076 7a30b5cb 2022-03-20 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1077 7a30b5cb 2022-03-20 op ret=$?
1078 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
1079 7a30b5cb 2022-03-20 op test_done $testroot $ret
1080 7a30b5cb 2022-03-20 op return 1
1081 7a30b5cb 2022-03-20 op fi
1082 7a30b5cb 2022-03-20 op
1083 3313bcd8 2022-04-19 op echo 'M alpha' > $testroot/stdout.expected
1084 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
1085 60aa1fa0 2022-03-17 op ret=$?
1086 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
1087 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
1088 60aa1fa0 2022-03-17 op fi
1089 60aa1fa0 2022-03-17 op test_done $testroot $ret
1090 60aa1fa0 2022-03-17 op }
1091 60aa1fa0 2022-03-17 op
1092 b3c57ab2 2022-03-22 op test_patch_no_newline() {
1093 b3c57ab2 2022-03-22 op local testroot=`test_init patch_no_newline`
1094 b3c57ab2 2022-03-22 op
1095 b3c57ab2 2022-03-22 op got checkout $testroot/repo $testroot/wt > /dev/null
1096 b3c57ab2 2022-03-22 op ret=$?
1097 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1098 b3c57ab2 2022-03-22 op test_done $testroot $ret
1099 b3c57ab2 2022-03-22 op return 1
1100 b3c57ab2 2022-03-22 op fi
1101 b3c57ab2 2022-03-22 op
1102 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1103 b3c57ab2 2022-03-22 op --- /dev/null
1104 b3c57ab2 2022-03-22 op +++ eta
1105 b3c57ab2 2022-03-22 op @@ -0,0 +1 @@
1106 b3c57ab2 2022-03-22 op +eta
1107 b3c57ab2 2022-03-22 op \ No newline at end of file
1108 b3c57ab2 2022-03-22 op EOF
1109 b3c57ab2 2022-03-22 op
1110 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1111 b3c57ab2 2022-03-22 op ret=$?
1112 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1113 b3c57ab2 2022-03-22 op test_done $testroot $ret
1114 b3c57ab2 2022-03-22 op return 1
1115 b3c57ab2 2022-03-22 op fi
1116 b3c57ab2 2022-03-22 op
1117 b3c57ab2 2022-03-22 op echo "A eta" > $testroot/stdout.expected
1118 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1119 b3c57ab2 2022-03-22 op ret=$?
1120 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1121 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1122 b3c57ab2 2022-03-22 op test_done $testroot $ret
1123 b3c57ab2 2022-03-22 op return 1
1124 b3c57ab2 2022-03-22 op fi
1125 b3c57ab2 2022-03-22 op
1126 b3c57ab2 2022-03-22 op echo -n eta > $testroot/wt/eta.expected
1127 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1128 b3c57ab2 2022-03-22 op ret=$?
1129 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1130 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1131 b3c57ab2 2022-03-22 op test_done $testroot $ret
1132 b3c57ab2 2022-03-22 op return 1
1133 b3c57ab2 2022-03-22 op fi
1134 b3c57ab2 2022-03-22 op
1135 b3c57ab2 2022-03-22 op (cd $testroot/wt && got commit -m 'add eta') > /dev/null
1136 b3c57ab2 2022-03-22 op ret=$?
1137 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1138 b3c57ab2 2022-03-22 op test_done $testroot $ret
1139 b3c57ab2 2022-03-22 op return 1
1140 b3c57ab2 2022-03-22 op fi
1141 b3c57ab2 2022-03-22 op
1142 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1143 b3c57ab2 2022-03-22 op --- eta
1144 b3c57ab2 2022-03-22 op +++ eta
1145 b3c57ab2 2022-03-22 op @@ -1 +1 @@
1146 b3c57ab2 2022-03-22 op -eta
1147 b3c57ab2 2022-03-22 op \ No newline at end of file
1148 b3c57ab2 2022-03-22 op +ETA
1149 b3c57ab2 2022-03-22 op \ No newline at end of file
1150 b3c57ab2 2022-03-22 op EOF
1151 b3c57ab2 2022-03-22 op
1152 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1153 b3c57ab2 2022-03-22 op ret=$?
1154 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1155 b3c57ab2 2022-03-22 op test_done $testroot $ret
1156 b3c57ab2 2022-03-22 op return 1
1157 b3c57ab2 2022-03-22 op fi
1158 b3c57ab2 2022-03-22 op
1159 b3c57ab2 2022-03-22 op echo "M eta" > $testroot/stdout.expected
1160 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1161 b3c57ab2 2022-03-22 op ret=$?
1162 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1163 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1164 b3c57ab2 2022-03-22 op test_done $testroot $ret
1165 b3c57ab2 2022-03-22 op return 1
1166 b3c57ab2 2022-03-22 op fi
1167 b3c57ab2 2022-03-22 op
1168 b3c57ab2 2022-03-22 op echo -n ETA > $testroot/wt/eta.expected
1169 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1170 b3c57ab2 2022-03-22 op ret=$?
1171 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1172 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1173 b3c57ab2 2022-03-22 op test_done $testroot $ret
1174 b3c57ab2 2022-03-22 op return 1
1175 b3c57ab2 2022-03-22 op fi
1176 b3c57ab2 2022-03-22 op
1177 b3c57ab2 2022-03-22 op (cd $testroot/wt && got commit -m 'edit eta') > /dev/null
1178 b3c57ab2 2022-03-22 op ret=$?
1179 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1180 b3c57ab2 2022-03-22 op test_done $testroot $ret
1181 b3c57ab2 2022-03-22 op return 1
1182 b3c57ab2 2022-03-22 op fi
1183 b3c57ab2 2022-03-22 op
1184 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1185 b3c57ab2 2022-03-22 op --- eta
1186 b3c57ab2 2022-03-22 op +++ eta
1187 b3c57ab2 2022-03-22 op @@ -1 +1 @@
1188 b3c57ab2 2022-03-22 op -ETA
1189 b3c57ab2 2022-03-22 op \ No newline at end of file
1190 b3c57ab2 2022-03-22 op +eta
1191 b3c57ab2 2022-03-22 op EOF
1192 b3c57ab2 2022-03-22 op
1193 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1194 b3c57ab2 2022-03-22 op ret=$?
1195 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1196 b3c57ab2 2022-03-22 op test_done $testroot $ret
1197 b3c57ab2 2022-03-22 op return 1
1198 b3c57ab2 2022-03-22 op fi
1199 b3c57ab2 2022-03-22 op
1200 b3c57ab2 2022-03-22 op echo "M eta" > $testroot/stdout.expected
1201 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1202 b3c57ab2 2022-03-22 op ret=$?
1203 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1204 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1205 b3c57ab2 2022-03-22 op test_done $testroot $ret
1206 b3c57ab2 2022-03-22 op return 1
1207 b3c57ab2 2022-03-22 op fi
1208 b3c57ab2 2022-03-22 op
1209 b3c57ab2 2022-03-22 op echo eta > $testroot/wt/eta.expected
1210 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1211 b3c57ab2 2022-03-22 op ret=$?
1212 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1213 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1214 b3c57ab2 2022-03-22 op fi
1215 b3c57ab2 2022-03-22 op test_done $testroot $ret
1216 b3c57ab2 2022-03-22 op }
1217 b3c57ab2 2022-03-22 op
1218 9d6cabd5 2022-04-07 op test_patch_strip() {
1219 9d6cabd5 2022-04-07 op local testroot=`test_init patch_strip`
1220 9d6cabd5 2022-04-07 op
1221 9d6cabd5 2022-04-07 op got checkout $testroot/repo $testroot/wt > /dev/null
1222 9d6cabd5 2022-04-07 op ret=$?
1223 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1224 9d6cabd5 2022-04-07 op test_done $testroot $ret
1225 9d6cabd5 2022-04-07 op return 1
1226 9d6cabd5 2022-04-07 op fi
1227 9d6cabd5 2022-04-07 op
1228 9d6cabd5 2022-04-07 op cat <<EOF > $testroot/wt/patch
1229 9d6cabd5 2022-04-07 op --- foo/bar/alpha.orig
1230 9d6cabd5 2022-04-07 op +++ foo/bar/alpha
1231 9d6cabd5 2022-04-07 op @@ -1 +1 @@
1232 9d6cabd5 2022-04-07 op -alpha
1233 9d6cabd5 2022-04-07 op +ALPHA
1234 9d6cabd5 2022-04-07 op EOF
1235 9d6cabd5 2022-04-07 op
1236 9d6cabd5 2022-04-07 op (cd $testroot/wt && got patch -p2 patch) > $testroot/stdout
1237 9d6cabd5 2022-04-07 op ret=$?
1238 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1239 9d6cabd5 2022-04-07 op test_done $testroot $ret
1240 9d6cabd5 2022-04-07 op return 1
1241 9d6cabd5 2022-04-07 op fi
1242 9d6cabd5 2022-04-07 op
1243 9d6cabd5 2022-04-07 op echo "M alpha" >> $testroot/stdout.expected
1244 9d6cabd5 2022-04-07 op cmp -s $testroot/stdout.expected $testroot/stdout
1245 9d6cabd5 2022-04-07 op ret=$?
1246 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1247 9d6cabd5 2022-04-07 op diff -u $testroot/stdout.expected $testroot/stdout
1248 9d6cabd5 2022-04-07 op test_done $testroot $ret
1249 9d6cabd5 2022-04-07 op return 1
1250 9d6cabd5 2022-04-07 op fi
1251 9d6cabd5 2022-04-07 op
1252 9d6cabd5 2022-04-07 op (cd $testroot/wt && got revert alpha) > /dev/null 2>&1
1253 9d6cabd5 2022-04-07 op ret=$?
1254 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1255 9d6cabd5 2022-04-07 op test_done $testroot $ret
1256 9d6cabd5 2022-04-07 op return 1
1257 9d6cabd5 2022-04-07 op fi
1258 9d6cabd5 2022-04-07 op
1259 9d6cabd5 2022-04-07 op (cd $testroot/wt && got patch -p3 patch) \
1260 9d6cabd5 2022-04-07 op 2> $testroot/stderr
1261 9d6cabd5 2022-04-07 op ret=$?
1262 9d6cabd5 2022-04-07 op if [ $ret -eq 0 ]; then
1263 9d6cabd5 2022-04-07 op echo "stripped more components than available!"
1264 9d6cabd5 2022-04-07 op test_done $testroot 1
1265 9d6cabd5 2022-04-07 op return 1
1266 9d6cabd5 2022-04-07 op fi
1267 9d6cabd5 2022-04-07 op
1268 9d6cabd5 2022-04-07 op cat <<EOF > $testroot/stderr.expected
1269 9d6cabd5 2022-04-07 op got: can't strip 1 path-components from foo/bar/alpha: bad path
1270 9d6cabd5 2022-04-07 op EOF
1271 9d6cabd5 2022-04-07 op
1272 9d6cabd5 2022-04-07 op cmp -s $testroot/stderr.expected $testroot/stderr
1273 9d6cabd5 2022-04-07 op ret=$?
1274 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1275 9d6cabd5 2022-04-07 op diff -u $testroot/stderr.expected $testroot/stderr
1276 9d6cabd5 2022-04-07 op fi
1277 9d6cabd5 2022-04-07 op test_done $testroot 0
1278 a92a2042 2022-07-02 op }
1279 a92a2042 2022-07-02 op
1280 a92a2042 2022-07-02 op test_patch_whitespace() {
1281 a92a2042 2022-07-02 op local testroot=`test_init patch_whitespace`
1282 a92a2042 2022-07-02 op
1283 a92a2042 2022-07-02 op got checkout $testroot/repo $testroot/wt > /dev/null
1284 a92a2042 2022-07-02 op ret=$?
1285 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1286 a92a2042 2022-07-02 op test_done $testroot $ret
1287 a92a2042 2022-07-02 op return 1
1288 a92a2042 2022-07-02 op fi
1289 a92a2042 2022-07-02 op
1290 a92a2042 2022-07-02 op trailing=" "
1291 a92a2042 2022-07-02 op
1292 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/hello.c
1293 a92a2042 2022-07-02 op #include <stdio.h>
1294 a92a2042 2022-07-02 op
1295 a92a2042 2022-07-02 op int
1296 a92a2042 2022-07-02 op main(void)
1297 a92a2042 2022-07-02 op {
1298 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1299 a92a2042 2022-07-02 op printf("hello, world\n");$trailing
1300 a92a2042 2022-07-02 op return 0;
1301 a92a2042 2022-07-02 op }
1302 a92a2042 2022-07-02 op EOF
1303 a92a2042 2022-07-02 op
1304 a92a2042 2022-07-02 op (cd $testroot/wt && got add hello.c && got ci -m '+hello.c') \
1305 a92a2042 2022-07-02 op > /dev/null
1306 a92a2042 2022-07-02 op ret=$?
1307 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1308 a92a2042 2022-07-02 op test_done $testroot $ret
1309 a92a2042 2022-07-02 op return 1
1310 a92a2042 2022-07-02 op fi
1311 a92a2042 2022-07-02 op
1312 a92a2042 2022-07-02 op # test with a diff with various whitespace corruptions
1313 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/patch
1314 a92a2042 2022-07-02 op --- hello.c
1315 a92a2042 2022-07-02 op +++ hello.c
1316 a92a2042 2022-07-02 op @@ -5,5 +5,5 @@
1317 a92a2042 2022-07-02 op {
1318 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1319 a92a2042 2022-07-02 op printf("hello, world\n");
1320 a92a2042 2022-07-02 op - return 0;
1321 a92a2042 2022-07-02 op + return 5; /* always fails */
1322 a92a2042 2022-07-02 op }
1323 a92a2042 2022-07-02 op EOF
1324 a92a2042 2022-07-02 op
1325 a92a2042 2022-07-02 op (cd $testroot/wt && got patch patch) \
1326 a92a2042 2022-07-02 op 2>$testroot/stderr >$testroot/stdout
1327 a92a2042 2022-07-02 op ret=$?
1328 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1329 a92a2042 2022-07-02 op echo "failed to apply diff" >&2
1330 a92a2042 2022-07-02 op test_done $testroot $ret
1331 a92a2042 2022-07-02 op return 1
1332 a92a2042 2022-07-02 op fi
1333 a92a2042 2022-07-02 op
1334 a92a2042 2022-07-02 op echo 'M hello.c' > $testroot/stdout.expected
1335 a92a2042 2022-07-02 op echo '@@ -5,5 +5,5 @@ hunk contains mangled whitespace' \
1336 a92a2042 2022-07-02 op >> $testroot/stdout.expected
1337 a92a2042 2022-07-02 op cmp -s $testroot/stdout.expected $testroot/stdout
1338 a92a2042 2022-07-02 op ret=$?
1339 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1340 a92a2042 2022-07-02 op diff -u $testroot/stdout.expected $testroot/stdout
1341 a92a2042 2022-07-02 op test_done $testroot $ret
1342 a92a2042 2022-07-02 op return 1
1343 a92a2042 2022-07-02 op fi
1344 a92a2042 2022-07-02 op
1345 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/hello.c.expected
1346 a92a2042 2022-07-02 op #include <stdio.h>
1347 a92a2042 2022-07-02 op
1348 a92a2042 2022-07-02 op int
1349 a92a2042 2022-07-02 op main(void)
1350 a92a2042 2022-07-02 op {
1351 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1352 a92a2042 2022-07-02 op printf("hello, world\n");$trailing
1353 a92a2042 2022-07-02 op return 5; /* always fails */
1354 a92a2042 2022-07-02 op }
1355 a92a2042 2022-07-02 op EOF
1356 a92a2042 2022-07-02 op
1357 a92a2042 2022-07-02 op cmp -s $testroot/wt/hello.c.expected $testroot/wt/hello.c
1358 a92a2042 2022-07-02 op ret=$?
1359 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1360 a92a2042 2022-07-02 op diff -u $testroot/wt/hello.c.expected $testroot/wt/hello.c
1361 a92a2042 2022-07-02 op fi
1362 a92a2042 2022-07-02 op test_done $testroot $ret
1363 9d6cabd5 2022-04-07 op }
1364 ed3bff83 2022-04-23 op
1365 ed3bff83 2022-04-23 op test_patch_relative_paths() {
1366 f1d6cebb 2022-04-23 op local testroot=`test_init patch_relative_paths`
1367 ed3bff83 2022-04-23 op
1368 ed3bff83 2022-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1369 ed3bff83 2022-04-23 op ret=$?
1370 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1371 ed3bff83 2022-04-23 op test_done $testroot $ret
1372 ed3bff83 2022-04-23 op return 1
1373 ed3bff83 2022-04-23 op fi
1374 9d6cabd5 2022-04-07 op
1375 ed3bff83 2022-04-23 op cat <<EOF > $testroot/wt/gamma/patch
1376 ed3bff83 2022-04-23 op --- delta
1377 ed3bff83 2022-04-23 op +++ delta
1378 ed3bff83 2022-04-23 op @@ -1 +1 @@
1379 ed3bff83 2022-04-23 op -delta
1380 ed3bff83 2022-04-23 op +DELTA
1381 ed3bff83 2022-04-23 op --- /dev/null
1382 ed3bff83 2022-04-23 op +++ eta
1383 ed3bff83 2022-04-23 op @@ -0,0 +1 @@
1384 ed3bff83 2022-04-23 op +eta
1385 ed3bff83 2022-04-23 op EOF
1386 ed3bff83 2022-04-23 op
1387 ed3bff83 2022-04-23 op (cd $testroot/wt/gamma && got patch patch) > $testroot/stdout
1388 ed3bff83 2022-04-23 op ret=$?
1389 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1390 ed3bff83 2022-04-23 op test_done $testroot $ret
1391 ed3bff83 2022-04-23 op return 1
1392 ed3bff83 2022-04-23 op fi
1393 ed3bff83 2022-04-23 op
1394 ed3bff83 2022-04-23 op echo 'M gamma/delta' > $testroot/stdout.expected
1395 ed3bff83 2022-04-23 op echo 'A gamma/eta' >> $testroot/stdout.expected
1396 15e1bda6 2022-04-23 op
1397 15e1bda6 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1398 15e1bda6 2022-04-23 op ret=$?
1399 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1400 15e1bda6 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1401 15e1bda6 2022-04-23 op fi
1402 15e1bda6 2022-04-23 op test_done $testroot $ret
1403 15e1bda6 2022-04-23 op }
1404 15e1bda6 2022-04-23 op
1405 15e1bda6 2022-04-23 op test_patch_with_path_prefix() {
1406 15e1bda6 2022-04-23 op local testroot=`test_init patch_with_path_prefix`
1407 15e1bda6 2022-04-23 op
1408 15e1bda6 2022-04-23 op got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1409 15e1bda6 2022-04-23 op ret=$?
1410 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1411 15e1bda6 2022-04-23 op test_done $testroot $ret
1412 15e1bda6 2022-04-23 op return 1
1413 15e1bda6 2022-04-23 op fi
1414 15e1bda6 2022-04-23 op
1415 15e1bda6 2022-04-23 op cat <<EOF > $testroot/wt/patch
1416 15e1bda6 2022-04-23 op --- delta
1417 15e1bda6 2022-04-23 op +++ delta
1418 15e1bda6 2022-04-23 op @@ -1 +1 @@
1419 15e1bda6 2022-04-23 op -delta
1420 15e1bda6 2022-04-23 op +DELTA
1421 15e1bda6 2022-04-23 op --- /dev/null
1422 15e1bda6 2022-04-23 op +++ eta
1423 15e1bda6 2022-04-23 op @@ -0,0 +1 @@
1424 15e1bda6 2022-04-23 op +eta
1425 15e1bda6 2022-04-23 op EOF
1426 15e1bda6 2022-04-23 op
1427 15e1bda6 2022-04-23 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1428 15e1bda6 2022-04-23 op ret=$?
1429 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1430 15e1bda6 2022-04-23 op test_done $testroot $ret
1431 15e1bda6 2022-04-23 op return 1
1432 15e1bda6 2022-04-23 op fi
1433 15e1bda6 2022-04-23 op
1434 15e1bda6 2022-04-23 op echo 'M delta' > $testroot/stdout.expected
1435 15e1bda6 2022-04-23 op echo 'A eta' >> $testroot/stdout.expected
1436 15e1bda6 2022-04-23 op
1437 15e1bda6 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1438 15e1bda6 2022-04-23 op ret=$?
1439 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1440 15e1bda6 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1441 15e1bda6 2022-04-23 op fi
1442 15e1bda6 2022-04-23 op test_done $testroot $ret
1443 15e1bda6 2022-04-23 op }
1444 ed3bff83 2022-04-23 op
1445 15e1bda6 2022-04-23 op test_patch_relpath_with_path_prefix() {
1446 15e1bda6 2022-04-23 op local testroot=`test_init patch_relpaths_with_path_prefix`
1447 15e1bda6 2022-04-23 op
1448 15e1bda6 2022-04-23 op got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1449 15e1bda6 2022-04-23 op ret=$?
1450 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1451 15e1bda6 2022-04-23 op test_done $testroot $ret
1452 15e1bda6 2022-04-23 op return 1
1453 15e1bda6 2022-04-23 op fi
1454 15e1bda6 2022-04-23 op
1455 15e1bda6 2022-04-23 op mkdir -p $testroot/wt/epsilon/zeta/
1456 15e1bda6 2022-04-23 op
1457 15e1bda6 2022-04-23 op cat <<EOF > $testroot/wt/patch
1458 15e1bda6 2022-04-23 op --- /dev/null
1459 15e1bda6 2022-04-23 op +++ zeta/theta
1460 15e1bda6 2022-04-23 op @@ -0,0 +1 @@
1461 15e1bda6 2022-04-23 op +theta
1462 15e1bda6 2022-04-23 op EOF
1463 15e1bda6 2022-04-23 op
1464 15e1bda6 2022-04-23 op (cd $testroot/wt/epsilon/zeta && got patch -p1 $testroot/wt/patch) \
1465 15e1bda6 2022-04-23 op > $testroot/stdout
1466 15e1bda6 2022-04-23 op ret=$?
1467 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1468 15e1bda6 2022-04-23 op test_done $testroot $ret
1469 15e1bda6 2022-04-23 op return 1
1470 15e1bda6 2022-04-23 op fi
1471 15e1bda6 2022-04-23 op
1472 15e1bda6 2022-04-23 op echo 'A epsilon/zeta/theta' >> $testroot/stdout.expected
1473 15e1bda6 2022-04-23 op
1474 ed3bff83 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1475 ed3bff83 2022-04-23 op ret=$?
1476 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1477 ed3bff83 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1478 15e1bda6 2022-04-23 op test_done $testroot $ret
1479 15e1bda6 2022-04-23 op return 1
1480 ed3bff83 2022-04-23 op fi
1481 15e1bda6 2022-04-23 op
1482 15e1bda6 2022-04-23 op echo 'theta' > $testroot/theta.expected
1483 15e1bda6 2022-04-23 op cmp -s $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1484 15e1bda6 2022-04-23 op ret=$?
1485 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1486 15e1bda6 2022-04-23 op diff -u $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1487 15e1bda6 2022-04-23 op fi
1488 ed3bff83 2022-04-23 op test_done $testroot $ret
1489 ed3bff83 2022-04-23 op }
1490 bad961bf 2022-04-23 op
1491 bad961bf 2022-04-23 op test_patch_reverse() {
1492 bad961bf 2022-04-23 op local testroot=`test_init patch_reverse`
1493 bad961bf 2022-04-23 op
1494 bad961bf 2022-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1495 bad961bf 2022-04-23 op ret=$?
1496 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1497 bad961bf 2022-04-23 op test_done $testroot $ret
1498 bad961bf 2022-04-23 op return 1
1499 bad961bf 2022-04-23 op fi
1500 bad961bf 2022-04-23 op
1501 bad961bf 2022-04-23 op cat <<EOF > $testroot/wt/patch
1502 bad961bf 2022-04-23 op --- alpha
1503 bad961bf 2022-04-23 op +++ alpha
1504 bad961bf 2022-04-23 op @@ -1 +1 @@
1505 bad961bf 2022-04-23 op -ALPHA
1506 bad961bf 2022-04-23 op \ No newline at end of file
1507 bad961bf 2022-04-23 op +alpha
1508 bad961bf 2022-04-23 op EOF
1509 ed3bff83 2022-04-23 op
1510 bad961bf 2022-04-23 op (cd $testroot/wt && got patch -R patch) > $testroot/stdout
1511 bad961bf 2022-04-23 op ret=$?
1512 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1513 bad961bf 2022-04-23 op test_done $testroot $ret
1514 bad961bf 2022-04-23 op return 1
1515 bad961bf 2022-04-23 op fi
1516 bad961bf 2022-04-23 op
1517 bad961bf 2022-04-23 op echo "M alpha" > $testroot/stdout.expected
1518 bad961bf 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1519 bad961bf 2022-04-23 op ret=$?
1520 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1521 bad961bf 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1522 bad961bf 2022-04-23 op test_done $testroot $ret
1523 bad961bf 2022-04-23 op return 1
1524 bad961bf 2022-04-23 op fi
1525 bad961bf 2022-04-23 op
1526 bad961bf 2022-04-23 op echo -n ALPHA > $testroot/wt/alpha.expected
1527 bad961bf 2022-04-23 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
1528 bad961bf 2022-04-23 op ret=$?
1529 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1530 bad961bf 2022-04-23 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
1531 55e9459f 2022-06-19 op fi
1532 55e9459f 2022-06-19 op test_done $testroot $ret
1533 55e9459f 2022-06-19 op }
1534 55e9459f 2022-06-19 op
1535 55e9459f 2022-06-19 op test_patch_merge_simple() {
1536 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_simple`
1537 55e9459f 2022-06-19 op
1538 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1539 55e9459f 2022-06-19 op ret=$?
1540 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1541 55e9459f 2022-06-19 op test_done $testroot $ret
1542 55e9459f 2022-06-19 op return 1
1543 55e9459f 2022-06-19 op fi
1544 55e9459f 2022-06-19 op
1545 55e9459f 2022-06-19 op jot 10 > $testroot/wt/numbers
1546 5dffb1a1 2022-07-02 op chmod +x $testroot/wt/numbers
1547 55e9459f 2022-06-19 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1548 55e9459f 2022-06-19 op > /dev/null
1549 55e9459f 2022-06-19 op ret=$?
1550 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1551 55e9459f 2022-06-19 op test_done $testroot $ret
1552 55e9459f 2022-06-19 op return 1
1553 55e9459f 2022-06-19 op fi
1554 55e9459f 2022-06-19 op
1555 55e9459f 2022-06-19 op jot 10 | sed 's/4/four/g' > $testroot/wt/numbers
1556 55e9459f 2022-06-19 op
1557 55e9459f 2022-06-19 op (cd $testroot/wt && got diff > $testroot/old.diff \
1558 55e9459f 2022-06-19 op && got revert numbers) >/dev/null
1559 55e9459f 2022-06-19 op ret=$?
1560 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1561 55e9459f 2022-06-19 op test_done $testroot $ret
1562 55e9459f 2022-06-19 op return 1
1563 55e9459f 2022-06-19 op fi
1564 55e9459f 2022-06-19 op
1565 55e9459f 2022-06-19 op jot 10 | sed 's/6/six/g' > $testroot/wt/numbers
1566 55e9459f 2022-06-19 op (cd $testroot/wt && got commit -m 'edit numbers') \
1567 55e9459f 2022-06-19 op > /dev/null
1568 55e9459f 2022-06-19 op ret=$?
1569 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1570 55e9459f 2022-06-19 op test_done $testroot $ret
1571 55e9459f 2022-06-19 op return 1
1572 55e9459f 2022-06-19 op fi
1573 55e9459f 2022-06-19 op
1574 55e9459f 2022-06-19 op (cd $testroot/wt && got patch $testroot/old.diff) \
1575 9802c41c 2022-06-21 op > $testroot/stdout
1576 55e9459f 2022-06-19 op ret=$?
1577 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1578 9802c41c 2022-06-21 op test_done $testroot $ret
1579 9802c41c 2022-06-21 op return 1
1580 9802c41c 2022-06-21 op fi
1581 9802c41c 2022-06-21 op
1582 9802c41c 2022-06-21 op echo 'G numbers' > $testroot/stdout.expected
1583 9802c41c 2022-06-21 op cmp -s $testroot/stdout $testroot/stdout.expected
1584 9802c41c 2022-06-21 op ret=$?
1585 9802c41c 2022-06-21 op if [ $ret -ne 0 ]; then
1586 9802c41c 2022-06-21 op diff -u $testroot/stdout $testroot/stdout.expected
1587 55e9459f 2022-06-19 op test_done $testroot $ret
1588 55e9459f 2022-06-19 op return 1
1589 55e9459f 2022-06-19 op fi
1590 55e9459f 2022-06-19 op
1591 55e9459f 2022-06-19 op jot 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
1592 55e9459f 2022-06-19 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1593 55e9459f 2022-06-19 op ret=$?
1594 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1595 55e9459f 2022-06-19 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1596 5dffb1a1 2022-07-02 op test_done $testroot $ret
1597 5dffb1a1 2022-07-02 op return 1
1598 db0dfdd7 2022-06-27 op fi
1599 5dffb1a1 2022-07-02 op
1600 5dffb1a1 2022-07-02 op test -x $testroot/wt/numbers
1601 5dffb1a1 2022-07-02 op ret=$?
1602 5dffb1a1 2022-07-02 op if [ $ret -ne 0 ]; then
1603 5dffb1a1 2022-07-02 op echo "numbers lost the executable bit" >&2
1604 5dffb1a1 2022-07-02 op fi
1605 db0dfdd7 2022-06-27 op test_done $testroot $ret
1606 db0dfdd7 2022-06-27 op }
1607 db0dfdd7 2022-06-27 op
1608 db0dfdd7 2022-06-27 op test_patch_merge_gitdiff() {
1609 db0dfdd7 2022-06-27 op local testroot=`test_init patch_merge_gitdiff`
1610 db0dfdd7 2022-06-27 op
1611 db0dfdd7 2022-06-27 op jot 10 > $testroot/repo/numbers
1612 db0dfdd7 2022-06-27 op (cd $testroot/repo && git add numbers && \
1613 db0dfdd7 2022-06-27 op git_commit $testroot/repo -m "nums")
1614 db0dfdd7 2022-06-27 op ret=$?
1615 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1616 db0dfdd7 2022-06-27 op test_done $testroot $ret
1617 db0dfdd7 2022-06-27 op return 1
1618 db0dfdd7 2022-06-27 op fi
1619 db0dfdd7 2022-06-27 op
1620 db0dfdd7 2022-06-27 op jot 10 | sed 's/4/four/g' > $testroot/repo/numbers
1621 db0dfdd7 2022-06-27 op (cd $testroot/repo && git diff > $testroot/old.diff)
1622 db0dfdd7 2022-06-27 op ret=$?
1623 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1624 db0dfdd7 2022-06-27 op test_done $testroot $ret
1625 db0dfdd7 2022-06-27 op return 1
1626 db0dfdd7 2022-06-27 op fi
1627 db0dfdd7 2022-06-27 op
1628 db0dfdd7 2022-06-27 op # restore numbers
1629 db0dfdd7 2022-06-27 op jot 10 > $testroot/repo/numbers
1630 db0dfdd7 2022-06-27 op
1631 db0dfdd7 2022-06-27 op jot 10 | sed 's/6/six/g' > $testroot/repo/numbers
1632 db0dfdd7 2022-06-27 op (cd $testroot/repo && git add numbers && \
1633 db0dfdd7 2022-06-27 op git_commit $testroot/repo -m "edit")
1634 db0dfdd7 2022-06-27 op ret=$?
1635 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1636 db0dfdd7 2022-06-27 op test_done $testroot $ret
1637 db0dfdd7 2022-06-27 op return 1
1638 db0dfdd7 2022-06-27 op fi
1639 db0dfdd7 2022-06-27 op
1640 db0dfdd7 2022-06-27 op # now work with got:
1641 db0dfdd7 2022-06-27 op got checkout $testroot/repo $testroot/wt > /dev/null
1642 db0dfdd7 2022-06-27 op ret=$?
1643 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1644 db0dfdd7 2022-06-27 op test_done $testroot $ret
1645 db0dfdd7 2022-06-27 op return 1
1646 db0dfdd7 2022-06-27 op fi
1647 db0dfdd7 2022-06-27 op
1648 db0dfdd7 2022-06-27 op (cd $testroot/wt && got patch $testroot/old.diff) > $testroot/stdout
1649 db0dfdd7 2022-06-27 op ret=$?
1650 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1651 db0dfdd7 2022-06-27 op test_done $testroot $ret
1652 db0dfdd7 2022-06-27 op return 1
1653 55e9459f 2022-06-19 op fi
1654 db0dfdd7 2022-06-27 op
1655 db0dfdd7 2022-06-27 op echo 'G numbers' > $testroot/stdout.expected
1656 db0dfdd7 2022-06-27 op cmp -s $testroot/stdout $testroot/stdout.expected
1657 db0dfdd7 2022-06-27 op ret=$?
1658 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1659 db0dfdd7 2022-06-27 op diff -u $testroot/stdout $testroot/stdout.expected
1660 db0dfdd7 2022-06-27 op fi
1661 55e9459f 2022-06-19 op test_done $testroot $ret
1662 55e9459f 2022-06-19 op }
1663 55e9459f 2022-06-19 op
1664 55e9459f 2022-06-19 op test_patch_merge_conflict() {
1665 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_conflict`
1666 55e9459f 2022-06-19 op
1667 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1668 55e9459f 2022-06-19 op ret=$?
1669 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1670 55e9459f 2022-06-19 op test_done $testroot $ret
1671 55e9459f 2022-06-19 op return 1
1672 55e9459f 2022-06-19 op fi
1673 55e9459f 2022-06-19 op
1674 55e9459f 2022-06-19 op jot 10 > $testroot/wt/numbers
1675 55e9459f 2022-06-19 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1676 55e9459f 2022-06-19 op > /dev/null
1677 55e9459f 2022-06-19 op ret=$?
1678 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1679 55e9459f 2022-06-19 op test_done $testroot $ret
1680 55e9459f 2022-06-19 op return 1
1681 55e9459f 2022-06-19 op fi
1682 d8b5af43 2022-06-19 op
1683 d8b5af43 2022-06-19 op local commit_id=`git_show_head $testroot/repo`
1684 55e9459f 2022-06-19 op
1685 55e9459f 2022-06-19 op jot 10 | sed 's/6/six/g' > $testroot/wt/numbers
1686 acf749fc 2022-07-02 op echo ALPHA > $testroot/wt/alpha
1687 55e9459f 2022-06-19 op
1688 55e9459f 2022-06-19 op (cd $testroot/wt && got diff > $testroot/old.diff \
1689 acf749fc 2022-07-02 op && got revert alpha numbers) >/dev/null
1690 55e9459f 2022-06-19 op ret=$?
1691 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1692 55e9459f 2022-06-19 op test_done $testroot $ret
1693 55e9459f 2022-06-19 op return 1
1694 55e9459f 2022-06-19 op fi
1695 55e9459f 2022-06-19 op
1696 55e9459f 2022-06-19 op jot 10 | sed 's/6/3+3/g' > $testroot/wt/numbers
1697 acf749fc 2022-07-02 op jot -c 3 a > $testroot/wt/alpha
1698 acf749fc 2022-07-02 op (cd $testroot/wt && got commit -m 'edit alpha and numbers') \
1699 55e9459f 2022-06-19 op > /dev/null
1700 55e9459f 2022-06-19 op ret=$?
1701 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1702 55e9459f 2022-06-19 op test_done $testroot $ret
1703 55e9459f 2022-06-19 op return 1
1704 bad961bf 2022-04-23 op fi
1705 55e9459f 2022-06-19 op
1706 55e9459f 2022-06-19 op (cd $testroot/wt && got patch $testroot/old.diff) \
1707 9802c41c 2022-06-21 op > $testroot/stdout 2>/dev/null
1708 55e9459f 2022-06-19 op ret=$?
1709 55e9459f 2022-06-19 op if [ $ret -eq 0 ]; then
1710 55e9459f 2022-06-19 op echo "got patch merged a diff that should conflict" >&2
1711 55e9459f 2022-06-19 op test_done $testroot 0
1712 55e9459f 2022-06-19 op return 1
1713 55e9459f 2022-06-19 op fi
1714 55e9459f 2022-06-19 op
1715 acf749fc 2022-07-02 op echo 'C alpha' > $testroot/stdout.expected
1716 acf749fc 2022-07-02 op echo 'C numbers' >> $testroot/stdout.expected
1717 9802c41c 2022-06-21 op cmp -s $testroot/stdout $testroot/stdout.expected
1718 9802c41c 2022-06-21 op ret=$?
1719 9802c41c 2022-06-21 op if [ $ret -ne 0 ]; then
1720 9802c41c 2022-06-21 op diff -u $testroot/stdout $testroot/stdout.expected
1721 9802c41c 2022-06-21 op test_done $testroot $ret
1722 9802c41c 2022-06-21 op return 1
1723 9802c41c 2022-06-21 op fi
1724 9802c41c 2022-06-21 op
1725 55e9459f 2022-06-19 op # XXX: prefixing every line with a tab otherwise got thinks
1726 55e9459f 2022-06-19 op # the file has conflicts in it.
1727 acf749fc 2022-07-02 op cat <<-EOF > $testroot/wt/alpha.expected
1728 acf749fc 2022-07-02 op <<<<<<< --- alpha
1729 acf749fc 2022-07-02 op ALPHA
1730 acf749fc 2022-07-02 op ||||||| commit $commit_id
1731 acf749fc 2022-07-02 op alpha
1732 acf749fc 2022-07-02 op =======
1733 acf749fc 2022-07-02 op a
1734 acf749fc 2022-07-02 op b
1735 acf749fc 2022-07-02 op c
1736 acf749fc 2022-07-02 op >>>>>>> +++ alpha
1737 acf749fc 2022-07-02 op EOF
1738 acf749fc 2022-07-02 op
1739 55e9459f 2022-06-19 op cat <<-EOF > $testroot/wt/numbers.expected
1740 55e9459f 2022-06-19 op 1
1741 55e9459f 2022-06-19 op 2
1742 55e9459f 2022-06-19 op 3
1743 55e9459f 2022-06-19 op 4
1744 55e9459f 2022-06-19 op 5
1745 55e9459f 2022-06-19 op <<<<<<< --- numbers
1746 55e9459f 2022-06-19 op six
1747 d8b5af43 2022-06-19 op ||||||| commit $commit_id
1748 55e9459f 2022-06-19 op 6
1749 55e9459f 2022-06-19 op =======
1750 55e9459f 2022-06-19 op 3+3
1751 55e9459f 2022-06-19 op >>>>>>> +++ numbers
1752 55e9459f 2022-06-19 op 7
1753 55e9459f 2022-06-19 op 8
1754 55e9459f 2022-06-19 op 9
1755 55e9459f 2022-06-19 op 10
1756 55e9459f 2022-06-19 op EOF
1757 55e9459f 2022-06-19 op
1758 acf749fc 2022-07-02 op cmp -s $testroot/wt/alpha $testroot/wt/alpha.expected
1759 acf749fc 2022-07-02 op ret=$?
1760 acf749fc 2022-07-02 op if [ $ret -ne 0 ]; then
1761 acf749fc 2022-07-02 op diff -u $testroot/wt/alpha $testroot/wt/alpha.expected
1762 acf749fc 2022-07-02 op test_done $testroot $ret
1763 acf749fc 2022-07-02 op return 1
1764 acf749fc 2022-07-02 op fi
1765 acf749fc 2022-07-02 op
1766 55e9459f 2022-06-19 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1767 55e9459f 2022-06-19 op ret=$?
1768 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1769 55e9459f 2022-06-19 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1770 55e9459f 2022-06-19 op fi
1771 bad961bf 2022-04-23 op test_done $testroot $ret
1772 bad961bf 2022-04-23 op }
1773 bad961bf 2022-04-23 op
1774 55e9459f 2022-06-19 op test_patch_merge_unknown_blob() {
1775 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_unknown_blob`
1776 55e9459f 2022-06-19 op
1777 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1778 55e9459f 2022-06-19 op ret=$?
1779 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1780 55e9459f 2022-06-19 op test_done $testroot $ret
1781 55e9459f 2022-06-19 op return 1
1782 55e9459f 2022-06-19 op fi
1783 55e9459f 2022-06-19 op
1784 55e9459f 2022-06-19 op cat <<EOF > $testroot/wt/patch
1785 55e9459f 2022-06-19 op I've got a
1786 dbc68eed 2022-06-21 op diff aaaabbbbccccddddeeeeffff0000111122223333 foo/bar
1787 dbc68eed 2022-06-21 op with a
1788 55e9459f 2022-06-19 op blob - aaaabbbbccccddddeeeeffff0000111122223333
1789 55e9459f 2022-06-19 op and also a
1790 dbc68eed 2022-06-21 op blob + 0000111122223333444455556666777788889999
1791 55e9459f 2022-06-19 op for this dummy diff
1792 55e9459f 2022-06-19 op --- alpha
1793 55e9459f 2022-06-19 op +++ alpha
1794 55e9459f 2022-06-19 op @@ -1 +1 @@
1795 55e9459f 2022-06-19 op -alpha
1796 55e9459f 2022-06-19 op +ALPHA
1797 55e9459f 2022-06-19 op will it work?
1798 55e9459f 2022-06-19 op EOF
1799 55e9459f 2022-06-19 op
1800 55e9459f 2022-06-19 op (cd $testroot/wt/ && got patch patch) > $testroot/stdout
1801 55e9459f 2022-06-19 op ret=$?
1802 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1803 55e9459f 2022-06-19 op test_done $testroot $ret
1804 55e9459f 2022-06-19 op return 1
1805 55e9459f 2022-06-19 op fi
1806 55e9459f 2022-06-19 op
1807 55e9459f 2022-06-19 op echo 'M alpha' > $testroot/stdout.expected
1808 55e9459f 2022-06-19 op cmp -s $testroot/stdout.expected $testroot/stdout
1809 55e9459f 2022-06-19 op ret=$?
1810 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1811 55e9459f 2022-06-19 op diff -u $testroot/stdout.expected $testroot/stdout
1812 dbc68eed 2022-06-21 op test_done $testroot $ret
1813 dbc68eed 2022-06-21 op return 1
1814 55e9459f 2022-06-19 op fi
1815 dbc68eed 2022-06-21 op
1816 dbc68eed 2022-06-21 op # try again without a `diff' header
1817 dbc68eed 2022-06-21 op
1818 dbc68eed 2022-06-21 op cat <<EOF > $testroot/wt/patch
1819 dbc68eed 2022-06-21 op I've got a
1820 dbc68eed 2022-06-21 op blob - aaaabbbbccccddddeeeeffff0000111122223333
1821 dbc68eed 2022-06-21 op and also a
1822 dbc68eed 2022-06-21 op blob + 0000111122223333444455556666777788889999
1823 dbc68eed 2022-06-21 op for this dummy diff
1824 dbc68eed 2022-06-21 op --- alpha
1825 dbc68eed 2022-06-21 op +++ alpha
1826 dbc68eed 2022-06-21 op @@ -1 +1 @@
1827 dbc68eed 2022-06-21 op -alpha
1828 dbc68eed 2022-06-21 op +ALPHA
1829 dbc68eed 2022-06-21 op will it work?
1830 dbc68eed 2022-06-21 op EOF
1831 dbc68eed 2022-06-21 op
1832 dbc68eed 2022-06-21 op (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1833 dbc68eed 2022-06-21 op > $testroot/stdout
1834 dbc68eed 2022-06-21 op ret=$?
1835 dbc68eed 2022-06-21 op if [ $ret -ne 0 ]; then
1836 dbc68eed 2022-06-21 op test_done $testroot $ret
1837 dbc68eed 2022-06-21 op return 1
1838 dbc68eed 2022-06-21 op fi
1839 dbc68eed 2022-06-21 op
1840 dbc68eed 2022-06-21 op echo 'M alpha' > $testroot/stdout.expected
1841 dbc68eed 2022-06-21 op cmp -s $testroot/stdout.expected $testroot/stdout
1842 dbc68eed 2022-06-21 op ret=$?
1843 dbc68eed 2022-06-21 op if [ $ret -ne 0 ]; then
1844 dbc68eed 2022-06-21 op diff -u $testroot/stdout.expected $testroot/stdout
1845 db0dfdd7 2022-06-27 op test_done $testroot $ret
1846 db0dfdd7 2022-06-27 op return 1
1847 dbc68eed 2022-06-21 op fi
1848 db0dfdd7 2022-06-27 op
1849 db0dfdd7 2022-06-27 op # try again with a git-style diff
1850 db0dfdd7 2022-06-27 op
1851 db0dfdd7 2022-06-27 op cat <<EOF > $testroot/wt/patch
1852 db0dfdd7 2022-06-27 op diff --git a/alpha b/alpha
1853 db0dfdd7 2022-06-27 op index 0123456789ab..abcdef012345 100644
1854 db0dfdd7 2022-06-27 op --- a/alpha
1855 db0dfdd7 2022-06-27 op +++ b/alpha
1856 db0dfdd7 2022-06-27 op @@ -1 +1 @@
1857 db0dfdd7 2022-06-27 op -alpha
1858 db0dfdd7 2022-06-27 op +ALPHA
1859 db0dfdd7 2022-06-27 op EOF
1860 db0dfdd7 2022-06-27 op
1861 db0dfdd7 2022-06-27 op (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1862 db0dfdd7 2022-06-27 op > $testroot/stdout
1863 db0dfdd7 2022-06-27 op ret=$?
1864 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1865 db0dfdd7 2022-06-27 op test_done $testroot $ret
1866 db0dfdd7 2022-06-27 op return 1
1867 db0dfdd7 2022-06-27 op fi
1868 db0dfdd7 2022-06-27 op
1869 db0dfdd7 2022-06-27 op echo 'M alpha' > $testroot/stdout.expected
1870 db0dfdd7 2022-06-27 op cmp -s $testroot/stdout.expected $testroot/stdout
1871 db0dfdd7 2022-06-27 op ret=$?
1872 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1873 db0dfdd7 2022-06-27 op diff -u $testroot/stdout.expected $testroot/stdout
1874 db0dfdd7 2022-06-27 op fi
1875 55e9459f 2022-06-19 op test_done $testroot $ret
1876 55e9459f 2022-06-19 op }
1877 55e9459f 2022-06-19 op
1878 e9ce266e 2022-03-07 op test_parseargs "$@"
1879 ed2ff8b9 2022-07-02 op run_test test_patch_add_file
1880 f5b0315f 2022-07-02 op run_test test_patch_rm_file
1881 e9ce266e 2022-03-07 op run_test test_patch_simple_edit_file
1882 e9ce266e 2022-03-07 op run_test test_patch_prepend_line
1883 e9ce266e 2022-03-07 op run_test test_patch_replace_line
1884 e9ce266e 2022-03-07 op run_test test_patch_multiple_hunks
1885 e9ce266e 2022-03-07 op run_test test_patch_multiple_files
1886 e9ce266e 2022-03-07 op run_test test_patch_dont_apply
1887 e9ce266e 2022-03-07 op run_test test_patch_malformed
1888 e9ce266e 2022-03-07 op run_test test_patch_no_patch
1889 e9ce266e 2022-03-07 op run_test test_patch_equals_for_context
1890 6e96b326 2022-03-12 op run_test test_patch_rename
1891 dbda770b 2022-03-13 op run_test test_patch_illegal_status
1892 899fcfdf 2022-03-13 op run_test test_patch_nop
1893 2be5e1a2 2022-03-16 op run_test test_patch_preserve_perm
1894 95d68340 2022-03-16 op run_test test_patch_create_dirs
1895 60aa1fa0 2022-03-17 op run_test test_patch_with_offset
1896 7a30b5cb 2022-03-20 op run_test test_patch_prefer_new_path
1897 b3c57ab2 2022-03-22 op run_test test_patch_no_newline
1898 9d6cabd5 2022-04-07 op run_test test_patch_strip
1899 a92a2042 2022-07-02 op run_test test_patch_whitespace
1900 ed3bff83 2022-04-23 op run_test test_patch_relative_paths
1901 15e1bda6 2022-04-23 op run_test test_patch_with_path_prefix
1902 15e1bda6 2022-04-23 op run_test test_patch_relpath_with_path_prefix
1903 bad961bf 2022-04-23 op run_test test_patch_reverse
1904 55e9459f 2022-06-19 op run_test test_patch_merge_simple
1905 db0dfdd7 2022-06-27 op run_test test_patch_merge_gitdiff
1906 55e9459f 2022-06-19 op run_test test_patch_merge_conflict
1907 55e9459f 2022-06-19 op run_test test_patch_merge_unknown_blob