3 fccbfb98 2019-08-03 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 fccbfb98 2019-08-03 stsp # Permission to use, copy, modify, and distribute this software for any
6 fccbfb98 2019-08-03 stsp # purpose with or without fee is hereby granted, provided that the above
7 fccbfb98 2019-08-03 stsp # copyright notice and this permission notice appear in all copies.
9 fccbfb98 2019-08-03 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 fccbfb98 2019-08-03 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 fccbfb98 2019-08-03 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 fccbfb98 2019-08-03 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 fccbfb98 2019-08-03 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 fccbfb98 2019-08-03 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 fccbfb98 2019-08-03 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 fccbfb98 2019-08-03 stsp . ./common.sh
19 fccbfb98 2019-08-03 stsp function test_stage_basic {
20 fccbfb98 2019-08-03 stsp local testroot=`test_init stage_basic`
22 fccbfb98 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 fccbfb98 2019-08-03 stsp if [ "$ret" != "0" ]; then
25 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
29 fccbfb98 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
30 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
31 fccbfb98 2019-08-03 stsp echo "new file" > $testroot/wt/foo
32 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
34 88d0e355 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
35 88d0e355 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
36 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
37 ec9d9b2f 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
39 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
41 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
42 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
44 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
47 31b20a6e 2019-08-06 stsp function test_stage_no_changes {
48 31b20a6e 2019-08-06 stsp local testroot=`test_init stage_no_changes`
50 31b20a6e 2019-08-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
52 31b20a6e 2019-08-06 stsp if [ "$ret" != "0" ]; then
53 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
57 31b20a6e 2019-08-06 stsp (cd $testroot/wt && got stage alpha beta > $testroot/stdout \
58 31b20a6e 2019-08-06 stsp 2> $testroot/stderr)
60 31b20a6e 2019-08-06 stsp if [ "$ret" == "0" ]; then
61 31b20a6e 2019-08-06 stsp echo "got stage command succeeded unexpectedly" >&2
62 31b20a6e 2019-08-06 stsp test_done "$testroot" "1"
66 2db2652d 2019-08-07 stsp echo "got: no changes to stage" > $testroot/stderr.expected
68 31b20a6e 2019-08-06 stsp cmp -s $testroot/stderr.expected $testroot/stderr
70 31b20a6e 2019-08-06 stsp if [ "$ret" != "0" ]; then
71 31b20a6e 2019-08-06 stsp diff -u $testroot/stderr.expected $testroot/stderr
72 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
76 31b20a6e 2019-08-06 stsp echo -n > $testroot/stdout.expected
77 31b20a6e 2019-08-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
79 31b20a6e 2019-08-06 stsp if [ "$ret" != "0" ]; then
80 31b20a6e 2019-08-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
82 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
85 8b13ce36 2019-08-08 stsp function test_stage_unversioned {
86 8b13ce36 2019-08-08 stsp local testroot=`test_init stage_unversioned`
88 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
90 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
91 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
95 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
96 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
98 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
99 8b13ce36 2019-08-08 stsp echo "M alpha" > $testroot/stdout.expected
100 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
101 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
103 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
104 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
105 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
109 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
111 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
112 8b13ce36 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
113 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
117 8b13ce36 2019-08-08 stsp echo " M alpha" > $testroot/stdout.expected
118 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
120 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
121 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
122 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
126 8b13ce36 2019-08-08 stsp echo "modified file again" > $testroot/wt/alpha
128 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage unversioned-file > $testroot/stdout \
129 8b13ce36 2019-08-08 stsp 2> $testroot/stderr)
131 8b13ce36 2019-08-08 stsp if [ "$ret" == "0" ]; then
132 8b13ce36 2019-08-08 stsp echo "got stage command succeed unexpectedly" >&2
133 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
137 8b13ce36 2019-08-08 stsp echo "got: no changes to stage" > $testroot/stderr.expected
138 8b13ce36 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
140 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
141 8b13ce36 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
143 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
147 8564cb21 2019-08-08 stsp function test_stage_nonexistent {
148 8564cb21 2019-08-08 stsp local testroot=`test_init stage_nonexistent`
150 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
152 8564cb21 2019-08-08 stsp if [ "$ret" != "0" ]; then
153 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
157 8564cb21 2019-08-08 stsp (cd $testroot/wt && got stage nonexistent-file \
158 8564cb21 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
159 2a06fe5f 2019-08-24 stsp echo "got: nonexistent-file: No such file or directory" \
160 2a06fe5f 2019-08-24 stsp > $testroot/stderr.expected
161 8564cb21 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
163 8564cb21 2019-08-08 stsp if [ "$ret" != "0" ]; then
164 8564cb21 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
166 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
169 a4f692bb 2019-08-04 stsp function test_stage_list {
170 a4f692bb 2019-08-04 stsp local testroot=`test_init stage_list`
172 a4f692bb 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
174 a4f692bb 2019-08-04 stsp if [ "$ret" != "0" ]; then
175 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
179 a4f692bb 2019-08-04 stsp echo "modified file" > $testroot/wt/alpha
180 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got rm beta > /dev/null)
181 a4f692bb 2019-08-04 stsp echo "new file" > $testroot/wt/foo
182 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got add foo > /dev/null)
184 a4f692bb 2019-08-04 stsp echo ' M alpha' > $testroot/stdout.expected
185 a4f692bb 2019-08-04 stsp echo ' D beta' >> $testroot/stdout.expected
186 a4f692bb 2019-08-04 stsp echo ' A foo' >> $testroot/stdout.expected
187 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
189 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l > $testroot/stdout)
190 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
191 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
192 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
193 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s beta | grep '^blob -' | \
194 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
195 a4f692bb 2019-08-04 stsp echo " D beta" >> $testroot/stdout.expected
196 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s foo | grep '^blob +' | \
197 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
198 a4f692bb 2019-08-04 stsp echo " A foo" >> $testroot/stdout.expected
199 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
201 a4f692bb 2019-08-04 stsp if [ "$ret" != "0" ]; then
202 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
203 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
207 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l epsilon nonexistent \
208 a4f692bb 2019-08-04 stsp > $testroot/stdout)
210 a4f692bb 2019-08-04 stsp echo -n > $testroot/stdout.expected
211 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
213 a4f692bb 2019-08-04 stsp if [ "$ret" != "0" ]; then
214 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
215 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
219 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l alpha > $testroot/stdout)
221 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
222 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
223 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
224 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
226 a4f692bb 2019-08-04 stsp if [ "$ret" != "0" ]; then
227 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
229 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
233 ebf48fd5 2019-08-03 stsp function test_stage_conflict {
234 ebf48fd5 2019-08-03 stsp local testroot=`test_init stage_conflict`
235 ebf48fd5 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
237 ebf48fd5 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
239 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
240 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
244 ebf48fd5 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
245 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
247 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
249 ebf48fd5 2019-08-03 stsp echo "modified alpha, too" > $testroot/wt/alpha
251 ebf48fd5 2019-08-03 stsp echo "C alpha" > $testroot/stdout.expected
252 ebf48fd5 2019-08-03 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
253 ebf48fd5 2019-08-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
254 ebf48fd5 2019-08-03 stsp echo >> $testroot/stdout.expected
256 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout)
258 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
260 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
261 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
262 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
266 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
267 ebf48fd5 2019-08-03 stsp 2> $testroot/stderr)
269 ebf48fd5 2019-08-03 stsp if [ "$ret" == "0" ]; then
270 ebf48fd5 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
271 ebf48fd5 2019-08-03 stsp test_done "$testroot" "1"
275 ebf48fd5 2019-08-03 stsp echo -n > $testroot/stdout.expected
276 ebf48fd5 2019-08-03 stsp echo "got: alpha: cannot stage file in conflicted status" \
277 735ef5ac 2019-08-03 stsp > $testroot/stderr.expected
279 735ef5ac 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
281 735ef5ac 2019-08-03 stsp if [ "$ret" != "0" ]; then
282 735ef5ac 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
283 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
286 735ef5ac 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
288 735ef5ac 2019-08-03 stsp if [ "$ret" != "0" ]; then
289 735ef5ac 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
291 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
294 735ef5ac 2019-08-03 stsp function test_stage_out_of_date {
295 735ef5ac 2019-08-03 stsp local testroot=`test_init stage_out_of_date`
296 735ef5ac 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
298 735ef5ac 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
300 735ef5ac 2019-08-03 stsp if [ "$ret" != "0" ]; then
301 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
305 735ef5ac 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
306 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
308 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
310 735ef5ac 2019-08-03 stsp echo "modified alpha again" > $testroot/wt/alpha
311 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
312 735ef5ac 2019-08-03 stsp 2> $testroot/stderr)
314 735ef5ac 2019-08-03 stsp if [ "$ret" == "0" ]; then
315 735ef5ac 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
316 735ef5ac 2019-08-03 stsp test_done "$testroot" "1"
320 735ef5ac 2019-08-03 stsp echo -n > $testroot/stdout.expected
321 735ef5ac 2019-08-03 stsp echo "got: work tree must be updated before changes can be staged" \
322 ebf48fd5 2019-08-03 stsp > $testroot/stderr.expected
324 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
326 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
327 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
328 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
331 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
333 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
334 ebf48fd5 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
336 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
340 d3e7c587 2019-08-03 stsp function test_double_stage {
341 d3e7c587 2019-08-03 stsp local testroot=`test_init double_stage`
343 d3e7c587 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
345 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
346 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
349 d3e7c587 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
350 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
351 d3e7c587 2019-08-03 stsp echo "new file" > $testroot/wt/foo
352 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
353 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
355 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
356 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha 2> $testroot/stderr)
357 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
359 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
360 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
361 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
365 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage beta \
366 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
368 7b5dc508 2019-10-28 stsp if [ "$ret" == "0" ]; then
369 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
370 7b5dc508 2019-10-28 stsp test_done "$testroot" "1"
373 7b5dc508 2019-10-28 stsp echo -n > $testroot/stdout.expected
374 7b5dc508 2019-10-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
376 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
377 7b5dc508 2019-10-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
378 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
382 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
383 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
384 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
386 7b5dc508 2019-10-28 stsp if [ "$ret" != "0" ]; then
387 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
388 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
392 7b5dc508 2019-10-28 stsp printf "q\n" > $testroot/patchscript
393 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
394 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
396 7b5dc508 2019-10-28 stsp if [ "$ret" == "0" ]; then
397 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
398 d3e7c587 2019-08-03 stsp test_done "$testroot" "1"
401 d3e7c587 2019-08-03 stsp echo -n > $testroot/stdout.expected
402 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
404 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
405 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
406 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
410 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
411 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
412 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
414 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
415 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
416 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
420 d3e7c587 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
421 d3e7c587 2019-08-03 stsp echo "modified new file" > $testroot/wt/foo
423 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
424 88d0e355 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
425 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
426 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
428 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
429 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
430 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
434 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
435 d3e7c587 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
436 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
438 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
439 fccbfb98 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
441 fccbfb98 2019-08-03 stsp if [ "$ret" != "0" ]; then
442 fccbfb98 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
444 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
447 c363b2c1 2019-08-03 stsp function test_stage_status {
448 c363b2c1 2019-08-03 stsp local testroot=`test_init stage_status`
450 c363b2c1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
452 c363b2c1 2019-08-03 stsp if [ "$ret" != "0" ]; then
453 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
457 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
458 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
459 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/foo
460 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
461 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/epsilon/new
462 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
463 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/epsilon/zeta
464 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm gamma/delta > /dev/null)
466 c363b2c1 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
467 c363b2c1 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
468 c363b2c1 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
469 c363b2c1 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
470 c363b2c1 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
471 c363b2c1 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
472 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
474 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
475 c363b2c1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
477 c363b2c1 2019-08-03 stsp if [ "$ret" != "0" ]; then
478 c363b2c1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
479 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
483 244725f2 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
484 244725f2 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
486 244725f2 2019-08-03 stsp echo 'MM alpha' > $testroot/stdout.expected
487 244725f2 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
488 244725f2 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
489 244725f2 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
490 244725f2 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
491 244725f2 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
493 244725f2 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
494 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
496 244725f2 2019-08-03 stsp if [ "$ret" != "0" ]; then
497 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
498 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
502 244725f2 2019-08-03 stsp # test no-op change of added file with new stat(2) timestamp
503 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/foo
504 244725f2 2019-08-03 stsp echo ' A foo' > $testroot/stdout.expected
505 244725f2 2019-08-03 stsp (cd $testroot/wt && got status foo > $testroot/stdout)
506 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
508 244725f2 2019-08-03 stsp if [ "$ret" != "0" ]; then
509 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
510 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
514 244725f2 2019-08-03 stsp # test staged deleted file which is restored on disk
515 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/beta
516 244725f2 2019-08-03 stsp echo ' D beta' > $testroot/stdout.expected
517 244725f2 2019-08-03 stsp (cd $testroot/wt && got status beta > $testroot/stdout)
518 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
520 244725f2 2019-08-03 stsp if [ "$ret" != "0" ]; then
521 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
523 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
527 1e1446d3 2019-08-03 stsp function test_stage_add_already_staged_file {
528 1e1446d3 2019-08-03 stsp local testroot=`test_init stage_add_already_staged_file`
530 1e1446d3 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
532 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
533 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
537 1e1446d3 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
538 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
539 1e1446d3 2019-08-03 stsp echo "new file" > $testroot/wt/foo
540 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
542 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
544 1e1446d3 2019-08-03 stsp echo -n > $testroot/stdout.expected
545 6d022e97 2019-08-04 stsp for f in alpha beta foo; do
546 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add $f \
547 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
548 6d022e97 2019-08-04 stsp echo "got: $f: file has unexpected status" \
549 6d022e97 2019-08-04 stsp > $testroot/stderr.expected
550 6d022e97 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
552 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
553 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
554 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
557 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
559 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
560 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
561 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
566 1e1446d3 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
567 1e1446d3 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
568 1e1446d3 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
570 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
571 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
573 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
574 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
576 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
579 9acbc4fa 2019-08-03 stsp function test_stage_rm_already_staged_file {
580 9acbc4fa 2019-08-03 stsp local testroot=`test_init stage_rm_already_staged_file`
582 9acbc4fa 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
584 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
585 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
589 9acbc4fa 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
590 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
591 9acbc4fa 2019-08-03 stsp echo "new file" > $testroot/wt/foo
592 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
594 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
596 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta \
597 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
599 6d022e97 2019-08-04 stsp if [ "$ret" != "0" ]; then
600 6d022e97 2019-08-04 stsp echo "got rm command failed unexpectedly" >&2
601 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
604 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
605 6d022e97 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
607 6d022e97 2019-08-04 stsp if [ "$ret" != "0" ]; then
608 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
609 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
612 6d022e97 2019-08-04 stsp echo -n > $testroot/stderr.expected
613 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
615 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
616 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
617 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
621 9acbc4fa 2019-08-03 stsp for f in alpha foo; do
622 24278f30 2019-08-03 stsp echo "got: $f: file is staged" > $testroot/stderr.expected
623 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm $f \
624 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
626 9acbc4fa 2019-08-03 stsp if [ "$ret" == "0" ]; then
627 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
628 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
631 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
633 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
634 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
635 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
640 9acbc4fa 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
641 9acbc4fa 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
642 9acbc4fa 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
644 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
645 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
647 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
648 9acbc4fa 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
650 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
653 24278f30 2019-08-03 stsp function test_stage_revert {
654 24278f30 2019-08-03 stsp local testroot=`test_init stage_revert`
656 24278f30 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
658 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
659 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
663 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
664 24278f30 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
665 24278f30 2019-08-03 stsp echo "new file" > $testroot/wt/foo
666 24278f30 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
667 24278f30 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
669 24278f30 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
670 24278f30 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
672 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
674 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
675 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
676 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
680 24278f30 2019-08-03 stsp echo "R alpha" > $testroot/stdout.expected
681 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
683 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
684 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
685 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
689 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
690 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
691 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
693 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
694 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
695 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
699 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
700 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
701 24278f30 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
702 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
703 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
705 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
706 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
707 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
711 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
713 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
714 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
715 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
719 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
720 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
722 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
723 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
724 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
728 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
729 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
730 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
732 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
733 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
734 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
738 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert beta > $testroot/stdout \
739 24278f30 2019-08-03 stsp 2> $testroot/stderr)
741 d3bcc3d1 2019-08-08 stsp if [ "$ret" != "0" ]; then
742 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
743 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
747 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stdout.expected
748 d3bcc3d1 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
750 d3bcc3d1 2019-08-08 stsp if [ "$ret" != "0" ]; then
751 d3bcc3d1 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
752 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
756 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
757 24278f30 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
759 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
760 24278f30 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
761 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
765 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
767 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
768 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
769 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
773 24278f30 2019-08-03 stsp echo "R foo" > $testroot/stdout.expected
774 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
776 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
777 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
778 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
782 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
783 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
784 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
786 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
787 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
788 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
792 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
793 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
794 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
795 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
796 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
798 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
799 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
800 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
804 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
806 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
807 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
808 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
812 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
813 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
815 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
816 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
817 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
821 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
822 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
823 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
825 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
826 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
827 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
831 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
832 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
833 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
834 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
835 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
837 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
838 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
839 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
843 0f6d7415 2019-08-08 stsp echo "modified file again" >> $testroot/wt/alpha
844 0f6d7415 2019-08-08 stsp echo "modified added file again" >> $testroot/wt/foo
846 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout \
847 0f6d7415 2019-08-08 stsp 2> $testroot/stderr)
849 d3bcc3d1 2019-08-08 stsp if [ "$ret" != "0" ]; then
850 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
851 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
855 0f6d7415 2019-08-08 stsp echo "R alpha" > $testroot/stdout.expected
856 d3bcc3d1 2019-08-08 stsp echo "R foo" >> $testroot/stdout.expected
857 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
859 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
860 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
861 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
865 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
866 0f6d7415 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
868 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
869 0f6d7415 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
870 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
874 0f6d7415 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
875 0f6d7415 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
876 d3bcc3d1 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
877 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
878 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
880 408b4ebc 2019-08-03 stsp if [ "$ret" != "0" ]; then
881 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
883 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
886 408b4ebc 2019-08-03 stsp function test_stage_diff {
887 408b4ebc 2019-08-03 stsp local testroot=`test_init stage_diff`
888 408b4ebc 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
890 408b4ebc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
892 408b4ebc 2019-08-03 stsp if [ "$ret" != "0" ]; then
893 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
897 408b4ebc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
898 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
899 408b4ebc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
900 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
902 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
903 98eaaa12 2019-08-03 stsp echo -n > $testroot/stdout.expected
904 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
906 98eaaa12 2019-08-03 stsp if [ "$ret" != "0" ]; then
907 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
908 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
912 408b4ebc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
913 408b4ebc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
914 408b4ebc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
915 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
917 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
918 408b4ebc 2019-08-03 stsp echo -n > $testroot/stdout.expected
919 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
921 408b4ebc 2019-08-03 stsp if [ "$ret" != "0" ]; then
922 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
923 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
927 408b4ebc 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
928 408b4ebc 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
930 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
932 408b4ebc 2019-08-03 stsp echo "diff $head_commit $testroot/wt" > $testroot/stdout.expected
933 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
934 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 | tr -d '\n' \
935 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
936 4ce46740 2019-08-08 stsp echo ' (staged)' >> $testroot/stdout.expected
937 408b4ebc 2019-08-03 stsp echo 'file + alpha' >> $testroot/stdout.expected
938 408b4ebc 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
939 408b4ebc 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
940 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
941 408b4ebc 2019-08-03 stsp echo '-modified file' >> $testroot/stdout.expected
942 408b4ebc 2019-08-03 stsp echo '+modified file again' >> $testroot/stdout.expected
943 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
944 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 | tr -d '\n' \
945 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
946 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
947 408b4ebc 2019-08-03 stsp echo 'file + foo' >> $testroot/stdout.expected
948 408b4ebc 2019-08-03 stsp echo '--- foo' >> $testroot/stdout.expected
949 408b4ebc 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
950 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
951 408b4ebc 2019-08-03 stsp echo '-new file' >> $testroot/stdout.expected
952 408b4ebc 2019-08-03 stsp echo '+new file changed' >> $testroot/stdout.expected
954 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
956 98eaaa12 2019-08-03 stsp if [ "$ret" != "0" ]; then
957 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
958 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
962 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
964 98eaaa12 2019-08-03 stsp echo "diff $head_commit $testroot/wt (staged changes)" \
965 98eaaa12 2019-08-03 stsp > $testroot/stdout.expected
966 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
967 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
968 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
969 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
970 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
971 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
972 98eaaa12 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
973 98eaaa12 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
974 98eaaa12 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
975 98eaaa12 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
976 98eaaa12 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
977 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
978 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
979 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
980 98eaaa12 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
981 98eaaa12 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
982 98eaaa12 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
983 98eaaa12 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
984 98eaaa12 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
985 98eaaa12 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
986 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
987 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
988 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
989 98eaaa12 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
990 98eaaa12 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
991 98eaaa12 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
992 98eaaa12 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
994 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
996 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
997 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
999 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
1003 b9622844 2019-08-03 stsp function test_stage_histedit {
1004 b9622844 2019-08-03 stsp local testroot=`test_init stage_histedit`
1005 b9622844 2019-08-03 stsp local orig_commit=`git_show_head $testroot/repo`
1007 b9622844 2019-08-03 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1009 b9622844 2019-08-03 stsp if [ "$ret" != "0" ]; then
1010 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1014 b9622844 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1015 b9622844 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1017 b9622844 2019-08-03 stsp echo "modified alpha on master" > $testroot/repo/alpha
1018 b9622844 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1019 b9622844 2019-08-03 stsp echo "new file on master" > $testroot/repo/epsilon/new
1020 b9622844 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1021 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing changes"
1022 b9622844 2019-08-03 stsp local old_commit1=`git_show_head $testroot/repo`
1024 b9622844 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1025 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1026 b9622844 2019-08-03 stsp local old_commit2=`git_show_head $testroot/repo`
1028 b9622844 2019-08-03 stsp echo "pick $old_commit1" > $testroot/histedit-script
1029 b9622844 2019-08-03 stsp echo "pick $old_commit2" >> $testroot/histedit-script
1031 b9622844 2019-08-03 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1032 b9622844 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1034 b9622844 2019-08-03 stsp if [ "$ret" == "0" ]; then
1035 b9622844 2019-08-03 stsp echo "got histedit command succeeded unexpectedly" >&2
1036 b9622844 2019-08-03 stsp test_done "$testroot" "1"
1040 b9622844 2019-08-03 stsp echo -n > $testroot/stdout.expected
1041 b9622844 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1043 b9622844 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1045 b9622844 2019-08-03 stsp if [ "$ret" != "0" ]; then
1046 b9622844 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1047 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1050 b9622844 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1052 b9622844 2019-08-03 stsp if [ "$ret" != "0" ]; then
1053 b9622844 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1055 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1059 243d7cf1 2019-08-03 stsp function test_stage_rebase {
1060 243d7cf1 2019-08-03 stsp local testroot=`test_init stage_rebase`
1062 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1063 243d7cf1 2019-08-03 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
1064 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
1066 243d7cf1 2019-08-03 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1067 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1068 243d7cf1 2019-08-03 stsp echo "new file on branch" > $testroot/repo/epsilon/new
1069 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1070 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
1072 243d7cf1 2019-08-03 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
1073 243d7cf1 2019-08-03 stsp local orig_commit2=`git_show_head $testroot/repo`
1075 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q master)
1076 243d7cf1 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1077 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1078 243d7cf1 2019-08-03 stsp local master_commit=`git_show_head $testroot/repo`
1080 243d7cf1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1082 243d7cf1 2019-08-03 stsp if [ "$ret" != "0" ]; then
1083 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1087 243d7cf1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1088 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1090 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got rebase newbranch \
1091 243d7cf1 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1093 243d7cf1 2019-08-03 stsp if [ "$ret" == "0" ]; then
1094 243d7cf1 2019-08-03 stsp echo "got rebase command succeeded unexpectedly" >&2
1095 243d7cf1 2019-08-03 stsp test_done "$testroot" "1"
1099 243d7cf1 2019-08-03 stsp echo -n > $testroot/stdout.expected
1100 243d7cf1 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1102 243d7cf1 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1104 243d7cf1 2019-08-03 stsp if [ "$ret" != "0" ]; then
1105 243d7cf1 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1106 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1109 243d7cf1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1111 243d7cf1 2019-08-03 stsp if [ "$ret" != "0" ]; then
1112 243d7cf1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1114 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1117 a76c42e6 2019-08-03 stsp function test_stage_update {
1118 a76c42e6 2019-08-03 stsp local testroot=`test_init stage_update`
1120 a76c42e6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1122 a76c42e6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1123 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1127 a76c42e6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1128 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1130 a76c42e6 2019-08-03 stsp echo "modified alpha" > $testroot/repo/alpha
1131 a76c42e6 2019-08-03 stsp git_commit $testroot/repo -m "modified alpha"
1133 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout \
1134 a76c42e6 2019-08-03 stsp 2> $testroot/stderr)
1136 a76c42e6 2019-08-03 stsp if [ "$ret" == "0" ]; then
1137 a76c42e6 2019-08-03 stsp echo "got update command succeeded unexpectedly" >&2
1138 a76c42e6 2019-08-03 stsp test_done "$testroot" "1"
1142 a76c42e6 2019-08-03 stsp echo -n > $testroot/stdout.expected
1143 a76c42e6 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1145 a76c42e6 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1147 a76c42e6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1148 a76c42e6 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1149 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1152 a76c42e6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1154 a76c42e6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1155 a76c42e6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1157 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1160 f0b75401 2019-08-03 stsp function test_stage_commit_non_staged {
1161 f0b75401 2019-08-03 stsp local testroot=`test_init stage_commit_non_staged`
1163 f0b75401 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1165 f0b75401 2019-08-03 stsp if [ "$ret" != "0" ]; then
1166 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1170 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1171 f0b75401 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1172 f0b75401 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1173 f0b75401 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1174 f0b75401 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1176 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/gamma/delta
1177 f0b75401 2019-08-03 stsp (cd $testroot/wt && got commit -m "change delta" gamma/delta \
1178 f0b75401 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1180 f0b75401 2019-08-03 stsp if [ "$ret" == "0" ]; then
1181 f0b75401 2019-08-03 stsp echo "got commit command succeeded unexpectedly" >&2
1182 f0b75401 2019-08-03 stsp test_done "$testroot" "1"
1186 f0b75401 2019-08-03 stsp echo -n > $testroot/stdout.expected
1187 f0b75401 2019-08-03 stsp echo "got: gamma/delta: file is not staged" > $testroot/stderr.expected
1189 f0b75401 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1191 f0b75401 2019-08-03 stsp if [ "$ret" != "0" ]; then
1192 f0b75401 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1193 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1196 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1198 5f8a88c6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1199 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1201 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1204 0f1cfa7f 2019-08-08 stsp function test_stage_commit_out_of_date {
1205 0f1cfa7f 2019-08-08 stsp local testroot=`test_init stage_commit_out_of_date`
1207 0f1cfa7f 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1209 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1210 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1214 0f1cfa7f 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
1215 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
1216 0f1cfa7f 2019-08-08 stsp echo "new file" > $testroot/wt/foo
1217 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
1218 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1220 0f1cfa7f 2019-08-08 stsp echo "changed file" > $testroot/repo/alpha
1221 0f1cfa7f 2019-08-08 stsp git_commit $testroot/repo -m "changed alpha in repo"
1223 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try to commit" > $testroot/stdout \
1224 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1226 0f1cfa7f 2019-08-08 stsp if [ "$ret" == "0" ]; then
1227 0f1cfa7f 2019-08-08 stsp echo "got commit command succeeded unexpectedly" >&2
1228 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "1"
1232 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1233 0f1cfa7f 2019-08-08 stsp echo -n "got: work tree must be updated before these changes " \
1234 0f1cfa7f 2019-08-08 stsp > $testroot/stderr.expected
1235 0f1cfa7f 2019-08-08 stsp echo "can be committed" >> $testroot/stderr.expected
1237 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1239 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1240 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1241 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1244 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1246 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1247 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1248 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1252 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout \
1253 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1254 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1255 0f1cfa7f 2019-08-08 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1257 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1259 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1260 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1261 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1264 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1266 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1267 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1268 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1272 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got unstage > /dev/null)
1273 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
1275 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1276 0f1cfa7f 2019-08-08 stsp echo "got update command failed unexpectedly" >&2
1277 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1281 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1282 0f1cfa7f 2019-08-08 stsp echo "C alpha" > $testroot/stdout.expected
1283 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1284 0f1cfa7f 2019-08-08 stsp echo "A foo" >> $testroot/stdout.expected
1285 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1287 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1288 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1289 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1293 0f1cfa7f 2019-08-08 stsp # resolve conflict
1294 0f1cfa7f 2019-08-08 stsp echo "resolved file" > $testroot/wt/alpha
1296 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
1298 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try again" > $testroot/stdout)
1300 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1301 0f1cfa7f 2019-08-08 stsp echo "got commit command failed unexpectedly" >&2
1302 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1306 0f1cfa7f 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1307 0f1cfa7f 2019-08-08 stsp echo "A foo" > $testroot/stdout.expected
1308 0f1cfa7f 2019-08-08 stsp echo "M alpha" >> $testroot/stdout.expected
1309 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1310 0f1cfa7f 2019-08-08 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1311 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1313 0f1cfa7f 2019-08-08 stsp if [ "$ret" != "0" ]; then
1314 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1316 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1320 5f8a88c6 2019-08-03 stsp function test_stage_commit {
1321 5f8a88c6 2019-08-03 stsp local testroot=`test_init stage_commit`
1322 5f8a88c6 2019-08-03 stsp local first_commit=`git_show_head $testroot/repo`
1324 5f8a88c6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1326 5f8a88c6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1327 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1331 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1332 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1333 5f8a88c6 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1334 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1335 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1336 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1338 5f8a88c6 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
1339 5f8a88c6 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
1340 5f8a88c6 2019-08-03 stsp echo "non-staged change" > $testroot/wt/gamma/delta
1341 5f8a88c6 2019-08-03 stsp echo "non-staged new file" > $testroot/wt/epsilon/new
1342 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1343 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm epsilon/zeta > /dev/null)
1345 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
1346 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_alpha
1347 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
1348 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_foo
1350 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got commit -m "staged changes" \
1351 5f8a88c6 2019-08-03 stsp > $testroot/stdout)
1353 5f8a88c6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1354 5f8a88c6 2019-08-03 stsp echo "got commit command failed unexpectedly" >&2
1355 5f8a88c6 2019-08-03 stsp test_done "$testroot" "1"
1359 5f8a88c6 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
1360 5f8a88c6 2019-08-03 stsp echo "A foo" > $testroot/stdout.expected
1361 5f8a88c6 2019-08-03 stsp echo "M alpha" >> $testroot/stdout.expected
1362 5f8a88c6 2019-08-03 stsp echo "D beta" >> $testroot/stdout.expected
1363 5f8a88c6 2019-08-03 stsp echo "Created commit $head_commit" >> $testroot/stdout.expected
1365 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1367 5f8a88c6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1368 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1369 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1373 5f8a88c6 2019-08-03 stsp got diff -r $testroot/repo $first_commit $head_commit \
1374 5f8a88c6 2019-08-03 stsp > $testroot/stdout
1376 5f8a88c6 2019-08-03 stsp echo "diff $first_commit $head_commit" \
1377 5f8a88c6 2019-08-03 stsp > $testroot/stdout.expected
1378 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1379 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit | \
1380 5f8a88c6 2019-08-03 stsp grep 'alpha$' | cut -d' ' -f 1 \
1381 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1382 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1383 5f8a88c6 2019-08-03 stsp cat $testroot/blob_id_alpha >> $testroot/stdout.expected
1384 5f8a88c6 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
1385 5f8a88c6 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
1386 5f8a88c6 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1387 5f8a88c6 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
1388 5f8a88c6 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
1389 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1390 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit \
1391 46f68b20 2019-10-19 stsp | grep 'beta$' | cut -d' ' -f 1 | tr -d '\n' \
1392 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1393 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1394 5f8a88c6 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1395 5f8a88c6 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
1396 5f8a88c6 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1397 5f8a88c6 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1398 5f8a88c6 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
1399 5f8a88c6 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1400 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1401 46f68b20 2019-10-19 stsp cat $testroot/blob_id_foo | tr -d '\n' >> $testroot/stdout.expected
1402 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1403 5f8a88c6 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
1404 5f8a88c6 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
1405 5f8a88c6 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1406 5f8a88c6 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1408 f0b75401 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1410 f0b75401 2019-08-03 stsp if [ "$ret" != "0" ]; then
1411 f0b75401 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1412 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1416 72fd46fa 2019-09-06 stsp echo 'M alpha' > $testroot/stdout.expected
1417 72fd46fa 2019-09-06 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
1418 5f8a88c6 2019-08-03 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
1419 72fd46fa 2019-09-06 stsp echo 'M foo' >> $testroot/stdout.expected
1420 5f8a88c6 2019-08-03 stsp echo 'M gamma/delta' >> $testroot/stdout.expected
1422 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
1423 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1425 5f8a88c6 2019-08-03 stsp if [ "$ret" != "0" ]; then
1426 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1428 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1431 dc424a06 2019-08-07 stsp function test_stage_patch {
1432 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch`
1434 dc424a06 2019-08-07 stsp jot 16 > $testroot/repo/numbers
1435 dc424a06 2019-08-07 stsp (cd $testroot/repo && git add numbers)
1436 dc424a06 2019-08-07 stsp git_commit $testroot/repo -m "added numbers file"
1437 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1439 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1441 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1442 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1446 dc424a06 2019-08-07 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
1447 dc424a06 2019-08-07 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
1448 dc424a06 2019-08-07 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
1450 dc424a06 2019-08-07 stsp # don't stage any hunks
1451 dc424a06 2019-08-07 stsp printf "n\nn\nn\n" > $testroot/patchscript
1452 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1453 7b5dc508 2019-10-28 stsp numbers > $testroot/stdout 2> $testroot/stderr)
1455 7b5dc508 2019-10-28 stsp if [ "$ret" == "0" ]; then
1456 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
1457 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1460 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1461 dc424a06 2019-08-07 stsp -----------------------------------------------
1462 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1469 dc424a06 2019-08-07 stsp -----------------------------------------------
1470 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1471 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1472 dc424a06 2019-08-07 stsp -----------------------------------------------
1473 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1482 dc424a06 2019-08-07 stsp -----------------------------------------------
1483 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1484 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1485 dc424a06 2019-08-07 stsp -----------------------------------------------
1486 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1492 dc424a06 2019-08-07 stsp -----------------------------------------------
1493 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1494 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1496 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1498 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1499 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1500 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1504 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
1505 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1507 7b5dc508 2019-10-28 stsp if [ "$ret" != "0" ]; then
1508 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
1509 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
1514 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1515 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1516 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1518 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1519 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1520 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1524 dc424a06 2019-08-07 stsp # stage middle hunk
1525 dc424a06 2019-08-07 stsp printf "n\ny\nn\n" > $testroot/patchscript
1526 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1527 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1529 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1530 dc424a06 2019-08-07 stsp -----------------------------------------------
1531 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1538 dc424a06 2019-08-07 stsp -----------------------------------------------
1539 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1540 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1541 dc424a06 2019-08-07 stsp -----------------------------------------------
1542 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1551 dc424a06 2019-08-07 stsp -----------------------------------------------
1552 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1553 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1554 dc424a06 2019-08-07 stsp -----------------------------------------------
1555 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1561 dc424a06 2019-08-07 stsp -----------------------------------------------
1562 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1563 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1565 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1567 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1568 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1569 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1573 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1574 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1575 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1577 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1578 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1579 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1583 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1585 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1586 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
1587 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1588 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1589 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1590 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1591 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1592 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1593 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1594 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1595 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1596 dc424a06 2019-08-07 stsp echo "@@ -4,7 +4,7 @@" >> $testroot/stdout.expected
1597 dc424a06 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
1598 dc424a06 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
1599 dc424a06 2019-08-07 stsp echo " 6" >> $testroot/stdout.expected
1600 dc424a06 2019-08-07 stsp echo "-7" >> $testroot/stdout.expected
1601 dc424a06 2019-08-07 stsp echo "+b" >> $testroot/stdout.expected
1602 dc424a06 2019-08-07 stsp echo " 8" >> $testroot/stdout.expected
1603 dc424a06 2019-08-07 stsp echo " 9" >> $testroot/stdout.expected
1604 dc424a06 2019-08-07 stsp echo " 10" >> $testroot/stdout.expected
1605 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1607 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1608 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1609 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1613 dc424a06 2019-08-07 stsp (cd $testroot/wt && got unstage >/dev/null)
1615 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1616 dc424a06 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
1617 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1620 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1621 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1622 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1624 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1625 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1626 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1630 dc424a06 2019-08-07 stsp # stage last hunk
1631 dc424a06 2019-08-07 stsp printf "n\nn\ny\n" > $testroot/patchscript
1632 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1633 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1635 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1636 dc424a06 2019-08-07 stsp -----------------------------------------------
1637 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1644 dc424a06 2019-08-07 stsp -----------------------------------------------
1645 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1646 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1647 dc424a06 2019-08-07 stsp -----------------------------------------------
1648 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1657 dc424a06 2019-08-07 stsp -----------------------------------------------
1658 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1659 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1660 dc424a06 2019-08-07 stsp -----------------------------------------------
1661 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1667 dc424a06 2019-08-07 stsp -----------------------------------------------
1668 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1669 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1671 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1673 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1674 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1675 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1679 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1680 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1681 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1683 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1684 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1685 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1689 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1691 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1692 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
1693 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1694 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1695 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1696 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1697 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1698 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1699 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1700 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1701 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1702 dc424a06 2019-08-07 stsp echo "@@ -13,4 +13,4 @@" >> $testroot/stdout.expected
1703 dc424a06 2019-08-07 stsp echo " 13" >> $testroot/stdout.expected
1704 dc424a06 2019-08-07 stsp echo " 14" >> $testroot/stdout.expected
1705 dc424a06 2019-08-07 stsp echo " 15" >> $testroot/stdout.expected
1706 dc424a06 2019-08-07 stsp echo "-16" >> $testroot/stdout.expected
1707 dc424a06 2019-08-07 stsp echo "+c" >> $testroot/stdout.expected
1708 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1710 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1711 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1713 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1716 af5a81b2 2019-08-08 stsp function test_stage_patch_twice {
1717 af5a81b2 2019-08-08 stsp local testroot=`test_init stage_patch_twice`
1719 af5a81b2 2019-08-08 stsp jot 16 > $testroot/repo/numbers
1720 af5a81b2 2019-08-08 stsp (cd $testroot/repo && git add numbers)
1721 af5a81b2 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
1722 af5a81b2 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1724 af5a81b2 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1726 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1727 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1731 af5a81b2 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
1732 af5a81b2 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
1733 af5a81b2 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
1735 af5a81b2 2019-08-08 stsp # stage middle hunk
1736 af5a81b2 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
1737 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1738 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1740 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1741 af5a81b2 2019-08-08 stsp -----------------------------------------------
1742 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1749 af5a81b2 2019-08-08 stsp -----------------------------------------------
1750 af5a81b2 2019-08-08 stsp M numbers (change 1 of 3)
1751 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1752 af5a81b2 2019-08-08 stsp -----------------------------------------------
1753 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1762 af5a81b2 2019-08-08 stsp -----------------------------------------------
1763 af5a81b2 2019-08-08 stsp M numbers (change 2 of 3)
1764 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1765 af5a81b2 2019-08-08 stsp -----------------------------------------------
1766 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1772 af5a81b2 2019-08-08 stsp -----------------------------------------------
1773 af5a81b2 2019-08-08 stsp M numbers (change 3 of 3)
1774 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1776 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1778 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1779 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1780 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1784 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1785 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1786 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1788 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1789 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1790 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1794 af5a81b2 2019-08-08 stsp # stage last hunk
1795 af5a81b2 2019-08-08 stsp printf "n\ny\n" > $testroot/patchscript
1796 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1797 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1799 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1800 af5a81b2 2019-08-08 stsp -----------------------------------------------
1801 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@ b
1808 af5a81b2 2019-08-08 stsp -----------------------------------------------
1809 af5a81b2 2019-08-08 stsp M numbers (change 1 of 2)
1810 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1811 af5a81b2 2019-08-08 stsp -----------------------------------------------
1812 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@ b
1818 af5a81b2 2019-08-08 stsp -----------------------------------------------
1819 af5a81b2 2019-08-08 stsp M numbers (change 2 of 2)
1820 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1822 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1824 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1825 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1826 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1830 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1831 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1832 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1834 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1835 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1836 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1840 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1842 af5a81b2 2019-08-08 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1843 af5a81b2 2019-08-08 stsp > $testroot/stdout.expected
1844 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1845 af5a81b2 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
1846 af5a81b2 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1847 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1848 af5a81b2 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1849 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1850 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1851 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1852 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1853 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1854 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1863 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1870 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1872 af5a81b2 2019-08-08 stsp if [ "$ret" != "0" ]; then
1873 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1874 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1878 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1880 af5a81b2 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
1881 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1882 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
1883 af5a81b2 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
1884 af5a81b2 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
1885 af5a81b2 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
1886 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1887 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1888 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1889 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1897 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1899 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1900 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1902 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1905 dc424a06 2019-08-07 stsp function test_stage_patch_added {
1906 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_added`
1907 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1909 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1911 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1912 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1916 dc424a06 2019-08-07 stsp echo "new" > $testroot/wt/epsilon/new
1917 dc424a06 2019-08-07 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1919 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
1920 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1921 dc424a06 2019-08-07 stsp epsilon/new > $testroot/stdout)
1923 dc424a06 2019-08-07 stsp echo "A epsilon/new" > $testroot/stdout.expected
1924 c8ede203 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1925 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1927 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1928 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1929 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1933 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1934 dc424a06 2019-08-07 stsp echo " A epsilon/new" > $testroot/stdout.expected
1935 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1937 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1938 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1939 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1943 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1945 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1946 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
1947 dc424a06 2019-08-07 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1948 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1949 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \
1950 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1951 dc424a06 2019-08-07 stsp echo "--- /dev/null" >> $testroot/stdout.expected
1952 dc424a06 2019-08-07 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
1953 dc424a06 2019-08-07 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
1954 dc424a06 2019-08-07 stsp echo "+new" >> $testroot/stdout.expected
1955 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1957 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
1958 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1960 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1963 e70a841e 2019-08-08 stsp function test_stage_patch_added_twice {
1964 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_added_twice`
1965 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1967 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1969 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
1970 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1974 e70a841e 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
1975 e70a841e 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1977 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
1978 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1979 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout)
1981 e70a841e 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
1982 e70a841e 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1983 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1985 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
1986 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1987 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1991 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1992 e70a841e 2019-08-08 stsp echo " A epsilon/new" > $testroot/stdout.expected
1993 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1995 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
1996 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1997 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2001 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2002 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout 2> $testroot/stderr)
2004 e70a841e 2019-08-08 stsp if [ "$ret" == "0" ]; then
2005 e70a841e 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2006 e70a841e 2019-08-08 stsp test_done "$testroot" "1"
2010 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2011 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2013 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2014 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2015 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2019 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2020 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2022 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2023 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2025 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2028 dc424a06 2019-08-07 stsp function test_stage_patch_removed {
2029 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_removed`
2030 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2032 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2034 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
2035 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2039 dc424a06 2019-08-07 stsp (cd $testroot/wt && got rm beta > /dev/null)
2041 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
2042 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2043 dc424a06 2019-08-07 stsp beta > $testroot/stdout)
2045 dc424a06 2019-08-07 stsp echo -n > $testroot/stdout.expected
2047 dc424a06 2019-08-07 stsp echo "D beta" > $testroot/stdout.expected
2048 f5a17245 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2049 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2051 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
2052 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2053 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2057 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2058 dc424a06 2019-08-07 stsp echo " D beta" > $testroot/stdout.expected
2059 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2061 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
2062 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2063 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2067 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2069 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
2070 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
2071 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2072 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \
2073 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
2074 dc424a06 2019-08-07 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2075 dc424a06 2019-08-07 stsp echo "--- beta" >> $testroot/stdout.expected
2076 dc424a06 2019-08-07 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
2077 dc424a06 2019-08-07 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
2078 dc424a06 2019-08-07 stsp echo "-beta" >> $testroot/stdout.expected
2079 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2081 dc424a06 2019-08-07 stsp if [ "$ret" != "0" ]; then
2082 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2084 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2087 e70a841e 2019-08-08 stsp function test_stage_patch_removed_twice {
2088 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_removed_twice`
2089 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2091 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2093 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2094 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2098 e70a841e 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
2100 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2101 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2102 e70a841e 2019-08-08 stsp beta > $testroot/stdout)
2104 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2106 e70a841e 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
2107 e70a841e 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2108 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2110 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2111 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2112 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2116 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2117 e70a841e 2019-08-08 stsp echo " D beta" > $testroot/stdout.expected
2118 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2120 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2121 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2122 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2126 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p beta \
2127 e70a841e 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2129 7b5dc508 2019-10-28 stsp if [ "$ret" == "0" ]; then
2130 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
2131 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2135 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2136 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2138 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2139 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2140 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2144 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2145 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2147 e70a841e 2019-08-08 stsp if [ "$ret" != "0" ]; then
2148 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2150 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2153 b353a198 2019-08-07 stsp function test_stage_patch_quit {
2154 b353a198 2019-08-07 stsp local testroot=`test_init stage_patch_quit`
2156 b353a198 2019-08-07 stsp jot 16 > $testroot/repo/numbers
2157 88f33a19 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2158 88f33a19 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2159 88f33a19 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2160 b353a198 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2162 b353a198 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2164 b353a198 2019-08-07 stsp if [ "$ret" != "0" ]; then
2165 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2169 b353a198 2019-08-07 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
2170 b353a198 2019-08-07 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
2171 b353a198 2019-08-07 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
2172 88f33a19 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
2174 88f33a19 2019-08-08 stsp # stage first hunk and quit; and don't pass a path argument to
2175 88f33a19 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
2176 88f33a19 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
2177 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2178 2db2652d 2019-08-07 stsp > $testroot/stdout)
2180 b353a198 2019-08-07 stsp if [ "$ret" != "0" ]; then
2181 b353a198 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
2182 b353a198 2019-08-07 stsp test_done "$testroot" "1"
2185 b353a198 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
2186 b353a198 2019-08-07 stsp -----------------------------------------------
2187 b353a198 2019-08-07 stsp @@ -1,5 +1,5 @@
2194 b353a198 2019-08-07 stsp -----------------------------------------------
2195 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
2196 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
2197 b353a198 2019-08-07 stsp -----------------------------------------------
2198 b353a198 2019-08-07 stsp @@ -4,7 +4,7 @@
2207 b353a198 2019-08-07 stsp -----------------------------------------------
2208 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
2209 b353a198 2019-08-07 stsp stage this change? [y/n/q] q
2211 f5a17245 2019-08-08 stsp stage this deletion? [y/n] n
2213 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2215 b353a198 2019-08-07 stsp if [ "$ret" != "0" ]; then
2216 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2217 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2221 b353a198 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2222 b353a198 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
2223 88f33a19 2019-08-08 stsp echo "D zzz" >> $testroot/stdout.expected
2224 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2226 b353a198 2019-08-07 stsp if [ "$ret" != "0" ]; then
2227 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2228 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2232 b353a198 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2234 b353a198 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
2235 b353a198 2019-08-07 stsp > $testroot/stdout.expected
2236 b353a198 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2237 b353a198 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
2238 b353a198 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
2239 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2240 b353a198 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2241 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
2242 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2243 b353a198 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
2244 b353a198 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
2245 b353a198 2019-08-07 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
2246 b353a198 2019-08-07 stsp echo " 1" >> $testroot/stdout.expected
2247 b353a198 2019-08-07 stsp echo "-2" >> $testroot/stdout.expected
2248 b353a198 2019-08-07 stsp echo "+a" >> $testroot/stdout.expected
2249 b353a198 2019-08-07 stsp echo " 3" >> $testroot/stdout.expected
2250 b353a198 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
2251 b353a198 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
2252 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2254 b353a198 2019-08-07 stsp if [ "$ret" != "0" ]; then
2255 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2257 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2261 eba70f38 2019-08-08 stsp function test_stage_patch_incomplete_script {
2262 eba70f38 2019-08-08 stsp local testroot=`test_init stage_incomplete_script`
2264 eba70f38 2019-08-08 stsp jot 16 > $testroot/repo/numbers
2265 eba70f38 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2266 eba70f38 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2267 eba70f38 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2268 eba70f38 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2270 eba70f38 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2272 eba70f38 2019-08-08 stsp if [ "$ret" != "0" ]; then
2273 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2277 eba70f38 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
2278 eba70f38 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
2279 eba70f38 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
2281 eba70f38 2019-08-08 stsp # stage first hunk and then stop responding; got should error out
2282 eba70f38 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2283 eba70f38 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2284 eba70f38 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2286 eba70f38 2019-08-08 stsp if [ "$ret" == "0" ]; then
2287 eba70f38 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2288 eba70f38 2019-08-08 stsp test_done "$testroot" "1"
2291 eba70f38 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
2292 eba70f38 2019-08-08 stsp -----------------------------------------------
2293 eba70f38 2019-08-08 stsp @@ -1,5 +1,5 @@
2300 eba70f38 2019-08-08 stsp -----------------------------------------------
2301 eba70f38 2019-08-08 stsp M numbers (change 1 of 3)
2302 eba70f38 2019-08-08 stsp stage this change? [y/n/q] y
2303 eba70f38 2019-08-08 stsp -----------------------------------------------
2304 eba70f38 2019-08-08 stsp @@ -4,7 +4,7 @@
2313 eba70f38 2019-08-08 stsp -----------------------------------------------
2314 eba70f38 2019-08-08 stsp M numbers (change 2 of 3)
2316 eba70f38 2019-08-08 stsp echo -n "stage this change? [y/n/q] " >> $testroot/stdout.expected
2317 eba70f38 2019-08-08 stsp echo "got: invalid patch choice" > $testroot/stderr.expected
2318 eba70f38 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2320 eba70f38 2019-08-08 stsp if [ "$ret" != "0" ]; then
2321 eba70f38 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2322 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2326 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2328 eba70f38 2019-08-08 stsp if [ "$ret" != "0" ]; then
2329 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2330 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2334 eba70f38 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2335 eba70f38 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
2336 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2338 eba70f38 2019-08-08 stsp if [ "$ret" != "0" ]; then
2339 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2340 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2344 eba70f38 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2345 eba70f38 2019-08-08 stsp echo -n > $testroot/stdout.expected
2346 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2348 eba70f38 2019-08-08 stsp if [ "$ret" != "0" ]; then
2349 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2351 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2355 fccbfb98 2019-08-03 stsp run_test test_stage_basic
2356 31b20a6e 2019-08-06 stsp run_test test_stage_no_changes
2357 8b13ce36 2019-08-08 stsp run_test test_stage_unversioned
2358 8564cb21 2019-08-08 stsp run_test test_stage_nonexistent
2359 a4f692bb 2019-08-04 stsp run_test test_stage_list
2360 ebf48fd5 2019-08-03 stsp run_test test_stage_conflict
2361 735ef5ac 2019-08-03 stsp run_test test_stage_out_of_date
2362 d3e7c587 2019-08-03 stsp run_test test_double_stage
2363 c363b2c1 2019-08-03 stsp run_test test_stage_status
2364 1e1446d3 2019-08-03 stsp run_test test_stage_add_already_staged_file
2365 9acbc4fa 2019-08-03 stsp run_test test_stage_rm_already_staged_file
2366 24278f30 2019-08-03 stsp run_test test_stage_revert
2367 408b4ebc 2019-08-03 stsp run_test test_stage_diff
2368 b9622844 2019-08-03 stsp run_test test_stage_histedit
2369 243d7cf1 2019-08-03 stsp run_test test_stage_rebase
2370 a76c42e6 2019-08-03 stsp run_test test_stage_update
2371 f0b75401 2019-08-03 stsp run_test test_stage_commit_non_staged
2372 0f1cfa7f 2019-08-08 stsp run_test test_stage_commit_out_of_date
2373 5f8a88c6 2019-08-03 stsp run_test test_stage_commit
2374 dc424a06 2019-08-07 stsp run_test test_stage_patch
2375 af5a81b2 2019-08-08 stsp run_test test_stage_patch_twice
2376 dc424a06 2019-08-07 stsp run_test test_stage_patch_added
2377 e70a841e 2019-08-08 stsp run_test test_stage_patch_added_twice
2378 dc424a06 2019-08-07 stsp run_test test_stage_patch_removed
2379 e70a841e 2019-08-08 stsp run_test test_stage_patch_removed_twice
2380 b353a198 2019-08-07 stsp run_test test_stage_patch_quit
2381 eba70f38 2019-08-08 stsp run_test test_stage_patch_incomplete_script