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 c861864b 2022-01-03 stsp # disable automatic packing for these tests
20 c861864b 2022-01-03 stsp export GOT_TEST_PACK=""
22 f6cae3ed 2020-09-13 naddy test_stage_basic() {
23 fccbfb98 2019-08-03 stsp local testroot=`test_init stage_basic`
25 fccbfb98 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
27 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
28 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
32 fccbfb98 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
33 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
34 fccbfb98 2019-08-03 stsp echo "new file" > $testroot/wt/foo
35 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
37 88d0e355 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
38 88d0e355 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
39 88d0e355 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
40 ec9d9b2f 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
42 fccbfb98 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
44 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
45 fccbfb98 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
47 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
50 f6cae3ed 2020-09-13 naddy test_stage_no_changes() {
51 31b20a6e 2019-08-06 stsp local testroot=`test_init stage_no_changes`
53 31b20a6e 2019-08-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
55 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
56 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
60 31b20a6e 2019-08-06 stsp (cd $testroot/wt && got stage alpha beta > $testroot/stdout \
61 31b20a6e 2019-08-06 stsp 2> $testroot/stderr)
63 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
64 31b20a6e 2019-08-06 stsp echo "got stage command succeeded unexpectedly" >&2
65 31b20a6e 2019-08-06 stsp test_done "$testroot" "1"
69 2db2652d 2019-08-07 stsp echo "got: no changes to stage" > $testroot/stderr.expected
71 31b20a6e 2019-08-06 stsp cmp -s $testroot/stderr.expected $testroot/stderr
73 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
74 31b20a6e 2019-08-06 stsp diff -u $testroot/stderr.expected $testroot/stderr
75 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
79 31b20a6e 2019-08-06 stsp echo -n > $testroot/stdout.expected
80 31b20a6e 2019-08-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
82 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
83 31b20a6e 2019-08-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
85 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
88 f6cae3ed 2020-09-13 naddy test_stage_unversioned() {
89 8b13ce36 2019-08-08 stsp local testroot=`test_init stage_unversioned`
91 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
93 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
94 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
98 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
99 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
101 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
102 8b13ce36 2019-08-08 stsp echo "M alpha" > $testroot/stdout.expected
103 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
104 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
106 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
107 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
108 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
112 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
114 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
115 8b13ce36 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
116 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
120 8b13ce36 2019-08-08 stsp echo " M alpha" > $testroot/stdout.expected
121 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
123 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
124 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
125 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
129 8b13ce36 2019-08-08 stsp echo "modified file again" > $testroot/wt/alpha
131 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage unversioned-file > $testroot/stdout \
132 8b13ce36 2019-08-08 stsp 2> $testroot/stderr)
134 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
135 8b13ce36 2019-08-08 stsp echo "got stage command succeed unexpectedly" >&2
136 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
140 8b13ce36 2019-08-08 stsp echo "got: no changes to stage" > $testroot/stderr.expected
141 8b13ce36 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
143 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
144 8b13ce36 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
146 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
150 f6cae3ed 2020-09-13 naddy test_stage_nonexistent() {
151 8564cb21 2019-08-08 stsp local testroot=`test_init stage_nonexistent`
153 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
155 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
156 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
160 8564cb21 2019-08-08 stsp (cd $testroot/wt && got stage nonexistent-file \
161 8564cb21 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
162 2a06fe5f 2019-08-24 stsp echo "got: nonexistent-file: No such file or directory" \
163 2a06fe5f 2019-08-24 stsp > $testroot/stderr.expected
164 8564cb21 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
166 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
167 8564cb21 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
169 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
172 f6cae3ed 2020-09-13 naddy test_stage_list() {
173 a4f692bb 2019-08-04 stsp local testroot=`test_init stage_list`
175 a4f692bb 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
177 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
178 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
182 a4f692bb 2019-08-04 stsp echo "modified file" > $testroot/wt/alpha
183 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got rm beta > /dev/null)
184 a4f692bb 2019-08-04 stsp echo "new file" > $testroot/wt/foo
185 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got add foo > /dev/null)
187 a4f692bb 2019-08-04 stsp echo ' M alpha' > $testroot/stdout.expected
188 a4f692bb 2019-08-04 stsp echo ' D beta' >> $testroot/stdout.expected
189 a4f692bb 2019-08-04 stsp echo ' A foo' >> $testroot/stdout.expected
190 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
192 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l > $testroot/stdout)
193 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
194 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
195 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
196 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s beta | grep '^blob -' | \
197 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
198 a4f692bb 2019-08-04 stsp echo " D beta" >> $testroot/stdout.expected
199 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s foo | grep '^blob +' | \
200 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
201 a4f692bb 2019-08-04 stsp echo " A foo" >> $testroot/stdout.expected
202 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
204 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
205 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
206 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
210 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l epsilon nonexistent \
211 a4f692bb 2019-08-04 stsp > $testroot/stdout)
213 a4f692bb 2019-08-04 stsp echo -n > $testroot/stdout.expected
214 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
216 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
217 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
218 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
222 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l alpha > $testroot/stdout)
224 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
225 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
226 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
227 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
229 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
230 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
232 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
236 f6cae3ed 2020-09-13 naddy test_stage_conflict() {
237 ebf48fd5 2019-08-03 stsp local testroot=`test_init stage_conflict`
238 ebf48fd5 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
240 ebf48fd5 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
242 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
243 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
247 ebf48fd5 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
248 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
250 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
252 ebf48fd5 2019-08-03 stsp echo "modified alpha, too" > $testroot/wt/alpha
254 ebf48fd5 2019-08-03 stsp echo "C alpha" > $testroot/stdout.expected
255 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
256 ebf48fd5 2019-08-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
257 ebf48fd5 2019-08-03 stsp echo >> $testroot/stdout.expected
258 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
260 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout)
262 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
264 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
265 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
270 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
271 ebf48fd5 2019-08-03 stsp 2> $testroot/stderr)
273 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
274 ebf48fd5 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
275 ebf48fd5 2019-08-03 stsp test_done "$testroot" "1"
279 ebf48fd5 2019-08-03 stsp echo -n > $testroot/stdout.expected
280 ebf48fd5 2019-08-03 stsp echo "got: alpha: cannot stage file in conflicted status" \
281 ebf48fd5 2019-08-03 stsp > $testroot/stderr.expected
283 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
285 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
286 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
287 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
290 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
292 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
293 ebf48fd5 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
295 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
298 f6cae3ed 2020-09-13 naddy test_stage_out_of_date() {
299 735ef5ac 2019-08-03 stsp local testroot=`test_init stage_out_of_date`
300 735ef5ac 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
302 735ef5ac 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
304 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
305 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
309 735ef5ac 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
310 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
312 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
314 735ef5ac 2019-08-03 stsp echo "modified alpha again" > $testroot/wt/alpha
315 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
316 735ef5ac 2019-08-03 stsp 2> $testroot/stderr)
318 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
319 735ef5ac 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
320 735ef5ac 2019-08-03 stsp test_done "$testroot" "1"
324 735ef5ac 2019-08-03 stsp echo -n > $testroot/stdout.expected
325 735ef5ac 2019-08-03 stsp echo "got: work tree must be updated before changes can be staged" \
326 735ef5ac 2019-08-03 stsp > $testroot/stderr.expected
328 735ef5ac 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
330 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
331 735ef5ac 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
332 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
335 735ef5ac 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
337 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
338 735ef5ac 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
340 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
344 f6cae3ed 2020-09-13 naddy test_double_stage() {
345 d3e7c587 2019-08-03 stsp local testroot=`test_init double_stage`
347 d3e7c587 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
349 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
350 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
353 d3e7c587 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
354 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
355 d3e7c587 2019-08-03 stsp echo "new file" > $testroot/wt/foo
356 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
357 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
359 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
360 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha 2> $testroot/stderr)
361 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
363 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
364 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
365 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
369 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage beta \
370 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
372 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
373 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
374 7b5dc508 2019-10-28 stsp test_done "$testroot" "1"
377 7b5dc508 2019-10-28 stsp echo -n > $testroot/stdout.expected
378 7b5dc508 2019-10-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
380 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
381 7b5dc508 2019-10-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
382 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
386 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
387 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
388 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
390 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
391 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
392 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
396 7b5dc508 2019-10-28 stsp printf "q\n" > $testroot/patchscript
397 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
398 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
400 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
401 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
402 d3e7c587 2019-08-03 stsp test_done "$testroot" "1"
405 d3e7c587 2019-08-03 stsp echo -n > $testroot/stdout.expected
406 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
408 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
409 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
410 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
414 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
415 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
416 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
418 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
419 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
420 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
424 d3e7c587 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
425 d3e7c587 2019-08-03 stsp echo "modified new file" > $testroot/wt/foo
427 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
428 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
429 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
430 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
432 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
433 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
434 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
438 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
439 d3e7c587 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
440 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
442 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
443 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
445 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
446 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
448 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
451 f6cae3ed 2020-09-13 naddy test_stage_status() {
452 c363b2c1 2019-08-03 stsp local testroot=`test_init stage_status`
454 c363b2c1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
456 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
457 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
461 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
462 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
463 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/foo
464 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
465 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/epsilon/new
466 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
467 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/epsilon/zeta
468 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm gamma/delta > /dev/null)
470 c363b2c1 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
471 c363b2c1 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
472 c363b2c1 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
473 c363b2c1 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
474 c363b2c1 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
475 c363b2c1 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
476 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
478 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
479 c363b2c1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
481 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
482 c363b2c1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
483 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
487 244725f2 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
488 244725f2 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
490 244725f2 2019-08-03 stsp echo 'MM alpha' > $testroot/stdout.expected
491 244725f2 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
492 244725f2 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
493 244725f2 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
494 244725f2 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
495 244725f2 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
497 244725f2 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
498 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
500 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
501 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
502 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
506 244725f2 2019-08-03 stsp # test no-op change of added file with new stat(2) timestamp
507 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/foo
508 244725f2 2019-08-03 stsp echo ' A foo' > $testroot/stdout.expected
509 244725f2 2019-08-03 stsp (cd $testroot/wt && got status foo > $testroot/stdout)
510 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
512 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
513 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
514 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
518 244725f2 2019-08-03 stsp # test staged deleted file which is restored on disk
519 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/beta
520 244725f2 2019-08-03 stsp echo ' D beta' > $testroot/stdout.expected
521 244725f2 2019-08-03 stsp (cd $testroot/wt && got status beta > $testroot/stdout)
522 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
524 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
525 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
527 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
531 f6cae3ed 2020-09-13 naddy test_stage_add_already_staged_file() {
532 1e1446d3 2019-08-03 stsp local testroot=`test_init stage_add_already_staged_file`
534 1e1446d3 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
536 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
537 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
541 1e1446d3 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
542 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
543 1e1446d3 2019-08-03 stsp echo "new file" > $testroot/wt/foo
544 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
546 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
548 1e1446d3 2019-08-03 stsp echo -n > $testroot/stdout.expected
549 6d022e97 2019-08-04 stsp for f in alpha beta foo; do
550 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add $f \
551 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
552 6d022e97 2019-08-04 stsp echo "got: $f: file has unexpected status" \
553 6d022e97 2019-08-04 stsp > $testroot/stderr.expected
554 6d022e97 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
556 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
557 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
558 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
561 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
563 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
564 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
565 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
570 1e1446d3 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
571 1e1446d3 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
572 1e1446d3 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
574 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
575 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
577 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
578 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
580 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
583 f6cae3ed 2020-09-13 naddy test_stage_rm_already_staged_file() {
584 9acbc4fa 2019-08-03 stsp local testroot=`test_init stage_rm_already_staged_file`
586 9acbc4fa 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
588 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
589 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
593 9acbc4fa 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
594 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
595 9acbc4fa 2019-08-03 stsp echo "new file" > $testroot/wt/foo
596 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
598 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
600 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta \
601 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
603 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
604 6d022e97 2019-08-04 stsp echo "got rm command failed unexpectedly" >&2
605 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
608 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
609 6d022e97 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
611 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
612 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
613 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
616 6d022e97 2019-08-04 stsp echo -n > $testroot/stderr.expected
617 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
619 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
620 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
621 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
625 9acbc4fa 2019-08-03 stsp for f in alpha foo; do
626 24278f30 2019-08-03 stsp echo "got: $f: file is staged" > $testroot/stderr.expected
627 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm $f \
628 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
630 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
631 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
632 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
635 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
638 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
639 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
644 9acbc4fa 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
645 9acbc4fa 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
646 9acbc4fa 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
648 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
649 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
651 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
652 9acbc4fa 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
654 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
657 f6cae3ed 2020-09-13 naddy test_stage_revert() {
658 24278f30 2019-08-03 stsp local testroot=`test_init stage_revert`
660 24278f30 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
662 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
663 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
667 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
668 24278f30 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
669 24278f30 2019-08-03 stsp echo "new file" > $testroot/wt/foo
670 24278f30 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
671 24278f30 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
673 24278f30 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
674 24278f30 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
676 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
678 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
679 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
680 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
684 24278f30 2019-08-03 stsp echo "R alpha" > $testroot/stdout.expected
685 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
687 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
688 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
689 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
693 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
694 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
695 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
697 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
698 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
699 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
703 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
704 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
705 24278f30 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
706 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
707 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
709 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
710 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
711 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
715 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
717 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
718 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
719 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
723 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
724 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
726 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
727 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
728 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
732 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
733 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
734 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
736 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
737 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
738 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
742 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert beta > $testroot/stdout \
743 24278f30 2019-08-03 stsp 2> $testroot/stderr)
745 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
746 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
747 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
751 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stdout.expected
752 d3bcc3d1 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
754 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
755 d3bcc3d1 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
756 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
760 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
761 24278f30 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
763 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
764 24278f30 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
765 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
769 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
771 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
772 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
773 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
777 24278f30 2019-08-03 stsp echo "R foo" > $testroot/stdout.expected
778 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
780 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
781 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
782 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
786 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
787 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
788 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
790 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
791 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
792 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
796 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
797 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
798 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
799 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
800 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
802 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
803 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
804 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
808 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
810 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
811 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
812 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
816 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
817 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
819 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
820 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
821 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
825 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
826 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
827 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
829 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
830 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
831 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
835 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
836 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
837 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
838 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
839 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
841 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
842 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
843 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
847 0f6d7415 2019-08-08 stsp echo "modified file again" >> $testroot/wt/alpha
848 0f6d7415 2019-08-08 stsp echo "modified added file again" >> $testroot/wt/foo
850 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout \
851 0f6d7415 2019-08-08 stsp 2> $testroot/stderr)
853 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
854 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
855 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
859 0f6d7415 2019-08-08 stsp echo "R alpha" > $testroot/stdout.expected
860 d3bcc3d1 2019-08-08 stsp echo "R foo" >> $testroot/stdout.expected
861 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
863 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
864 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
865 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
869 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
870 0f6d7415 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
872 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
873 0f6d7415 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
874 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
878 0f6d7415 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
879 0f6d7415 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
880 d3bcc3d1 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
881 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
882 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
884 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
885 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
887 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
890 f6cae3ed 2020-09-13 naddy test_stage_diff() {
891 408b4ebc 2019-08-03 stsp local testroot=`test_init stage_diff`
892 408b4ebc 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
894 408b4ebc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
896 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
897 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
901 408b4ebc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
902 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
903 408b4ebc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
904 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
906 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
907 98eaaa12 2019-08-03 stsp echo -n > $testroot/stdout.expected
908 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
910 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
911 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
912 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
916 408b4ebc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
917 408b4ebc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
918 408b4ebc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
919 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
921 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
922 408b4ebc 2019-08-03 stsp echo -n > $testroot/stdout.expected
923 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
925 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
926 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
927 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
931 408b4ebc 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
932 408b4ebc 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
934 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
936 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
937 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
938 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
939 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
940 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 | tr -d '\n' \
941 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
942 4ce46740 2019-08-08 stsp echo ' (staged)' >> $testroot/stdout.expected
943 408b4ebc 2019-08-03 stsp echo 'file + alpha' >> $testroot/stdout.expected
944 408b4ebc 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
945 408b4ebc 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
946 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
947 408b4ebc 2019-08-03 stsp echo '-modified file' >> $testroot/stdout.expected
948 408b4ebc 2019-08-03 stsp echo '+modified file again' >> $testroot/stdout.expected
949 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
950 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 | tr -d '\n' \
951 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
952 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
953 408b4ebc 2019-08-03 stsp echo 'file + foo' >> $testroot/stdout.expected
954 408b4ebc 2019-08-03 stsp echo '--- foo' >> $testroot/stdout.expected
955 408b4ebc 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
956 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
957 408b4ebc 2019-08-03 stsp echo '-new file' >> $testroot/stdout.expected
958 408b4ebc 2019-08-03 stsp echo '+new file changed' >> $testroot/stdout.expected
960 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
962 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
963 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
964 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
968 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
970 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
971 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
972 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
973 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
974 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
975 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
976 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
977 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
978 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
979 98eaaa12 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
980 98eaaa12 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
981 98eaaa12 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
982 98eaaa12 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
983 98eaaa12 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
984 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
985 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
986 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
987 98eaaa12 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
988 98eaaa12 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
989 98eaaa12 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
990 98eaaa12 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
991 98eaaa12 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
992 98eaaa12 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
993 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
994 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
995 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
996 98eaaa12 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
997 98eaaa12 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
998 98eaaa12 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
999 98eaaa12 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1001 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1003 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1004 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1006 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
1010 f6cae3ed 2020-09-13 naddy test_stage_histedit() {
1011 b9622844 2019-08-03 stsp local testroot=`test_init stage_histedit`
1012 b9622844 2019-08-03 stsp local orig_commit=`git_show_head $testroot/repo`
1014 b9622844 2019-08-03 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1016 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1017 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1021 b9622844 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1022 b9622844 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1024 b9622844 2019-08-03 stsp echo "modified alpha on master" > $testroot/repo/alpha
1025 b9622844 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1026 b9622844 2019-08-03 stsp echo "new file on master" > $testroot/repo/epsilon/new
1027 b9622844 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1028 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing changes"
1029 b9622844 2019-08-03 stsp local old_commit1=`git_show_head $testroot/repo`
1031 b9622844 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1032 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1033 b9622844 2019-08-03 stsp local old_commit2=`git_show_head $testroot/repo`
1035 b9622844 2019-08-03 stsp echo "pick $old_commit1" > $testroot/histedit-script
1036 b9622844 2019-08-03 stsp echo "pick $old_commit2" >> $testroot/histedit-script
1038 b9622844 2019-08-03 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1039 b9622844 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1041 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1042 b9622844 2019-08-03 stsp echo "got histedit command succeeded unexpectedly" >&2
1043 b9622844 2019-08-03 stsp test_done "$testroot" "1"
1047 b9622844 2019-08-03 stsp echo -n > $testroot/stdout.expected
1048 b9622844 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1050 b9622844 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1052 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1053 b9622844 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1054 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1057 b9622844 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1059 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1060 b9622844 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1062 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1066 f6cae3ed 2020-09-13 naddy test_stage_rebase() {
1067 243d7cf1 2019-08-03 stsp local testroot=`test_init stage_rebase`
1069 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1070 243d7cf1 2019-08-03 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
1071 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
1073 243d7cf1 2019-08-03 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1074 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1075 243d7cf1 2019-08-03 stsp echo "new file on branch" > $testroot/repo/epsilon/new
1076 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1077 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
1079 243d7cf1 2019-08-03 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
1080 243d7cf1 2019-08-03 stsp local orig_commit2=`git_show_head $testroot/repo`
1082 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q master)
1083 243d7cf1 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1084 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1085 243d7cf1 2019-08-03 stsp local master_commit=`git_show_head $testroot/repo`
1087 243d7cf1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1089 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1090 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1094 243d7cf1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1095 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1097 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got rebase newbranch \
1098 243d7cf1 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1100 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1101 243d7cf1 2019-08-03 stsp echo "got rebase command succeeded unexpectedly" >&2
1102 243d7cf1 2019-08-03 stsp test_done "$testroot" "1"
1106 243d7cf1 2019-08-03 stsp echo -n > $testroot/stdout.expected
1107 243d7cf1 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1109 243d7cf1 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1111 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1112 243d7cf1 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1113 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1116 243d7cf1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1118 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1119 243d7cf1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1121 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1124 f6cae3ed 2020-09-13 naddy test_stage_update() {
1125 a76c42e6 2019-08-03 stsp local testroot=`test_init stage_update`
1127 a76c42e6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1129 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1130 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1134 a76c42e6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1135 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1137 a76c42e6 2019-08-03 stsp echo "modified alpha" > $testroot/repo/alpha
1138 a76c42e6 2019-08-03 stsp git_commit $testroot/repo -m "modified alpha"
1140 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout \
1141 a76c42e6 2019-08-03 stsp 2> $testroot/stderr)
1143 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1144 a76c42e6 2019-08-03 stsp echo "got update command succeeded unexpectedly" >&2
1145 a76c42e6 2019-08-03 stsp test_done "$testroot" "1"
1149 a76c42e6 2019-08-03 stsp echo -n > $testroot/stdout.expected
1150 a76c42e6 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1152 a76c42e6 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1154 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1155 a76c42e6 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1156 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1159 a76c42e6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1161 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1162 a76c42e6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1164 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1167 f6cae3ed 2020-09-13 naddy test_stage_commit_non_staged() {
1168 f0b75401 2019-08-03 stsp local testroot=`test_init stage_commit_non_staged`
1170 f0b75401 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1173 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1177 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1178 f0b75401 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1179 f0b75401 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1180 f0b75401 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1181 f0b75401 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1183 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/gamma/delta
1184 f0b75401 2019-08-03 stsp (cd $testroot/wt && got commit -m "change delta" gamma/delta \
1185 f0b75401 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1187 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1188 f0b75401 2019-08-03 stsp echo "got commit command succeeded unexpectedly" >&2
1189 f0b75401 2019-08-03 stsp test_done "$testroot" "1"
1193 f0b75401 2019-08-03 stsp echo -n > $testroot/stdout.expected
1194 f0b75401 2019-08-03 stsp echo "got: gamma/delta: file is not staged" > $testroot/stderr.expected
1196 f0b75401 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1198 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1199 f0b75401 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1200 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1203 f0b75401 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1205 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1206 f0b75401 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1208 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1211 f6cae3ed 2020-09-13 naddy test_stage_commit_out_of_date() {
1212 0f1cfa7f 2019-08-08 stsp local testroot=`test_init stage_commit_out_of_date`
1214 0f1cfa7f 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1216 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1217 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1221 0f1cfa7f 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
1222 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
1223 0f1cfa7f 2019-08-08 stsp echo "new file" > $testroot/wt/foo
1224 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
1225 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1227 0f1cfa7f 2019-08-08 stsp echo "changed file" > $testroot/repo/alpha
1228 0f1cfa7f 2019-08-08 stsp git_commit $testroot/repo -m "changed alpha in repo"
1230 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try to commit" > $testroot/stdout \
1231 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1233 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1234 0f1cfa7f 2019-08-08 stsp echo "got commit command succeeded unexpectedly" >&2
1235 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "1"
1239 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1240 0f1cfa7f 2019-08-08 stsp echo -n "got: work tree must be updated before these changes " \
1241 0f1cfa7f 2019-08-08 stsp > $testroot/stderr.expected
1242 0f1cfa7f 2019-08-08 stsp echo "can be committed" >> $testroot/stderr.expected
1244 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1246 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1247 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1248 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1251 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1253 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1254 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1255 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1259 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout \
1260 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1261 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1262 0f1cfa7f 2019-08-08 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1264 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1266 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1267 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1268 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1271 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1273 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1274 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1275 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1279 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got unstage > /dev/null)
1280 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
1282 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1283 0f1cfa7f 2019-08-08 stsp echo "got update command failed unexpectedly" >&2
1284 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1288 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1289 0f1cfa7f 2019-08-08 stsp echo "C alpha" > $testroot/stdout.expected
1290 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1291 0f1cfa7f 2019-08-08 stsp echo "A foo" >> $testroot/stdout.expected
1292 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1294 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1295 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1296 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1300 0f1cfa7f 2019-08-08 stsp # resolve conflict
1301 0f1cfa7f 2019-08-08 stsp echo "resolved file" > $testroot/wt/alpha
1303 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
1305 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try again" > $testroot/stdout)
1307 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1308 0f1cfa7f 2019-08-08 stsp echo "got commit command failed unexpectedly" >&2
1309 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1313 0f1cfa7f 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1314 0f1cfa7f 2019-08-08 stsp echo "A foo" > $testroot/stdout.expected
1315 0f1cfa7f 2019-08-08 stsp echo "M alpha" >> $testroot/stdout.expected
1316 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1317 0f1cfa7f 2019-08-08 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1318 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1320 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1321 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1323 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1327 f6cae3ed 2020-09-13 naddy test_stage_commit() {
1328 5f8a88c6 2019-08-03 stsp local testroot=`test_init stage_commit`
1329 5f8a88c6 2019-08-03 stsp local first_commit=`git_show_head $testroot/repo`
1331 5f8a88c6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1333 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1334 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1338 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1339 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1340 5f8a88c6 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1341 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1342 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1343 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1345 5f8a88c6 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
1346 5f8a88c6 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
1347 5f8a88c6 2019-08-03 stsp echo "non-staged change" > $testroot/wt/gamma/delta
1348 5f8a88c6 2019-08-03 stsp echo "non-staged new file" > $testroot/wt/epsilon/new
1349 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1350 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm epsilon/zeta > /dev/null)
1352 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
1353 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_alpha
1354 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
1355 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_foo
1357 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got commit -m "staged changes" \
1358 5f8a88c6 2019-08-03 stsp > $testroot/stdout)
1360 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1361 5f8a88c6 2019-08-03 stsp echo "got commit command failed unexpectedly" >&2
1362 5f8a88c6 2019-08-03 stsp test_done "$testroot" "1"
1366 5f8a88c6 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
1367 5f8a88c6 2019-08-03 stsp echo "A foo" > $testroot/stdout.expected
1368 5f8a88c6 2019-08-03 stsp echo "M alpha" >> $testroot/stdout.expected
1369 5f8a88c6 2019-08-03 stsp echo "D beta" >> $testroot/stdout.expected
1370 5f8a88c6 2019-08-03 stsp echo "Created commit $head_commit" >> $testroot/stdout.expected
1372 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1374 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1375 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1376 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1380 5f8a88c6 2019-08-03 stsp got diff -r $testroot/repo $first_commit $head_commit \
1381 5f8a88c6 2019-08-03 stsp > $testroot/stdout
1383 5f8a88c6 2019-08-03 stsp echo "diff $first_commit $head_commit" \
1384 5f8a88c6 2019-08-03 stsp > $testroot/stdout.expected
1385 8469d821 2022-06-25 stsp echo "commit - $first_commit" >> $testroot/stdout.expected
1386 8469d821 2022-06-25 stsp echo "commit + $head_commit" >> $testroot/stdout.expected
1387 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1388 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit | \
1389 5f8a88c6 2019-08-03 stsp grep 'alpha$' | cut -d' ' -f 1 \
1390 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1391 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1392 5f8a88c6 2019-08-03 stsp cat $testroot/blob_id_alpha >> $testroot/stdout.expected
1393 5f8a88c6 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
1394 5f8a88c6 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
1395 5f8a88c6 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1396 5f8a88c6 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
1397 5f8a88c6 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
1398 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1399 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit \
1400 46f68b20 2019-10-19 stsp | grep 'beta$' | cut -d' ' -f 1 | tr -d '\n' \
1401 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1402 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1403 5f8a88c6 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1404 5f8a88c6 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
1405 5f8a88c6 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1406 5f8a88c6 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1407 5f8a88c6 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
1408 5f8a88c6 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1409 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1410 46f68b20 2019-10-19 stsp cat $testroot/blob_id_foo | tr -d '\n' >> $testroot/stdout.expected
1411 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1412 5f8a88c6 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
1413 5f8a88c6 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
1414 5f8a88c6 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1415 5f8a88c6 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1417 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1419 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1420 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1421 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1425 72fd46fa 2019-09-06 stsp echo 'M alpha' > $testroot/stdout.expected
1426 72fd46fa 2019-09-06 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
1427 5f8a88c6 2019-08-03 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
1428 72fd46fa 2019-09-06 stsp echo 'M foo' >> $testroot/stdout.expected
1429 5f8a88c6 2019-08-03 stsp echo 'M gamma/delta' >> $testroot/stdout.expected
1431 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
1432 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1434 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1435 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1437 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1440 f6cae3ed 2020-09-13 naddy test_stage_patch() {
1441 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch`
1443 dc424a06 2019-08-07 stsp jot 16 > $testroot/repo/numbers
1444 dc424a06 2019-08-07 stsp (cd $testroot/repo && git add numbers)
1445 dc424a06 2019-08-07 stsp git_commit $testroot/repo -m "added numbers file"
1446 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1448 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1450 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1451 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1455 dc424a06 2019-08-07 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
1456 dc424a06 2019-08-07 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
1457 dc424a06 2019-08-07 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
1459 dc424a06 2019-08-07 stsp # don't stage any hunks
1460 dc424a06 2019-08-07 stsp printf "n\nn\nn\n" > $testroot/patchscript
1461 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1462 7b5dc508 2019-10-28 stsp numbers > $testroot/stdout 2> $testroot/stderr)
1464 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1465 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
1466 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1469 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1470 dc424a06 2019-08-07 stsp -----------------------------------------------
1471 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1478 dc424a06 2019-08-07 stsp -----------------------------------------------
1479 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1480 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1481 dc424a06 2019-08-07 stsp -----------------------------------------------
1482 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1491 dc424a06 2019-08-07 stsp -----------------------------------------------
1492 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1493 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1494 dc424a06 2019-08-07 stsp -----------------------------------------------
1495 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1501 dc424a06 2019-08-07 stsp -----------------------------------------------
1502 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1503 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1505 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1507 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1508 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1509 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1513 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
1514 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1516 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1517 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
1518 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
1523 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1524 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1525 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1527 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1528 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1529 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1533 dc424a06 2019-08-07 stsp # stage middle hunk
1534 dc424a06 2019-08-07 stsp printf "n\ny\nn\n" > $testroot/patchscript
1535 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1536 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1538 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1539 dc424a06 2019-08-07 stsp -----------------------------------------------
1540 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1547 dc424a06 2019-08-07 stsp -----------------------------------------------
1548 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1549 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1550 dc424a06 2019-08-07 stsp -----------------------------------------------
1551 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1560 dc424a06 2019-08-07 stsp -----------------------------------------------
1561 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1562 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1563 dc424a06 2019-08-07 stsp -----------------------------------------------
1564 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1570 dc424a06 2019-08-07 stsp -----------------------------------------------
1571 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1572 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1574 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1576 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1577 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1578 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1582 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1583 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1584 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1586 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1587 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1588 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1592 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1594 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1595 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1596 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1597 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1598 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1599 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1600 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1601 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1602 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1603 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1604 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1605 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1606 dc424a06 2019-08-07 stsp echo "@@ -4,7 +4,7 @@" >> $testroot/stdout.expected
1607 dc424a06 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
1608 dc424a06 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
1609 dc424a06 2019-08-07 stsp echo " 6" >> $testroot/stdout.expected
1610 dc424a06 2019-08-07 stsp echo "-7" >> $testroot/stdout.expected
1611 dc424a06 2019-08-07 stsp echo "+b" >> $testroot/stdout.expected
1612 dc424a06 2019-08-07 stsp echo " 8" >> $testroot/stdout.expected
1613 dc424a06 2019-08-07 stsp echo " 9" >> $testroot/stdout.expected
1614 dc424a06 2019-08-07 stsp echo " 10" >> $testroot/stdout.expected
1615 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1617 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1618 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1619 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1623 dc424a06 2019-08-07 stsp (cd $testroot/wt && got unstage >/dev/null)
1625 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1626 dc424a06 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
1627 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1630 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1631 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1632 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1634 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1635 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1636 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1640 dc424a06 2019-08-07 stsp # stage last hunk
1641 dc424a06 2019-08-07 stsp printf "n\nn\ny\n" > $testroot/patchscript
1642 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1643 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1645 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1646 dc424a06 2019-08-07 stsp -----------------------------------------------
1647 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1654 dc424a06 2019-08-07 stsp -----------------------------------------------
1655 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1656 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1657 dc424a06 2019-08-07 stsp -----------------------------------------------
1658 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1667 dc424a06 2019-08-07 stsp -----------------------------------------------
1668 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1669 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1670 dc424a06 2019-08-07 stsp -----------------------------------------------
1671 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1677 dc424a06 2019-08-07 stsp -----------------------------------------------
1678 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1679 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1681 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1683 49c543a6 2022-03-31 naddy if [ $ret -ne 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 status > $testroot/stdout)
1690 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1691 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1693 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1694 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1695 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1699 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1701 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1702 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1703 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1704 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1705 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1706 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1707 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1708 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1709 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1710 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1711 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1712 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1713 dc424a06 2019-08-07 stsp echo "@@ -13,4 +13,4 @@" >> $testroot/stdout.expected
1714 dc424a06 2019-08-07 stsp echo " 13" >> $testroot/stdout.expected
1715 dc424a06 2019-08-07 stsp echo " 14" >> $testroot/stdout.expected
1716 dc424a06 2019-08-07 stsp echo " 15" >> $testroot/stdout.expected
1717 dc424a06 2019-08-07 stsp echo "-16" >> $testroot/stdout.expected
1718 dc424a06 2019-08-07 stsp echo "+c" >> $testroot/stdout.expected
1719 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1721 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1722 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1724 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1727 f6cae3ed 2020-09-13 naddy test_stage_patch_twice() {
1728 af5a81b2 2019-08-08 stsp local testroot=`test_init stage_patch_twice`
1730 af5a81b2 2019-08-08 stsp jot 16 > $testroot/repo/numbers
1731 af5a81b2 2019-08-08 stsp (cd $testroot/repo && git add numbers)
1732 af5a81b2 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
1733 af5a81b2 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1735 af5a81b2 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1737 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1738 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1742 af5a81b2 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
1743 af5a81b2 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
1744 af5a81b2 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
1746 af5a81b2 2019-08-08 stsp # stage middle hunk
1747 af5a81b2 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
1748 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1749 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1751 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1752 af5a81b2 2019-08-08 stsp -----------------------------------------------
1753 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1760 af5a81b2 2019-08-08 stsp -----------------------------------------------
1761 af5a81b2 2019-08-08 stsp M numbers (change 1 of 3)
1762 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1763 af5a81b2 2019-08-08 stsp -----------------------------------------------
1764 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1773 af5a81b2 2019-08-08 stsp -----------------------------------------------
1774 af5a81b2 2019-08-08 stsp M numbers (change 2 of 3)
1775 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1776 af5a81b2 2019-08-08 stsp -----------------------------------------------
1777 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1783 af5a81b2 2019-08-08 stsp -----------------------------------------------
1784 af5a81b2 2019-08-08 stsp M numbers (change 3 of 3)
1785 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1787 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1789 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1790 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1791 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1795 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1796 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1797 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1799 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1800 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1801 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1805 af5a81b2 2019-08-08 stsp # stage last hunk
1806 af5a81b2 2019-08-08 stsp printf "n\ny\n" > $testroot/patchscript
1807 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1808 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1810 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1811 af5a81b2 2019-08-08 stsp -----------------------------------------------
1812 fe621944 2020-11-10 stsp @@ -1,5 +1,5 @@
1819 af5a81b2 2019-08-08 stsp -----------------------------------------------
1820 af5a81b2 2019-08-08 stsp M numbers (change 1 of 2)
1821 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1822 af5a81b2 2019-08-08 stsp -----------------------------------------------
1823 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@ b
1829 af5a81b2 2019-08-08 stsp -----------------------------------------------
1830 af5a81b2 2019-08-08 stsp M numbers (change 2 of 2)
1831 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1833 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1835 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1836 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1837 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1841 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1842 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1843 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1845 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1846 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1847 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1851 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1853 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1854 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1855 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1856 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1857 af5a81b2 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
1858 af5a81b2 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1859 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1860 af5a81b2 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1861 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1862 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1863 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1864 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1865 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1866 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1875 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1882 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1884 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1885 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1886 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1890 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1892 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1893 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1894 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1895 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1896 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
1897 af5a81b2 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
1898 af5a81b2 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
1899 af5a81b2 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
1900 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1901 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1902 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1903 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1911 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1913 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1914 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1916 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1919 f6cae3ed 2020-09-13 naddy test_stage_patch_added() {
1920 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_added`
1921 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1923 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1925 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1926 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1930 dc424a06 2019-08-07 stsp echo "new" > $testroot/wt/epsilon/new
1931 dc424a06 2019-08-07 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1933 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
1934 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1935 dc424a06 2019-08-07 stsp epsilon/new > $testroot/stdout)
1937 dc424a06 2019-08-07 stsp echo "A epsilon/new" > $testroot/stdout.expected
1938 c8ede203 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1939 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1941 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1942 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1943 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1947 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1948 dc424a06 2019-08-07 stsp echo " A epsilon/new" > $testroot/stdout.expected
1949 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1951 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1952 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1953 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1957 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1959 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1960 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1961 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1962 dc424a06 2019-08-07 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1963 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1964 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \
1965 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1966 dc424a06 2019-08-07 stsp echo "--- /dev/null" >> $testroot/stdout.expected
1967 dc424a06 2019-08-07 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
1968 dc424a06 2019-08-07 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
1969 dc424a06 2019-08-07 stsp echo "+new" >> $testroot/stdout.expected
1970 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1972 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1973 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1975 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1978 f6cae3ed 2020-09-13 naddy test_stage_patch_added_twice() {
1979 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_added_twice`
1980 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1982 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1984 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1985 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1989 e70a841e 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
1990 e70a841e 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1992 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
1993 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1994 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout)
1996 e70a841e 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
1997 e70a841e 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1998 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2000 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2001 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2002 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2006 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2007 e70a841e 2019-08-08 stsp echo " A epsilon/new" > $testroot/stdout.expected
2008 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2010 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2011 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2012 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2016 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2017 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout 2> $testroot/stderr)
2019 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2020 e70a841e 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2021 e70a841e 2019-08-08 stsp test_done "$testroot" "1"
2025 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2026 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2028 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2029 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2030 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2034 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2035 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2037 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2038 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2040 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2043 f6cae3ed 2020-09-13 naddy test_stage_patch_removed() {
2044 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_removed`
2045 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2047 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2049 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2050 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2054 dc424a06 2019-08-07 stsp (cd $testroot/wt && got rm beta > /dev/null)
2056 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
2057 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2058 dc424a06 2019-08-07 stsp beta > $testroot/stdout)
2060 dc424a06 2019-08-07 stsp echo -n > $testroot/stdout.expected
2062 dc424a06 2019-08-07 stsp echo "D beta" > $testroot/stdout.expected
2063 f5a17245 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2064 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2066 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2067 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2068 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2072 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2073 dc424a06 2019-08-07 stsp echo " D beta" > $testroot/stdout.expected
2074 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2076 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2077 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2078 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2082 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2084 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2085 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2086 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2087 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2088 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \
2089 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
2090 dc424a06 2019-08-07 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2091 dc424a06 2019-08-07 stsp echo "--- beta" >> $testroot/stdout.expected
2092 dc424a06 2019-08-07 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
2093 dc424a06 2019-08-07 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
2094 dc424a06 2019-08-07 stsp echo "-beta" >> $testroot/stdout.expected
2095 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2097 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2098 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2100 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2103 f6cae3ed 2020-09-13 naddy test_stage_patch_removed_twice() {
2104 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_removed_twice`
2105 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2107 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2109 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2110 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2114 e70a841e 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
2116 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2117 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2118 e70a841e 2019-08-08 stsp beta > $testroot/stdout)
2120 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2122 e70a841e 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
2123 e70a841e 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2124 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2126 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2127 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2128 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2132 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2133 e70a841e 2019-08-08 stsp echo " D beta" > $testroot/stdout.expected
2134 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2136 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2137 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2138 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2142 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p beta \
2143 e70a841e 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2145 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2146 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
2147 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2151 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2152 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2154 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2155 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2156 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2160 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2161 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2163 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2164 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2166 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2169 9fdde394 2022-06-04 op test_stage_patch_reversed() {
2170 9fdde394 2022-06-04 op local testroot=`test_init stage_patch_reversed`
2172 9fdde394 2022-06-04 op got checkout $testroot/repo $testroot/wt > /dev/null
2174 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2175 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2179 9fdde394 2022-06-04 op echo 'ALPHA' > $testroot/wt/alpha
2180 9fdde394 2022-06-04 op (cd $testroot/wt && got stage alpha > $testroot/stdout)
2182 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2183 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2187 9fdde394 2022-06-04 op echo ' M alpha' > $testroot/stdout.expected
2188 9fdde394 2022-06-04 op cmp -s $testroot/stdout.expected $testroot/stdout
2190 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2191 9fdde394 2022-06-04 op diff -u $testroot/stdout.expected $testroot/stdout
2192 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2196 9fdde394 2022-06-04 op echo 'alpha' > $testroot/wt/alpha
2197 9fdde394 2022-06-04 op (cd $testroot/wt && got stage alpha > $testroot/stdout)
2199 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2200 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2204 9fdde394 2022-06-04 op echo ' M alpha' > $testroot/stdout.expected
2205 9fdde394 2022-06-04 op cmp -s $testroot/stdout.expected $testroot/stdout
2207 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2208 9fdde394 2022-06-04 op diff -u $testroot/stdout.expected $testroot/stdout
2209 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2213 9fdde394 2022-06-04 op (cd $testroot/wt && got status > $testroot/stdout)
2214 9fdde394 2022-06-04 op cmp -s /dev/null $testroot/stdout
2216 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2217 9fdde394 2022-06-04 op diff -u /dev/null $testroot/stdout
2219 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2222 f6cae3ed 2020-09-13 naddy test_stage_patch_quit() {
2223 b353a198 2019-08-07 stsp local testroot=`test_init stage_patch_quit`
2225 b353a198 2019-08-07 stsp jot 16 > $testroot/repo/numbers
2226 88f33a19 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2227 88f33a19 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2228 88f33a19 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2229 b353a198 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2231 b353a198 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2233 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2234 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2238 b353a198 2019-08-07 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
2239 b353a198 2019-08-07 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
2240 b353a198 2019-08-07 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
2241 88f33a19 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
2243 88f33a19 2019-08-08 stsp # stage first hunk and quit; and don't pass a path argument to
2244 88f33a19 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
2245 88f33a19 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
2246 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2247 2db2652d 2019-08-07 stsp > $testroot/stdout)
2249 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2250 b353a198 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
2251 b353a198 2019-08-07 stsp test_done "$testroot" "1"
2254 b353a198 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
2255 b353a198 2019-08-07 stsp -----------------------------------------------
2256 b353a198 2019-08-07 stsp @@ -1,5 +1,5 @@
2263 b353a198 2019-08-07 stsp -----------------------------------------------
2264 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
2265 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
2266 b353a198 2019-08-07 stsp -----------------------------------------------
2267 b353a198 2019-08-07 stsp @@ -4,7 +4,7 @@
2276 b353a198 2019-08-07 stsp -----------------------------------------------
2277 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
2278 b353a198 2019-08-07 stsp stage this change? [y/n/q] q
2280 f5a17245 2019-08-08 stsp stage this deletion? [y/n] n
2282 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2284 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2285 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2286 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2290 b353a198 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2291 b353a198 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
2292 88f33a19 2019-08-08 stsp echo "D zzz" >> $testroot/stdout.expected
2293 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2295 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2296 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2297 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2301 b353a198 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2303 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2304 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2305 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2306 b353a198 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2307 b353a198 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
2308 b353a198 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
2309 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2310 b353a198 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2311 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
2312 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2313 b353a198 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
2314 b353a198 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
2315 b353a198 2019-08-07 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
2316 b353a198 2019-08-07 stsp echo " 1" >> $testroot/stdout.expected
2317 b353a198 2019-08-07 stsp echo "-2" >> $testroot/stdout.expected
2318 b353a198 2019-08-07 stsp echo "+a" >> $testroot/stdout.expected
2319 b353a198 2019-08-07 stsp echo " 3" >> $testroot/stdout.expected
2320 b353a198 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
2321 b353a198 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
2322 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2324 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2325 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2327 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2331 f6cae3ed 2020-09-13 naddy test_stage_patch_incomplete_script() {
2332 eba70f38 2019-08-08 stsp local testroot=`test_init stage_incomplete_script`
2334 eba70f38 2019-08-08 stsp jot 16 > $testroot/repo/numbers
2335 eba70f38 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2336 eba70f38 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2337 eba70f38 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2338 eba70f38 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2340 eba70f38 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2342 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2343 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2347 eba70f38 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
2348 eba70f38 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
2349 eba70f38 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
2351 eba70f38 2019-08-08 stsp # stage first hunk and then stop responding; got should error out
2352 eba70f38 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2353 eba70f38 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2354 eba70f38 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2356 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2357 eba70f38 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2358 eba70f38 2019-08-08 stsp test_done "$testroot" "1"
2361 eba70f38 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
2362 eba70f38 2019-08-08 stsp -----------------------------------------------
2363 eba70f38 2019-08-08 stsp @@ -1,5 +1,5 @@
2370 eba70f38 2019-08-08 stsp -----------------------------------------------
2371 eba70f38 2019-08-08 stsp M numbers (change 1 of 3)
2372 eba70f38 2019-08-08 stsp stage this change? [y/n/q] y
2373 eba70f38 2019-08-08 stsp -----------------------------------------------
2374 eba70f38 2019-08-08 stsp @@ -4,7 +4,7 @@
2383 eba70f38 2019-08-08 stsp -----------------------------------------------
2384 eba70f38 2019-08-08 stsp M numbers (change 2 of 3)
2386 eba70f38 2019-08-08 stsp echo -n "stage this change? [y/n/q] " >> $testroot/stdout.expected
2387 eba70f38 2019-08-08 stsp echo "got: invalid patch choice" > $testroot/stderr.expected
2388 eba70f38 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2390 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2391 eba70f38 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2392 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2396 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2398 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2399 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2400 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2404 eba70f38 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2405 eba70f38 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
2406 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2408 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2409 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2410 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2414 eba70f38 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2415 eba70f38 2019-08-08 stsp echo -n > $testroot/stdout.expected
2416 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2418 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2419 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2421 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2425 f6cae3ed 2020-09-13 naddy test_stage_symlink() {
2426 c631b115 2020-07-23 stsp local testroot=`test_init stage_symlink`
2428 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2429 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2430 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2431 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2432 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2433 c631b115 2020-07-23 stsp (cd $testroot/repo && git add .)
2434 c631b115 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2435 c631b115 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2437 c631b115 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2439 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2440 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2444 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2445 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sfh gamma epsilon.link)
2446 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2447 c631b115 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2448 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2449 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2450 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2451 c631b115 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2452 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2453 c631b115 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2455 35213c7c 2020-07-23 stsp (cd $testroot/wt && got stage > $testroot/stdout 2> $testroot/stderr)
2457 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2458 35213c7c 2020-07-23 stsp echo "got stage succeeded unexpectedly" >&2
2459 a19f439c 2022-06-03 op test_done "$testroot" 1
2462 35213c7c 2020-07-23 stsp echo -n "got: $testroot/wt/dotgotbar.link: " > $testroot/stderr.expected
2463 35213c7c 2020-07-23 stsp echo "symbolic link points outside of paths under version control" \
2464 35213c7c 2020-07-23 stsp >> $testroot/stderr.expected
2465 35213c7c 2020-07-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2467 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2468 35213c7c 2020-07-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
2469 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
2473 35213c7c 2020-07-23 stsp (cd $testroot/wt && got stage -S > $testroot/stdout)
2475 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2476 c631b115 2020-07-23 stsp M alpha.link
2477 c631b115 2020-07-23 stsp A dotgotbar.link
2478 c631b115 2020-07-23 stsp A dotgotfoo.link
2479 c631b115 2020-07-23 stsp M epsilon/beta.link
2480 c631b115 2020-07-23 stsp M epsilon.link
2481 c631b115 2020-07-23 stsp D nonexistent.link
2482 c631b115 2020-07-23 stsp A zeta.link
2484 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2486 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2487 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2488 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2492 0aeb8099 2020-07-23 stsp rm $testroot/wt/alpha.link
2493 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2495 c631b115 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2497 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2498 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
2499 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2500 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2501 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2502 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2503 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2504 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2505 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2506 c631b115 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2507 c631b115 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2508 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2509 c631b115 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2510 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2511 c631b115 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2512 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2513 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2514 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2515 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotbar.link) | cut -d' ' -f 1 \
2516 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2517 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2518 c631b115 2020-07-23 stsp echo '+++ dotgotbar.link' >> $testroot/stdout.expected
2519 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2520 c631b115 2020-07-23 stsp echo '+.got/bar' >> $testroot/stdout.expected
2521 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2522 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2523 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2524 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2525 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2526 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2527 c631b115 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2528 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2529 c631b115 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2530 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2531 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i epsilon | grep 'beta.link@ -> ../beta$' | \
2532 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2533 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2534 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon/beta.link) | cut -d' ' -f 1 \
2535 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2536 c631b115 2020-07-23 stsp echo '--- epsilon/beta.link' >> $testroot/stdout.expected
2537 c631b115 2020-07-23 stsp echo '+++ epsilon/beta.link' >> $testroot/stdout.expected
2538 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2539 c631b115 2020-07-23 stsp echo '-../beta' >> $testroot/stdout.expected
2540 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2541 c631b115 2020-07-23 stsp echo '+../gamma/delta' >> $testroot/stdout.expected
2542 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2543 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2544 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2545 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2546 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2547 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2548 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2549 c631b115 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2550 c631b115 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2551 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2552 c631b115 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2553 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2554 c631b115 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2555 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2556 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2557 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2558 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2559 c631b115 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2560 c631b115 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2561 c631b115 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2562 c631b115 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2563 c631b115 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2564 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2565 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2566 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2567 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2568 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2569 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2570 c631b115 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2571 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2572 c631b115 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2573 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2575 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2577 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2578 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2579 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2583 c631b115 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2584 c631b115 2020-07-23 stsp > $testroot/stdout)
2586 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2587 c631b115 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2588 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2592 c631b115 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2593 c631b115 2020-07-23 stsp echo "A dotgotbar.link" > $testroot/stdout.expected
2594 c631b115 2020-07-23 stsp echo "A dotgotfoo.link" >> $testroot/stdout.expected
2595 c631b115 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2596 c631b115 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2597 c631b115 2020-07-23 stsp echo "M epsilon/beta.link" >> $testroot/stdout.expected
2598 c631b115 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2599 c631b115 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2600 c631b115 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2601 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2603 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2604 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2605 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2609 c631b115 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2611 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2612 c631b115 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2613 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2617 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2619 c631b115 2020-07-23 stsp alpha.link@ -> beta
2621 c631b115 2020-07-23 stsp dotgotbar.link@ -> .got/bar
2622 c631b115 2020-07-23 stsp dotgotfoo.link
2624 c631b115 2020-07-23 stsp epsilon.link@ -> gamma
2626 c631b115 2020-07-23 stsp passwd.link@ -> /etc/passwd
2627 c631b115 2020-07-23 stsp zeta.link@ -> gamma/delta
2629 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2631 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2632 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2636 0aeb8099 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2637 0aeb8099 2020-07-23 stsp echo "alpha.link is a symlink"
2638 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2642 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2643 0aeb8099 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2644 0aeb8099 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2646 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2647 0aeb8099 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2648 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2652 75f0a0fb 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2653 75f0a0fb 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2654 75f0a0fb 2020-07-23 stsp test_done "$testroot" "1"
2657 75f0a0fb 2020-07-23 stsp (cd $testroot/wt && got update > /dev/null)
2658 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2659 c631b115 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2660 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2663 0aeb8099 2020-07-23 stsp echo -n ".got/bar" > $testroot/content.expected
2664 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2665 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2667 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2668 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2669 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2673 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2674 c631b115 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2675 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2678 c631b115 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2679 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2680 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2682 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2683 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2684 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2688 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2689 c631b115 2020-07-23 stsp echo "epsilon.link is not a symlink"
2690 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2694 c631b115 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2695 c631b115 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
2696 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2698 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2699 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2700 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2704 c631b115 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2705 c631b115 2020-07-23 stsp echo "passwd.link is a symlink"
2706 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2709 c631b115 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2710 c631b115 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2711 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2713 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2714 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2715 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2719 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
2720 c631b115 2020-07-23 stsp echo "zeta.link is not a symlink"
2721 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2725 c631b115 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
2726 c631b115 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
2727 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2729 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2730 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2731 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2735 c631b115 2020-07-23 stsp test_done "$testroot" "0"
2738 f6cae3ed 2020-09-13 naddy test_stage_patch_symlink() {
2739 fa3cef63 2020-07-23 stsp local testroot=`test_init stage_patch_symlink`
2741 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2742 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2743 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2744 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2745 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2746 fa3cef63 2020-07-23 stsp (cd $testroot/repo && git add .)
2747 fa3cef63 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2748 fa3cef63 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2750 fa3cef63 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2752 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2753 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2757 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2758 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sfh gamma epsilon.link)
2759 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2760 fa3cef63 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2761 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2762 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2763 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2764 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2765 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2766 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2768 fa3cef63 2020-07-23 stsp printf "y\nn\ny\nn\ny\ny\ny" > $testroot/patchscript
2769 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2770 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2772 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2773 fa3cef63 2020-07-23 stsp -----------------------------------------------
2774 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2776 fa3cef63 2020-07-23 stsp \ No newline at end of file
2778 fa3cef63 2020-07-23 stsp \ No newline at end of file
2779 fa3cef63 2020-07-23 stsp -----------------------------------------------
2780 fa3cef63 2020-07-23 stsp M alpha.link (change 1 of 1)
2781 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2782 fa3cef63 2020-07-23 stsp A dotgotbar.link
2783 fa3cef63 2020-07-23 stsp stage this addition? [y/n] n
2784 fa3cef63 2020-07-23 stsp A dotgotfoo.link
2785 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2786 fa3cef63 2020-07-23 stsp -----------------------------------------------
2787 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2789 fa3cef63 2020-07-23 stsp \ No newline at end of file
2790 fa3cef63 2020-07-23 stsp +../gamma/delta
2791 fa3cef63 2020-07-23 stsp \ No newline at end of file
2792 fa3cef63 2020-07-23 stsp -----------------------------------------------
2793 fa3cef63 2020-07-23 stsp M epsilon/beta.link (change 1 of 1)
2794 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] n
2795 fa3cef63 2020-07-23 stsp -----------------------------------------------
2796 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2798 fa3cef63 2020-07-23 stsp \ No newline at end of file
2800 fa3cef63 2020-07-23 stsp \ No newline at end of file
2801 fa3cef63 2020-07-23 stsp -----------------------------------------------
2802 fa3cef63 2020-07-23 stsp M epsilon.link (change 1 of 1)
2803 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2804 fa3cef63 2020-07-23 stsp D nonexistent.link
2805 fa3cef63 2020-07-23 stsp stage this deletion? [y/n] y
2806 fa3cef63 2020-07-23 stsp A zeta.link
2807 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2809 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2811 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2812 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2813 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2817 fa3cef63 2020-07-23 stsp rm $testroot/wt/alpha.link
2818 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2820 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2822 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2823 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
2824 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2825 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2826 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2827 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2828 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2829 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2830 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2831 fa3cef63 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2832 fa3cef63 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2833 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2834 fa3cef63 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2835 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2836 fa3cef63 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2837 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2838 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2839 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2840 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2841 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2842 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2843 fa3cef63 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2844 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2845 fa3cef63 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2846 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2847 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2848 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2849 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2850 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2851 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2852 fa3cef63 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2853 fa3cef63 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2854 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2855 fa3cef63 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2856 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2857 fa3cef63 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2858 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2859 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2860 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2861 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2862 fa3cef63 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2863 fa3cef63 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2864 fa3cef63 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2865 fa3cef63 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2866 fa3cef63 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2867 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2868 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2869 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2870 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2871 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2872 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2873 fa3cef63 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2874 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2875 fa3cef63 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2876 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2878 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2880 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2881 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2882 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2886 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2887 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2889 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2890 fa3cef63 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2891 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2895 fa3cef63 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2896 fa3cef63 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2897 fa3cef63 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2898 fa3cef63 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2899 fa3cef63 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2900 fa3cef63 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2901 fa3cef63 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2902 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2904 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2905 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2906 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2910 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2912 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2913 fa3cef63 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2914 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2918 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2920 fa3cef63 2020-07-23 stsp alpha.link@ -> beta
2922 fa3cef63 2020-07-23 stsp dotgotfoo.link
2924 fa3cef63 2020-07-23 stsp epsilon.link@ -> gamma
2926 fa3cef63 2020-07-23 stsp passwd.link@ -> /etc/passwd
2927 fa3cef63 2020-07-23 stsp zeta.link@ -> gamma/delta
2929 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2931 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2932 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2936 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2937 fa3cef63 2020-07-23 stsp echo "alpha.link is a symlink"
2938 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2942 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2943 fa3cef63 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2944 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2946 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2947 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2948 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2952 fa3cef63 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2953 fa3cef63 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2954 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2957 fa3cef63 2020-07-23 stsp readlink $testroot/wt/dotgotbar.link > $testroot/stdout
2958 fa3cef63 2020-07-23 stsp echo ".got/bar" > $testroot/stdout.expected
2959 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2961 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2962 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2963 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2967 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2968 fa3cef63 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2969 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2972 fa3cef63 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2973 fa3cef63 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2974 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2976 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2977 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2978 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2982 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2983 fa3cef63 2020-07-23 stsp echo "epsilon.link is not a symlink"
2984 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2988 fa3cef63 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2989 fa3cef63 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
2990 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2992 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2993 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2994 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2998 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2999 fa3cef63 2020-07-23 stsp echo "passwd.link is a symlink"
3000 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
3003 fa3cef63 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
3004 fa3cef63 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
3005 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
3007 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3008 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
3009 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
3013 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
3014 fa3cef63 2020-07-23 stsp echo "zeta.link is not a symlink"
3015 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
3019 fa3cef63 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
3020 fa3cef63 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
3021 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3023 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3024 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3025 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
3029 fa3cef63 2020-07-23 stsp test_done "$testroot" "0"
3032 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3033 fccbfb98 2019-08-03 stsp run_test test_stage_basic
3034 31b20a6e 2019-08-06 stsp run_test test_stage_no_changes
3035 8b13ce36 2019-08-08 stsp run_test test_stage_unversioned
3036 8564cb21 2019-08-08 stsp run_test test_stage_nonexistent
3037 a4f692bb 2019-08-04 stsp run_test test_stage_list
3038 ebf48fd5 2019-08-03 stsp run_test test_stage_conflict
3039 735ef5ac 2019-08-03 stsp run_test test_stage_out_of_date
3040 d3e7c587 2019-08-03 stsp run_test test_double_stage
3041 c363b2c1 2019-08-03 stsp run_test test_stage_status
3042 1e1446d3 2019-08-03 stsp run_test test_stage_add_already_staged_file
3043 9acbc4fa 2019-08-03 stsp run_test test_stage_rm_already_staged_file
3044 24278f30 2019-08-03 stsp run_test test_stage_revert
3045 408b4ebc 2019-08-03 stsp run_test test_stage_diff
3046 b9622844 2019-08-03 stsp run_test test_stage_histedit
3047 243d7cf1 2019-08-03 stsp run_test test_stage_rebase
3048 a76c42e6 2019-08-03 stsp run_test test_stage_update
3049 f0b75401 2019-08-03 stsp run_test test_stage_commit_non_staged
3050 0f1cfa7f 2019-08-08 stsp run_test test_stage_commit_out_of_date
3051 5f8a88c6 2019-08-03 stsp run_test test_stage_commit
3052 dc424a06 2019-08-07 stsp run_test test_stage_patch
3053 af5a81b2 2019-08-08 stsp run_test test_stage_patch_twice
3054 dc424a06 2019-08-07 stsp run_test test_stage_patch_added
3055 e70a841e 2019-08-08 stsp run_test test_stage_patch_added_twice
3056 dc424a06 2019-08-07 stsp run_test test_stage_patch_removed
3057 e70a841e 2019-08-08 stsp run_test test_stage_patch_removed_twice
3058 9fdde394 2022-06-04 op run_test test_stage_patch_reversed
3059 b353a198 2019-08-07 stsp run_test test_stage_patch_quit
3060 eba70f38 2019-08-08 stsp run_test test_stage_patch_incomplete_script
3061 c631b115 2020-07-23 stsp run_test test_stage_symlink
3062 fa3cef63 2020-07-23 stsp run_test test_stage_patch_symlink