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 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $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 ebf48fd5 2019-08-03 stsp function test_stage_conflict {
48 ebf48fd5 2019-08-03 stsp local testroot=`test_init stage_conflict`
49 ebf48fd5 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
51 ebf48fd5 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
53 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
54 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
58 ebf48fd5 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
59 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
61 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
63 ebf48fd5 2019-08-03 stsp echo "modified alpha, too" > $testroot/wt/alpha
65 ebf48fd5 2019-08-03 stsp echo "C alpha" > $testroot/stdout.expected
66 ebf48fd5 2019-08-03 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
67 ebf48fd5 2019-08-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
68 ebf48fd5 2019-08-03 stsp echo >> $testroot/stdout.expected
70 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout)
72 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
74 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
75 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
76 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
80 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
81 ebf48fd5 2019-08-03 stsp 2> $testroot/stderr)
83 ebf48fd5 2019-08-03 stsp if [ "$ret" == "0" ]; then
84 ebf48fd5 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
85 ebf48fd5 2019-08-03 stsp test_done "$testroot" "1"
89 ebf48fd5 2019-08-03 stsp echo -n > $testroot/stdout.expected
90 ebf48fd5 2019-08-03 stsp echo "got: alpha: cannot stage file in conflicted status" \
91 735ef5ac 2019-08-03 stsp > $testroot/stderr.expected
93 735ef5ac 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
95 735ef5ac 2019-08-03 stsp if [ "$ret" != "0" ]; then
96 735ef5ac 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
97 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
100 735ef5ac 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
102 735ef5ac 2019-08-03 stsp if [ "$ret" != "0" ]; then
103 735ef5ac 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
105 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
108 735ef5ac 2019-08-03 stsp function test_stage_out_of_date {
109 735ef5ac 2019-08-03 stsp local testroot=`test_init stage_out_of_date`
110 735ef5ac 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
112 735ef5ac 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
114 735ef5ac 2019-08-03 stsp if [ "$ret" != "0" ]; then
115 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
119 735ef5ac 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
120 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
122 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
124 735ef5ac 2019-08-03 stsp echo "modified alpha again" > $testroot/wt/alpha
125 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
126 735ef5ac 2019-08-03 stsp 2> $testroot/stderr)
128 735ef5ac 2019-08-03 stsp if [ "$ret" == "0" ]; then
129 735ef5ac 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
130 735ef5ac 2019-08-03 stsp test_done "$testroot" "1"
134 735ef5ac 2019-08-03 stsp echo -n > $testroot/stdout.expected
135 735ef5ac 2019-08-03 stsp echo "got: work tree must be updated before changes can be staged" \
136 ebf48fd5 2019-08-03 stsp > $testroot/stderr.expected
138 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
140 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
141 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
142 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
145 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
147 ebf48fd5 2019-08-03 stsp if [ "$ret" != "0" ]; then
148 ebf48fd5 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
150 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
154 d3e7c587 2019-08-03 stsp function test_double_stage {
155 d3e7c587 2019-08-03 stsp local testroot=`test_init double_stage`
157 d3e7c587 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
159 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
160 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
163 d3e7c587 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
164 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
165 d3e7c587 2019-08-03 stsp echo "new file" > $testroot/wt/foo
166 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
167 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
169 d3e7c587 2019-08-03 stsp echo "got: alpha: no changes to stage" > $testroot/stderr.expected
170 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha 2> $testroot/stderr)
171 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
173 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
174 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
175 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
179 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage beta > $testroot/stdout)
180 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
181 d3e7c587 2019-08-03 stsp echo "got stage command failed unexpectedly" >&2
182 d3e7c587 2019-08-03 stsp test_done "$testroot" "1"
185 d3e7c587 2019-08-03 stsp echo -n > $testroot/stdout.expected
186 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
188 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
189 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
190 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
194 d3e7c587 2019-08-03 stsp echo "got: foo: no changes to stage" > $testroot/stderr.expected
195 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
196 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
198 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
199 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
200 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
204 d3e7c587 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
205 d3e7c587 2019-08-03 stsp echo "modified new file" > $testroot/wt/foo
207 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
208 88d0e355 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
209 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
210 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
212 d3e7c587 2019-08-03 stsp if [ "$ret" != "0" ]; then
213 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
214 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
218 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
219 d3e7c587 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
220 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
222 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
223 fccbfb98 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
225 fccbfb98 2019-08-03 stsp if [ "$ret" != "0" ]; then
226 fccbfb98 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
228 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
231 c363b2c1 2019-08-03 stsp function test_stage_status {
232 c363b2c1 2019-08-03 stsp local testroot=`test_init stage_status`
234 c363b2c1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
236 c363b2c1 2019-08-03 stsp if [ "$ret" != "0" ]; then
237 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
241 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
242 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
243 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/foo
244 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
245 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/epsilon/new
246 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
247 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/epsilon/zeta
248 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm gamma/delta > /dev/null)
250 c363b2c1 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
251 c363b2c1 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
252 c363b2c1 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
253 c363b2c1 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
254 c363b2c1 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
255 c363b2c1 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
256 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
258 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
259 c363b2c1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
261 c363b2c1 2019-08-03 stsp if [ "$ret" != "0" ]; then
262 c363b2c1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
263 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
267 244725f2 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
268 244725f2 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
270 244725f2 2019-08-03 stsp echo 'MM alpha' > $testroot/stdout.expected
271 244725f2 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
272 244725f2 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
273 244725f2 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
274 244725f2 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
275 244725f2 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
277 244725f2 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
278 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
280 244725f2 2019-08-03 stsp if [ "$ret" != "0" ]; then
281 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
282 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
286 244725f2 2019-08-03 stsp # test no-op change of added file with new stat(2) timestamp
287 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/foo
288 244725f2 2019-08-03 stsp echo ' A foo' > $testroot/stdout.expected
289 244725f2 2019-08-03 stsp (cd $testroot/wt && got status foo > $testroot/stdout)
290 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
292 244725f2 2019-08-03 stsp if [ "$ret" != "0" ]; then
293 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
294 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
298 244725f2 2019-08-03 stsp # test staged deleted file which is restored on disk
299 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/beta
300 244725f2 2019-08-03 stsp echo ' D beta' > $testroot/stdout.expected
301 244725f2 2019-08-03 stsp (cd $testroot/wt && got status beta > $testroot/stdout)
302 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
304 244725f2 2019-08-03 stsp if [ "$ret" != "0" ]; then
305 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
307 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
311 1e1446d3 2019-08-03 stsp function test_stage_add_already_staged_file {
312 1e1446d3 2019-08-03 stsp local testroot=`test_init stage_add_already_staged_file`
314 1e1446d3 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
316 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
317 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
321 1e1446d3 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
322 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
323 1e1446d3 2019-08-03 stsp echo "new file" > $testroot/wt/foo
324 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
326 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
328 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add beta \
329 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
331 1e1446d3 2019-08-03 stsp if [ "$ret" == "0" ]; then
332 1e1446d3 2019-08-03 stsp echo "got add command succeeded unexpectedly" >&2
333 1e1446d3 2019-08-03 stsp test_done "$testroot" "1"
336 1e1446d3 2019-08-03 stsp echo "got: realpath: beta: No such file or directory" \
337 1e1446d3 2019-08-03 stsp > $testroot/stderr.expected
338 1e1446d3 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
340 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
341 1e1446d3 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
342 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
346 1e1446d3 2019-08-03 stsp echo -n > $testroot/stdout.expected
347 1e1446d3 2019-08-03 stsp for f in alpha foo; do
348 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add $f \
349 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
351 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
352 1e1446d3 2019-08-03 stsp echo "got add command failed unexpectedly" >&2
353 1e1446d3 2019-08-03 stsp test_done "$testroot" "1"
356 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
358 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
359 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
360 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
365 1e1446d3 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
366 1e1446d3 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
367 1e1446d3 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
369 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
370 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
372 1e1446d3 2019-08-03 stsp if [ "$ret" != "0" ]; then
373 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
375 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
378 9acbc4fa 2019-08-03 stsp function test_stage_rm_already_staged_file {
379 9acbc4fa 2019-08-03 stsp local testroot=`test_init stage_rm_already_staged_file`
381 9acbc4fa 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
383 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
384 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
388 9acbc4fa 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
389 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
390 9acbc4fa 2019-08-03 stsp echo "new file" > $testroot/wt/foo
391 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
393 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
395 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta \
396 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
398 9acbc4fa 2019-08-03 stsp if [ "$ret" == "0" ]; then
399 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
400 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
403 9acbc4fa 2019-08-03 stsp echo "got: realpath: beta: No such file or directory" \
404 9acbc4fa 2019-08-03 stsp > $testroot/stderr.expected
405 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
407 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
408 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
409 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
413 9acbc4fa 2019-08-03 stsp for f in alpha foo; do
414 24278f30 2019-08-03 stsp echo "got: $f: file is staged" > $testroot/stderr.expected
415 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm $f \
416 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
418 9acbc4fa 2019-08-03 stsp if [ "$ret" == "0" ]; then
419 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
420 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
423 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
425 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
426 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
427 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
432 9acbc4fa 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
433 9acbc4fa 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
434 9acbc4fa 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
436 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
437 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
439 9acbc4fa 2019-08-03 stsp if [ "$ret" != "0" ]; then
440 9acbc4fa 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
442 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
445 24278f30 2019-08-03 stsp function test_stage_revert {
446 24278f30 2019-08-03 stsp local testroot=`test_init stage_revert`
448 24278f30 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
450 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
451 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
455 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
456 24278f30 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
457 24278f30 2019-08-03 stsp echo "new file" > $testroot/wt/foo
458 24278f30 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
459 24278f30 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
461 24278f30 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
462 24278f30 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
464 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
466 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
467 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
468 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
472 24278f30 2019-08-03 stsp echo "R alpha" > $testroot/stdout.expected
473 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
475 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
476 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
477 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
481 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
482 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
483 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
485 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
486 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
487 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
491 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
492 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
493 24278f30 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
494 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
495 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
497 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
498 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
499 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
503 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
505 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
506 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
507 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
511 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
512 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
514 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
515 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
516 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
520 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
521 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
522 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
524 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
525 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
526 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
530 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert beta > $testroot/stdout \
531 24278f30 2019-08-03 stsp 2> $testroot/stderr)
533 24278f30 2019-08-03 stsp if [ "$ret" == "0" ]; then
534 24278f30 2019-08-03 stsp echo "revert command succeeded unexpectedly" >&2
535 24278f30 2019-08-03 stsp test_done "$testroot" "1"
539 24278f30 2019-08-03 stsp echo "got: beta: file is staged" > $testroot/stderr.expected
540 24278f30 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
542 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
543 24278f30 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
544 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
548 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
550 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
551 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
552 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
556 24278f30 2019-08-03 stsp echo "R foo" > $testroot/stdout.expected
557 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
559 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
560 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
561 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
565 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
566 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
567 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
569 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
570 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
571 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
575 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
576 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
577 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
578 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
579 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
581 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
582 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
583 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
587 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
589 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
590 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
591 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
595 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
596 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
598 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
599 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
600 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
604 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
605 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
606 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
608 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
609 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
610 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
614 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
615 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
616 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
617 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
618 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
620 408b4ebc 2019-08-03 stsp if [ "$ret" != "0" ]; then
621 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
623 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
626 408b4ebc 2019-08-03 stsp function test_stage_diff {
627 408b4ebc 2019-08-03 stsp local testroot=`test_init stage_diff`
628 408b4ebc 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
630 408b4ebc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
632 408b4ebc 2019-08-03 stsp if [ "$ret" != "0" ]; then
633 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
637 408b4ebc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
638 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
639 408b4ebc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
640 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
642 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
643 98eaaa12 2019-08-03 stsp echo -n > $testroot/stdout.expected
644 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
646 98eaaa12 2019-08-03 stsp if [ "$ret" != "0" ]; then
647 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
648 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
652 408b4ebc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
653 408b4ebc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
654 408b4ebc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
655 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
657 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
658 408b4ebc 2019-08-03 stsp echo -n > $testroot/stdout.expected
659 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
661 408b4ebc 2019-08-03 stsp if [ "$ret" != "0" ]; then
662 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
663 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
667 408b4ebc 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
668 408b4ebc 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
670 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
672 408b4ebc 2019-08-03 stsp echo "diff $head_commit $testroot/wt" > $testroot/stdout.expected
673 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
674 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
675 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
676 408b4ebc 2019-08-03 stsp echo 'file + alpha' >> $testroot/stdout.expected
677 408b4ebc 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
678 408b4ebc 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
679 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
680 408b4ebc 2019-08-03 stsp echo '-modified file' >> $testroot/stdout.expected
681 408b4ebc 2019-08-03 stsp echo '+modified file again' >> $testroot/stdout.expected
682 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
683 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
684 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
685 408b4ebc 2019-08-03 stsp echo 'file + foo' >> $testroot/stdout.expected
686 408b4ebc 2019-08-03 stsp echo '--- foo' >> $testroot/stdout.expected
687 408b4ebc 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
688 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
689 408b4ebc 2019-08-03 stsp echo '-new file' >> $testroot/stdout.expected
690 408b4ebc 2019-08-03 stsp echo '+new file changed' >> $testroot/stdout.expected
692 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
694 98eaaa12 2019-08-03 stsp if [ "$ret" != "0" ]; then
695 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
696 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
700 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
702 98eaaa12 2019-08-03 stsp echo "diff $head_commit $testroot/wt (staged changes)" \
703 98eaaa12 2019-08-03 stsp > $testroot/stdout.expected
704 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
705 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
706 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
707 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
708 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
709 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
710 98eaaa12 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
711 98eaaa12 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
712 98eaaa12 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
713 98eaaa12 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
714 98eaaa12 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
715 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
716 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
717 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
718 98eaaa12 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
719 98eaaa12 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
720 98eaaa12 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
721 98eaaa12 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
722 98eaaa12 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
723 98eaaa12 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
724 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
725 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
726 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
727 98eaaa12 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
728 98eaaa12 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
729 98eaaa12 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
730 98eaaa12 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
732 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
734 24278f30 2019-08-03 stsp if [ "$ret" != "0" ]; then
735 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
737 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
741 b9622844 2019-08-03 stsp function test_stage_histedit {
742 b9622844 2019-08-03 stsp local testroot=`test_init stage_histedit`
743 b9622844 2019-08-03 stsp local orig_commit=`git_show_head $testroot/repo`
745 b9622844 2019-08-03 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
747 b9622844 2019-08-03 stsp if [ "$ret" != "0" ]; then
748 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
752 b9622844 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
753 b9622844 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
755 b9622844 2019-08-03 stsp echo "modified alpha on master" > $testroot/repo/alpha
756 b9622844 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
757 b9622844 2019-08-03 stsp echo "new file on master" > $testroot/repo/epsilon/new
758 b9622844 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
759 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing changes"
760 b9622844 2019-08-03 stsp local old_commit1=`git_show_head $testroot/repo`
762 b9622844 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
763 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
764 b9622844 2019-08-03 stsp local old_commit2=`git_show_head $testroot/repo`
766 b9622844 2019-08-03 stsp echo "pick $old_commit1" > $testroot/histedit-script
767 b9622844 2019-08-03 stsp echo "pick $old_commit2" >> $testroot/histedit-script
769 b9622844 2019-08-03 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
770 b9622844 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
772 b9622844 2019-08-03 stsp if [ "$ret" == "0" ]; then
773 b9622844 2019-08-03 stsp echo "got histedit command succeeded unexpectedly" >&2
774 b9622844 2019-08-03 stsp test_done "$testroot" "1"
778 b9622844 2019-08-03 stsp echo -n > $testroot/stdout.expected
779 b9622844 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
781 b9622844 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
783 b9622844 2019-08-03 stsp if [ "$ret" != "0" ]; then
784 b9622844 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
785 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
788 b9622844 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
790 b9622844 2019-08-03 stsp if [ "$ret" != "0" ]; then
791 b9622844 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
793 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
797 243d7cf1 2019-08-03 stsp function test_stage_rebase {
798 243d7cf1 2019-08-03 stsp local testroot=`test_init stage_rebase`
800 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q -b newbranch)
801 243d7cf1 2019-08-03 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
802 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
804 243d7cf1 2019-08-03 stsp echo "modified alpha on branch" > $testroot/repo/alpha
805 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
806 243d7cf1 2019-08-03 stsp echo "new file on branch" > $testroot/repo/epsilon/new
807 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
808 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
810 243d7cf1 2019-08-03 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
811 243d7cf1 2019-08-03 stsp local orig_commit2=`git_show_head $testroot/repo`
813 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q master)
814 243d7cf1 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
815 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
816 243d7cf1 2019-08-03 stsp local master_commit=`git_show_head $testroot/repo`
818 243d7cf1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
820 243d7cf1 2019-08-03 stsp if [ "$ret" != "0" ]; then
821 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
825 243d7cf1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
826 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
828 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got rebase newbranch \
829 243d7cf1 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
831 243d7cf1 2019-08-03 stsp if [ "$ret" == "0" ]; then
832 243d7cf1 2019-08-03 stsp echo "got rebase command succeeded unexpectedly" >&2
833 243d7cf1 2019-08-03 stsp test_done "$testroot" "1"
837 243d7cf1 2019-08-03 stsp echo -n > $testroot/stdout.expected
838 243d7cf1 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
840 243d7cf1 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
842 243d7cf1 2019-08-03 stsp if [ "$ret" != "0" ]; then
843 243d7cf1 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
844 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
847 243d7cf1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
849 243d7cf1 2019-08-03 stsp if [ "$ret" != "0" ]; then
850 243d7cf1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
852 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
855 a76c42e6 2019-08-03 stsp function test_stage_update {
856 a76c42e6 2019-08-03 stsp local testroot=`test_init stage_update`
858 a76c42e6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
860 a76c42e6 2019-08-03 stsp if [ "$ret" != "0" ]; then
861 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
865 a76c42e6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
866 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
868 a76c42e6 2019-08-03 stsp echo "modified alpha" > $testroot/repo/alpha
869 a76c42e6 2019-08-03 stsp git_commit $testroot/repo -m "modified alpha"
871 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout \
872 a76c42e6 2019-08-03 stsp 2> $testroot/stderr)
874 a76c42e6 2019-08-03 stsp if [ "$ret" == "0" ]; then
875 a76c42e6 2019-08-03 stsp echo "got update command succeeded unexpectedly" >&2
876 a76c42e6 2019-08-03 stsp test_done "$testroot" "1"
880 a76c42e6 2019-08-03 stsp echo -n > $testroot/stdout.expected
881 a76c42e6 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
883 a76c42e6 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
885 a76c42e6 2019-08-03 stsp if [ "$ret" != "0" ]; then
886 a76c42e6 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
887 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
890 a76c42e6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
892 a76c42e6 2019-08-03 stsp if [ "$ret" != "0" ]; then
893 a76c42e6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
895 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
898 fccbfb98 2019-08-03 stsp run_test test_stage_basic
899 ebf48fd5 2019-08-03 stsp run_test test_stage_conflict
900 735ef5ac 2019-08-03 stsp run_test test_stage_out_of_date
901 d3e7c587 2019-08-03 stsp run_test test_double_stage
902 c363b2c1 2019-08-03 stsp run_test test_stage_status
903 1e1446d3 2019-08-03 stsp run_test test_stage_add_already_staged_file
904 9acbc4fa 2019-08-03 stsp run_test test_stage_rm_already_staged_file
905 24278f30 2019-08-03 stsp run_test test_stage_revert
906 408b4ebc 2019-08-03 stsp run_test test_stage_diff
907 b9622844 2019-08-03 stsp run_test test_stage_histedit
908 243d7cf1 2019-08-03 stsp run_test test_stage_rebase
909 a76c42e6 2019-08-03 stsp run_test test_stage_update