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 f6cae3ed 2020-09-13 naddy test_stage_basic() {
20 fccbfb98 2019-08-03 stsp local testroot=`test_init stage_basic`
22 fccbfb98 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
25 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
29 fccbfb98 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
30 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
31 fccbfb98 2019-08-03 stsp echo "new file" > $testroot/wt/foo
32 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
34 88d0e355 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
35 88d0e355 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
36 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
37 ec9d9b2f 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
39 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
41 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
42 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
44 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
47 f6cae3ed 2020-09-13 naddy test_stage_no_changes() {
48 31b20a6e 2019-08-06 stsp local testroot=`test_init stage_no_changes`
50 31b20a6e 2019-08-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
52 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
53 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
57 31b20a6e 2019-08-06 stsp (cd $testroot/wt && got stage alpha beta > $testroot/stdout \
58 31b20a6e 2019-08-06 stsp 2> $testroot/stderr)
60 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
61 31b20a6e 2019-08-06 stsp echo "got stage command succeeded unexpectedly" >&2
62 31b20a6e 2019-08-06 stsp test_done "$testroot" "1"
66 2db2652d 2019-08-07 stsp echo "got: no changes to stage" > $testroot/stderr.expected
68 31b20a6e 2019-08-06 stsp cmp -s $testroot/stderr.expected $testroot/stderr
70 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
71 31b20a6e 2019-08-06 stsp diff -u $testroot/stderr.expected $testroot/stderr
72 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
76 31b20a6e 2019-08-06 stsp echo -n > $testroot/stdout.expected
77 31b20a6e 2019-08-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
79 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
80 31b20a6e 2019-08-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
82 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
85 f6cae3ed 2020-09-13 naddy test_stage_unversioned() {
86 8b13ce36 2019-08-08 stsp local testroot=`test_init stage_unversioned`
88 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
90 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
91 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
95 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
96 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
98 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
99 8b13ce36 2019-08-08 stsp echo "M alpha" > $testroot/stdout.expected
100 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
101 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
103 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
104 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
105 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
109 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
111 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
112 8b13ce36 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
113 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
117 8b13ce36 2019-08-08 stsp echo " M alpha" > $testroot/stdout.expected
118 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
120 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
121 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
122 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
126 8b13ce36 2019-08-08 stsp echo "modified file again" > $testroot/wt/alpha
128 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage unversioned-file > $testroot/stdout \
129 8b13ce36 2019-08-08 stsp 2> $testroot/stderr)
131 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
132 8b13ce36 2019-08-08 stsp echo "got stage command succeed unexpectedly" >&2
133 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
137 8b13ce36 2019-08-08 stsp echo "got: no changes to stage" > $testroot/stderr.expected
138 8b13ce36 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
140 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
141 8b13ce36 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
143 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
147 f6cae3ed 2020-09-13 naddy test_stage_nonexistent() {
148 8564cb21 2019-08-08 stsp local testroot=`test_init stage_nonexistent`
150 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
152 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
153 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
157 8564cb21 2019-08-08 stsp (cd $testroot/wt && got stage nonexistent-file \
158 8564cb21 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
159 2a06fe5f 2019-08-24 stsp echo "got: nonexistent-file: No such file or directory" \
160 2a06fe5f 2019-08-24 stsp > $testroot/stderr.expected
161 8564cb21 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
163 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
164 8564cb21 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
166 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
169 f6cae3ed 2020-09-13 naddy test_stage_list() {
170 a4f692bb 2019-08-04 stsp local testroot=`test_init stage_list`
172 a4f692bb 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
174 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
175 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
179 a4f692bb 2019-08-04 stsp echo "modified file" > $testroot/wt/alpha
180 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got rm beta > /dev/null)
181 a4f692bb 2019-08-04 stsp echo "new file" > $testroot/wt/foo
182 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got add foo > /dev/null)
184 a4f692bb 2019-08-04 stsp echo ' M alpha' > $testroot/stdout.expected
185 a4f692bb 2019-08-04 stsp echo ' D beta' >> $testroot/stdout.expected
186 a4f692bb 2019-08-04 stsp echo ' A foo' >> $testroot/stdout.expected
187 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
189 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l > $testroot/stdout)
190 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
191 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
192 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
193 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s beta | grep '^blob -' | \
194 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
195 a4f692bb 2019-08-04 stsp echo " D beta" >> $testroot/stdout.expected
196 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s foo | grep '^blob +' | \
197 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
198 a4f692bb 2019-08-04 stsp echo " A foo" >> $testroot/stdout.expected
199 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
201 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
202 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
203 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
207 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l epsilon nonexistent \
208 a4f692bb 2019-08-04 stsp > $testroot/stdout)
210 a4f692bb 2019-08-04 stsp echo -n > $testroot/stdout.expected
211 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
213 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
214 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
215 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
219 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l alpha > $testroot/stdout)
221 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
222 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
223 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
224 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
226 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
227 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
229 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
233 f6cae3ed 2020-09-13 naddy test_stage_conflict() {
234 ebf48fd5 2019-08-03 stsp local testroot=`test_init stage_conflict`
235 ebf48fd5 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
237 ebf48fd5 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
239 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
240 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
244 ebf48fd5 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
245 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
247 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
249 ebf48fd5 2019-08-03 stsp echo "modified alpha, too" > $testroot/wt/alpha
251 ebf48fd5 2019-08-03 stsp echo "C alpha" > $testroot/stdout.expected
252 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
253 ebf48fd5 2019-08-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
254 ebf48fd5 2019-08-03 stsp echo >> $testroot/stdout.expected
255 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
257 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout)
259 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
261 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
262 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
263 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
267 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
268 ebf48fd5 2019-08-03 stsp 2> $testroot/stderr)
270 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
271 ebf48fd5 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
272 ebf48fd5 2019-08-03 stsp test_done "$testroot" "1"
276 ebf48fd5 2019-08-03 stsp echo -n > $testroot/stdout.expected
277 ebf48fd5 2019-08-03 stsp echo "got: alpha: cannot stage file in conflicted status" \
278 735ef5ac 2019-08-03 stsp > $testroot/stderr.expected
280 735ef5ac 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
282 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
283 735ef5ac 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
284 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
287 735ef5ac 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
289 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
290 735ef5ac 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
292 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
295 f6cae3ed 2020-09-13 naddy test_stage_out_of_date() {
296 735ef5ac 2019-08-03 stsp local testroot=`test_init stage_out_of_date`
297 735ef5ac 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
299 735ef5ac 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
301 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
302 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
306 735ef5ac 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
307 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
309 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
311 735ef5ac 2019-08-03 stsp echo "modified alpha again" > $testroot/wt/alpha
312 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
313 735ef5ac 2019-08-03 stsp 2> $testroot/stderr)
315 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
316 735ef5ac 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
317 735ef5ac 2019-08-03 stsp test_done "$testroot" "1"
321 735ef5ac 2019-08-03 stsp echo -n > $testroot/stdout.expected
322 735ef5ac 2019-08-03 stsp echo "got: work tree must be updated before changes can be staged" \
323 ebf48fd5 2019-08-03 stsp > $testroot/stderr.expected
325 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
327 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
328 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
329 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
332 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
334 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
335 ebf48fd5 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
337 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
341 f6cae3ed 2020-09-13 naddy test_double_stage() {
342 d3e7c587 2019-08-03 stsp local testroot=`test_init double_stage`
344 d3e7c587 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
346 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
347 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
350 d3e7c587 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
351 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
352 d3e7c587 2019-08-03 stsp echo "new file" > $testroot/wt/foo
353 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
354 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
356 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
357 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha 2> $testroot/stderr)
358 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
360 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
361 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
362 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
366 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage beta \
367 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
369 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
370 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
371 7b5dc508 2019-10-28 stsp test_done "$testroot" "1"
374 7b5dc508 2019-10-28 stsp echo -n > $testroot/stdout.expected
375 7b5dc508 2019-10-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
377 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
378 7b5dc508 2019-10-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
379 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
383 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
384 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
385 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
387 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
388 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
389 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
393 7b5dc508 2019-10-28 stsp printf "q\n" > $testroot/patchscript
394 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
395 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
397 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
398 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
399 d3e7c587 2019-08-03 stsp test_done "$testroot" "1"
402 d3e7c587 2019-08-03 stsp echo -n > $testroot/stdout.expected
403 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
405 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
406 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
407 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
411 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
412 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
413 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
415 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
416 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
417 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
421 d3e7c587 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
422 d3e7c587 2019-08-03 stsp echo "modified new file" > $testroot/wt/foo
424 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
425 88d0e355 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
426 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
427 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
429 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
430 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
431 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
435 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
436 d3e7c587 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
437 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
439 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
440 fccbfb98 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
442 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
443 fccbfb98 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
445 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
448 f6cae3ed 2020-09-13 naddy test_stage_status() {
449 c363b2c1 2019-08-03 stsp local testroot=`test_init stage_status`
451 c363b2c1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
453 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
454 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
458 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
459 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
460 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/foo
461 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
462 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/epsilon/new
463 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
464 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/epsilon/zeta
465 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm gamma/delta > /dev/null)
467 c363b2c1 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
468 c363b2c1 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
469 c363b2c1 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
470 c363b2c1 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
471 c363b2c1 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
472 c363b2c1 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
473 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
475 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
476 c363b2c1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
478 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
479 c363b2c1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
480 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
484 244725f2 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
485 244725f2 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
487 244725f2 2019-08-03 stsp echo 'MM alpha' > $testroot/stdout.expected
488 244725f2 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
489 244725f2 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
490 244725f2 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
491 244725f2 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
492 244725f2 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
494 244725f2 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
495 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
497 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
498 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
499 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
503 244725f2 2019-08-03 stsp # test no-op change of added file with new stat(2) timestamp
504 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/foo
505 244725f2 2019-08-03 stsp echo ' A foo' > $testroot/stdout.expected
506 244725f2 2019-08-03 stsp (cd $testroot/wt && got status foo > $testroot/stdout)
507 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
509 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
510 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
511 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
515 244725f2 2019-08-03 stsp # test staged deleted file which is restored on disk
516 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/beta
517 244725f2 2019-08-03 stsp echo ' D beta' > $testroot/stdout.expected
518 244725f2 2019-08-03 stsp (cd $testroot/wt && got status beta > $testroot/stdout)
519 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
521 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
522 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
524 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
528 f6cae3ed 2020-09-13 naddy test_stage_add_already_staged_file() {
529 1e1446d3 2019-08-03 stsp local testroot=`test_init stage_add_already_staged_file`
531 1e1446d3 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
533 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
534 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
538 1e1446d3 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
539 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
540 1e1446d3 2019-08-03 stsp echo "new file" > $testroot/wt/foo
541 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
543 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
545 1e1446d3 2019-08-03 stsp echo -n > $testroot/stdout.expected
546 6d022e97 2019-08-04 stsp for f in alpha beta foo; do
547 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add $f \
548 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
549 6d022e97 2019-08-04 stsp echo "got: $f: file has unexpected status" \
550 6d022e97 2019-08-04 stsp > $testroot/stderr.expected
551 6d022e97 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
553 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
554 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
555 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
558 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
560 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
561 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
562 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
567 1e1446d3 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
568 1e1446d3 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
569 1e1446d3 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
571 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
572 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
574 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
575 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
577 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
580 f6cae3ed 2020-09-13 naddy test_stage_rm_already_staged_file() {
581 9acbc4fa 2019-08-03 stsp local testroot=`test_init stage_rm_already_staged_file`
583 9acbc4fa 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
585 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
586 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
590 9acbc4fa 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
591 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
592 9acbc4fa 2019-08-03 stsp echo "new file" > $testroot/wt/foo
593 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
595 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
597 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta \
598 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
600 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
601 6d022e97 2019-08-04 stsp echo "got rm command failed unexpectedly" >&2
602 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
605 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
606 6d022e97 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
608 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
609 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
610 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
613 6d022e97 2019-08-04 stsp echo -n > $testroot/stderr.expected
614 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
616 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
617 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
618 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
622 9acbc4fa 2019-08-03 stsp for f in alpha foo; do
623 24278f30 2019-08-03 stsp echo "got: $f: file is staged" > $testroot/stderr.expected
624 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm $f \
625 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
627 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
628 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
629 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
632 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
634 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
635 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
636 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
641 9acbc4fa 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
642 9acbc4fa 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
643 9acbc4fa 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
645 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
646 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
648 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
649 9acbc4fa 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
651 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
654 f6cae3ed 2020-09-13 naddy test_stage_revert() {
655 24278f30 2019-08-03 stsp local testroot=`test_init stage_revert`
657 24278f30 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
659 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
660 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
664 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
665 24278f30 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
666 24278f30 2019-08-03 stsp echo "new file" > $testroot/wt/foo
667 24278f30 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
668 24278f30 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
670 24278f30 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
671 24278f30 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
673 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
675 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
676 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
677 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
681 24278f30 2019-08-03 stsp echo "R alpha" > $testroot/stdout.expected
682 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
684 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
685 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
686 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
690 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
691 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
692 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
694 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
695 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
696 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
700 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
701 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
702 24278f30 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
703 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
704 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
706 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
707 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
708 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
712 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
714 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
715 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
716 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
720 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
721 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
723 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
724 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
725 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
729 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
730 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
731 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
733 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
734 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
735 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
739 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert beta > $testroot/stdout \
740 24278f30 2019-08-03 stsp 2> $testroot/stderr)
742 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
743 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
744 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
748 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stdout.expected
749 d3bcc3d1 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
751 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
752 d3bcc3d1 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
753 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
757 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
758 24278f30 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
760 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
761 24278f30 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
762 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
766 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
768 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
769 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
770 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
774 24278f30 2019-08-03 stsp echo "R foo" > $testroot/stdout.expected
775 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
777 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
778 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
779 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
783 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
784 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
785 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
787 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
788 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
789 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
793 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
794 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
795 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
796 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
797 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
799 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
800 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
801 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
805 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
807 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
808 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
809 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
813 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
814 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
816 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
817 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
818 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
822 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
823 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
824 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
826 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
827 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
828 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
832 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
833 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
834 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
835 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
836 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
838 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
839 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
840 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
844 0f6d7415 2019-08-08 stsp echo "modified file again" >> $testroot/wt/alpha
845 0f6d7415 2019-08-08 stsp echo "modified added file again" >> $testroot/wt/foo
847 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout \
848 0f6d7415 2019-08-08 stsp 2> $testroot/stderr)
850 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
851 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
852 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
856 0f6d7415 2019-08-08 stsp echo "R alpha" > $testroot/stdout.expected
857 d3bcc3d1 2019-08-08 stsp echo "R foo" >> $testroot/stdout.expected
858 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
860 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
861 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
862 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
866 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
867 0f6d7415 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
869 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
870 0f6d7415 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
871 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
875 0f6d7415 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
876 0f6d7415 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
877 d3bcc3d1 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
878 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
879 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
881 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
882 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
884 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
887 f6cae3ed 2020-09-13 naddy test_stage_diff() {
888 408b4ebc 2019-08-03 stsp local testroot=`test_init stage_diff`
889 408b4ebc 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
891 408b4ebc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
893 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
894 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
898 408b4ebc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
899 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
900 408b4ebc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
901 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
903 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
904 98eaaa12 2019-08-03 stsp echo -n > $testroot/stdout.expected
905 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
907 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
908 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
909 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
913 408b4ebc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
914 408b4ebc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
915 408b4ebc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
916 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
918 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
919 408b4ebc 2019-08-03 stsp echo -n > $testroot/stdout.expected
920 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
922 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
923 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
924 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
928 408b4ebc 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
929 408b4ebc 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
931 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
933 408b4ebc 2019-08-03 stsp echo "diff $head_commit $testroot/wt" > $testroot/stdout.expected
934 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
935 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 | tr -d '\n' \
936 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
937 4ce46740 2019-08-08 stsp echo ' (staged)' >> $testroot/stdout.expected
938 408b4ebc 2019-08-03 stsp echo 'file + alpha' >> $testroot/stdout.expected
939 408b4ebc 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
940 408b4ebc 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
941 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
942 408b4ebc 2019-08-03 stsp echo '-modified file' >> $testroot/stdout.expected
943 408b4ebc 2019-08-03 stsp echo '+modified file again' >> $testroot/stdout.expected
944 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
945 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 | tr -d '\n' \
946 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
947 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
948 408b4ebc 2019-08-03 stsp echo 'file + foo' >> $testroot/stdout.expected
949 408b4ebc 2019-08-03 stsp echo '--- foo' >> $testroot/stdout.expected
950 408b4ebc 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
951 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
952 408b4ebc 2019-08-03 stsp echo '-new file' >> $testroot/stdout.expected
953 408b4ebc 2019-08-03 stsp echo '+new file changed' >> $testroot/stdout.expected
955 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
957 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
958 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
959 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
963 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
965 98eaaa12 2019-08-03 stsp echo "diff $head_commit $testroot/wt (staged changes)" \
966 98eaaa12 2019-08-03 stsp > $testroot/stdout.expected
967 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
968 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
969 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
970 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
971 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
972 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
973 98eaaa12 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
974 98eaaa12 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
975 98eaaa12 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
976 98eaaa12 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
977 98eaaa12 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
978 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
979 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
980 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
981 98eaaa12 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
982 98eaaa12 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
983 98eaaa12 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
984 98eaaa12 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
985 98eaaa12 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
986 98eaaa12 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
987 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
988 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
989 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
990 98eaaa12 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
991 98eaaa12 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
992 98eaaa12 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
993 98eaaa12 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
995 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
997 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
998 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1000 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
1004 f6cae3ed 2020-09-13 naddy test_stage_histedit() {
1005 b9622844 2019-08-03 stsp local testroot=`test_init stage_histedit`
1006 b9622844 2019-08-03 stsp local orig_commit=`git_show_head $testroot/repo`
1008 b9622844 2019-08-03 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1010 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1011 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1015 b9622844 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1016 b9622844 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1018 b9622844 2019-08-03 stsp echo "modified alpha on master" > $testroot/repo/alpha
1019 b9622844 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1020 b9622844 2019-08-03 stsp echo "new file on master" > $testroot/repo/epsilon/new
1021 b9622844 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1022 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing changes"
1023 b9622844 2019-08-03 stsp local old_commit1=`git_show_head $testroot/repo`
1025 b9622844 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1026 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1027 b9622844 2019-08-03 stsp local old_commit2=`git_show_head $testroot/repo`
1029 b9622844 2019-08-03 stsp echo "pick $old_commit1" > $testroot/histedit-script
1030 b9622844 2019-08-03 stsp echo "pick $old_commit2" >> $testroot/histedit-script
1032 b9622844 2019-08-03 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1033 b9622844 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1035 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1036 b9622844 2019-08-03 stsp echo "got histedit command succeeded unexpectedly" >&2
1037 b9622844 2019-08-03 stsp test_done "$testroot" "1"
1041 b9622844 2019-08-03 stsp echo -n > $testroot/stdout.expected
1042 b9622844 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1044 b9622844 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1046 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1047 b9622844 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1048 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1051 b9622844 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1053 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1054 b9622844 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1056 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1060 f6cae3ed 2020-09-13 naddy test_stage_rebase() {
1061 243d7cf1 2019-08-03 stsp local testroot=`test_init stage_rebase`
1063 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1064 243d7cf1 2019-08-03 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
1065 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
1067 243d7cf1 2019-08-03 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1068 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1069 243d7cf1 2019-08-03 stsp echo "new file on branch" > $testroot/repo/epsilon/new
1070 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1071 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
1073 243d7cf1 2019-08-03 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
1074 243d7cf1 2019-08-03 stsp local orig_commit2=`git_show_head $testroot/repo`
1076 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q master)
1077 243d7cf1 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1078 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1079 243d7cf1 2019-08-03 stsp local master_commit=`git_show_head $testroot/repo`
1081 243d7cf1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1083 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1084 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1088 243d7cf1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1089 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1091 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got rebase newbranch \
1092 243d7cf1 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1094 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1095 243d7cf1 2019-08-03 stsp echo "got rebase command succeeded unexpectedly" >&2
1096 243d7cf1 2019-08-03 stsp test_done "$testroot" "1"
1100 243d7cf1 2019-08-03 stsp echo -n > $testroot/stdout.expected
1101 243d7cf1 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1103 243d7cf1 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1105 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1106 243d7cf1 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1107 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1110 243d7cf1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1112 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1113 243d7cf1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1115 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1118 f6cae3ed 2020-09-13 naddy test_stage_update() {
1119 a76c42e6 2019-08-03 stsp local testroot=`test_init stage_update`
1121 a76c42e6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1123 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1124 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1128 a76c42e6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1129 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1131 a76c42e6 2019-08-03 stsp echo "modified alpha" > $testroot/repo/alpha
1132 a76c42e6 2019-08-03 stsp git_commit $testroot/repo -m "modified alpha"
1134 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout \
1135 a76c42e6 2019-08-03 stsp 2> $testroot/stderr)
1137 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1138 a76c42e6 2019-08-03 stsp echo "got update command succeeded unexpectedly" >&2
1139 a76c42e6 2019-08-03 stsp test_done "$testroot" "1"
1143 a76c42e6 2019-08-03 stsp echo -n > $testroot/stdout.expected
1144 a76c42e6 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1146 a76c42e6 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1148 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1149 a76c42e6 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1150 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1153 a76c42e6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1155 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1156 a76c42e6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1158 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1161 f6cae3ed 2020-09-13 naddy test_stage_commit_non_staged() {
1162 f0b75401 2019-08-03 stsp local testroot=`test_init stage_commit_non_staged`
1164 f0b75401 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1166 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1167 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1171 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1172 f0b75401 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1173 f0b75401 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1174 f0b75401 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1175 f0b75401 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1177 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/gamma/delta
1178 f0b75401 2019-08-03 stsp (cd $testroot/wt && got commit -m "change delta" gamma/delta \
1179 f0b75401 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1181 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1182 f0b75401 2019-08-03 stsp echo "got commit command succeeded unexpectedly" >&2
1183 f0b75401 2019-08-03 stsp test_done "$testroot" "1"
1187 f0b75401 2019-08-03 stsp echo -n > $testroot/stdout.expected
1188 f0b75401 2019-08-03 stsp echo "got: gamma/delta: file is not staged" > $testroot/stderr.expected
1190 f0b75401 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1192 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1193 f0b75401 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1194 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1197 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1199 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1200 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1202 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1205 f6cae3ed 2020-09-13 naddy test_stage_commit_out_of_date() {
1206 0f1cfa7f 2019-08-08 stsp local testroot=`test_init stage_commit_out_of_date`
1208 0f1cfa7f 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1210 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1211 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1215 0f1cfa7f 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
1216 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
1217 0f1cfa7f 2019-08-08 stsp echo "new file" > $testroot/wt/foo
1218 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
1219 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1221 0f1cfa7f 2019-08-08 stsp echo "changed file" > $testroot/repo/alpha
1222 0f1cfa7f 2019-08-08 stsp git_commit $testroot/repo -m "changed alpha in repo"
1224 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try to commit" > $testroot/stdout \
1225 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1227 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1228 0f1cfa7f 2019-08-08 stsp echo "got commit command succeeded unexpectedly" >&2
1229 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "1"
1233 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1234 0f1cfa7f 2019-08-08 stsp echo -n "got: work tree must be updated before these changes " \
1235 0f1cfa7f 2019-08-08 stsp > $testroot/stderr.expected
1236 0f1cfa7f 2019-08-08 stsp echo "can be committed" >> $testroot/stderr.expected
1238 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1240 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1241 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1242 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1245 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1247 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1248 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1249 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1253 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout \
1254 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1255 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1256 0f1cfa7f 2019-08-08 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1258 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1260 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1261 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1262 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1265 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1267 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1268 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1269 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1273 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got unstage > /dev/null)
1274 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
1276 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1277 0f1cfa7f 2019-08-08 stsp echo "got update command failed unexpectedly" >&2
1278 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1282 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1283 0f1cfa7f 2019-08-08 stsp echo "C alpha" > $testroot/stdout.expected
1284 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1285 0f1cfa7f 2019-08-08 stsp echo "A foo" >> $testroot/stdout.expected
1286 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1288 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1289 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1290 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1294 0f1cfa7f 2019-08-08 stsp # resolve conflict
1295 0f1cfa7f 2019-08-08 stsp echo "resolved file" > $testroot/wt/alpha
1297 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
1299 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try again" > $testroot/stdout)
1301 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1302 0f1cfa7f 2019-08-08 stsp echo "got commit command failed unexpectedly" >&2
1303 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1307 0f1cfa7f 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1308 0f1cfa7f 2019-08-08 stsp echo "A foo" > $testroot/stdout.expected
1309 0f1cfa7f 2019-08-08 stsp echo "M alpha" >> $testroot/stdout.expected
1310 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1311 0f1cfa7f 2019-08-08 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1312 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1314 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1315 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1317 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1321 f6cae3ed 2020-09-13 naddy test_stage_commit() {
1322 5f8a88c6 2019-08-03 stsp local testroot=`test_init stage_commit`
1323 5f8a88c6 2019-08-03 stsp local first_commit=`git_show_head $testroot/repo`
1325 5f8a88c6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1327 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1328 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1332 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1333 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1334 5f8a88c6 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1335 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1336 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1337 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1339 5f8a88c6 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
1340 5f8a88c6 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
1341 5f8a88c6 2019-08-03 stsp echo "non-staged change" > $testroot/wt/gamma/delta
1342 5f8a88c6 2019-08-03 stsp echo "non-staged new file" > $testroot/wt/epsilon/new
1343 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1344 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm epsilon/zeta > /dev/null)
1346 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
1347 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_alpha
1348 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
1349 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_foo
1351 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got commit -m "staged changes" \
1352 5f8a88c6 2019-08-03 stsp > $testroot/stdout)
1354 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1355 5f8a88c6 2019-08-03 stsp echo "got commit command failed unexpectedly" >&2
1356 5f8a88c6 2019-08-03 stsp test_done "$testroot" "1"
1360 5f8a88c6 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
1361 5f8a88c6 2019-08-03 stsp echo "A foo" > $testroot/stdout.expected
1362 5f8a88c6 2019-08-03 stsp echo "M alpha" >> $testroot/stdout.expected
1363 5f8a88c6 2019-08-03 stsp echo "D beta" >> $testroot/stdout.expected
1364 5f8a88c6 2019-08-03 stsp echo "Created commit $head_commit" >> $testroot/stdout.expected
1366 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1368 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1369 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1370 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1374 5f8a88c6 2019-08-03 stsp got diff -r $testroot/repo $first_commit $head_commit \
1375 5f8a88c6 2019-08-03 stsp > $testroot/stdout
1377 5f8a88c6 2019-08-03 stsp echo "diff $first_commit $head_commit" \
1378 5f8a88c6 2019-08-03 stsp > $testroot/stdout.expected
1379 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1380 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit | \
1381 5f8a88c6 2019-08-03 stsp grep 'alpha$' | cut -d' ' -f 1 \
1382 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1383 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1384 5f8a88c6 2019-08-03 stsp cat $testroot/blob_id_alpha >> $testroot/stdout.expected
1385 5f8a88c6 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
1386 5f8a88c6 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
1387 5f8a88c6 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1388 5f8a88c6 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
1389 5f8a88c6 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
1390 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1391 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit \
1392 46f68b20 2019-10-19 stsp | grep 'beta$' | cut -d' ' -f 1 | tr -d '\n' \
1393 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1394 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1395 5f8a88c6 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1396 5f8a88c6 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
1397 5f8a88c6 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1398 5f8a88c6 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1399 5f8a88c6 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
1400 5f8a88c6 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1401 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1402 46f68b20 2019-10-19 stsp cat $testroot/blob_id_foo | tr -d '\n' >> $testroot/stdout.expected
1403 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1404 5f8a88c6 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
1405 5f8a88c6 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
1406 5f8a88c6 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1407 5f8a88c6 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1409 f0b75401 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1411 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1412 f0b75401 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1413 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1417 72fd46fa 2019-09-06 stsp echo 'M alpha' > $testroot/stdout.expected
1418 72fd46fa 2019-09-06 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
1419 5f8a88c6 2019-08-03 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
1420 72fd46fa 2019-09-06 stsp echo 'M foo' >> $testroot/stdout.expected
1421 5f8a88c6 2019-08-03 stsp echo 'M gamma/delta' >> $testroot/stdout.expected
1423 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
1424 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1426 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1427 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1429 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1432 f6cae3ed 2020-09-13 naddy test_stage_patch() {
1433 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch`
1435 dc424a06 2019-08-07 stsp jot 16 > $testroot/repo/numbers
1436 dc424a06 2019-08-07 stsp (cd $testroot/repo && git add numbers)
1437 dc424a06 2019-08-07 stsp git_commit $testroot/repo -m "added numbers file"
1438 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1440 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1442 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1443 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1447 c206b220 2021-10-09 thomas sed -i '' -e 's/^2$/a/' $testroot/wt/numbers
1448 c206b220 2021-10-09 thomas sed -i '' -e 's/^7$/b/' $testroot/wt/numbers
1449 c206b220 2021-10-09 thomas sed -i '' -e 's/^16$/c/' $testroot/wt/numbers
1451 dc424a06 2019-08-07 stsp # don't stage any hunks
1452 dc424a06 2019-08-07 stsp printf "n\nn\nn\n" > $testroot/patchscript
1453 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1454 7b5dc508 2019-10-28 stsp numbers > $testroot/stdout 2> $testroot/stderr)
1456 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1457 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
1458 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1461 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1462 dc424a06 2019-08-07 stsp -----------------------------------------------
1463 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1470 dc424a06 2019-08-07 stsp -----------------------------------------------
1471 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1472 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1473 dc424a06 2019-08-07 stsp -----------------------------------------------
1474 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1483 dc424a06 2019-08-07 stsp -----------------------------------------------
1484 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1485 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1486 dc424a06 2019-08-07 stsp -----------------------------------------------
1487 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1493 dc424a06 2019-08-07 stsp -----------------------------------------------
1494 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1495 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1497 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1499 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1500 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1501 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1505 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
1506 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1508 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1509 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
1510 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
1515 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1516 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1517 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1519 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1520 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1521 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1525 dc424a06 2019-08-07 stsp # stage middle hunk
1526 dc424a06 2019-08-07 stsp printf "n\ny\nn\n" > $testroot/patchscript
1527 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1528 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1530 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1531 dc424a06 2019-08-07 stsp -----------------------------------------------
1532 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1539 dc424a06 2019-08-07 stsp -----------------------------------------------
1540 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1541 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1542 dc424a06 2019-08-07 stsp -----------------------------------------------
1543 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1552 dc424a06 2019-08-07 stsp -----------------------------------------------
1553 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1554 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1555 dc424a06 2019-08-07 stsp -----------------------------------------------
1556 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1562 dc424a06 2019-08-07 stsp -----------------------------------------------
1563 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1564 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1566 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1568 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1569 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1570 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1574 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1575 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1576 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1578 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1579 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1580 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1584 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1586 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1587 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
1588 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1589 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1590 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1591 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1592 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1593 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1594 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1595 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1596 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1597 dc424a06 2019-08-07 stsp echo "@@ -4,7 +4,7 @@" >> $testroot/stdout.expected
1598 dc424a06 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
1599 dc424a06 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
1600 dc424a06 2019-08-07 stsp echo " 6" >> $testroot/stdout.expected
1601 dc424a06 2019-08-07 stsp echo "-7" >> $testroot/stdout.expected
1602 dc424a06 2019-08-07 stsp echo "+b" >> $testroot/stdout.expected
1603 dc424a06 2019-08-07 stsp echo " 8" >> $testroot/stdout.expected
1604 dc424a06 2019-08-07 stsp echo " 9" >> $testroot/stdout.expected
1605 dc424a06 2019-08-07 stsp echo " 10" >> $testroot/stdout.expected
1606 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1608 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1609 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1610 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1614 dc424a06 2019-08-07 stsp (cd $testroot/wt && got unstage >/dev/null)
1616 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1617 dc424a06 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
1618 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1621 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1622 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1623 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1625 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1626 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1627 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1631 dc424a06 2019-08-07 stsp # stage last hunk
1632 dc424a06 2019-08-07 stsp printf "n\nn\ny\n" > $testroot/patchscript
1633 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1634 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1636 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1637 dc424a06 2019-08-07 stsp -----------------------------------------------
1638 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1645 dc424a06 2019-08-07 stsp -----------------------------------------------
1646 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1647 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1648 dc424a06 2019-08-07 stsp -----------------------------------------------
1649 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1658 dc424a06 2019-08-07 stsp -----------------------------------------------
1659 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1660 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1661 dc424a06 2019-08-07 stsp -----------------------------------------------
1662 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1668 dc424a06 2019-08-07 stsp -----------------------------------------------
1669 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1670 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1672 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1674 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1675 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1676 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1680 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1681 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1682 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1684 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1685 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1686 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1690 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1692 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1693 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
1694 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1695 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1696 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1697 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1698 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1699 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1700 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1701 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1702 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1703 dc424a06 2019-08-07 stsp echo "@@ -13,4 +13,4 @@" >> $testroot/stdout.expected
1704 dc424a06 2019-08-07 stsp echo " 13" >> $testroot/stdout.expected
1705 dc424a06 2019-08-07 stsp echo " 14" >> $testroot/stdout.expected
1706 dc424a06 2019-08-07 stsp echo " 15" >> $testroot/stdout.expected
1707 dc424a06 2019-08-07 stsp echo "-16" >> $testroot/stdout.expected
1708 dc424a06 2019-08-07 stsp echo "+c" >> $testroot/stdout.expected
1709 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1711 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1712 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1714 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1717 f6cae3ed 2020-09-13 naddy test_stage_patch_twice() {
1718 af5a81b2 2019-08-08 stsp local testroot=`test_init stage_patch_twice`
1720 af5a81b2 2019-08-08 stsp jot 16 > $testroot/repo/numbers
1721 af5a81b2 2019-08-08 stsp (cd $testroot/repo && git add numbers)
1722 af5a81b2 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
1723 af5a81b2 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1725 af5a81b2 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1727 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1728 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1732 c206b220 2021-10-09 thomas sed -i '' -e 's/^2$/a/' $testroot/wt/numbers
1733 c206b220 2021-10-09 thomas sed -i '' -e 's/^7$/b/' $testroot/wt/numbers
1734 c206b220 2021-10-09 thomas sed -i '' -e 's/^16$/c/' $testroot/wt/numbers
1736 af5a81b2 2019-08-08 stsp # stage middle hunk
1737 af5a81b2 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
1738 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1739 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1741 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1742 af5a81b2 2019-08-08 stsp -----------------------------------------------
1743 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1750 af5a81b2 2019-08-08 stsp -----------------------------------------------
1751 af5a81b2 2019-08-08 stsp M numbers (change 1 of 3)
1752 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1753 af5a81b2 2019-08-08 stsp -----------------------------------------------
1754 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1763 af5a81b2 2019-08-08 stsp -----------------------------------------------
1764 af5a81b2 2019-08-08 stsp M numbers (change 2 of 3)
1765 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1766 af5a81b2 2019-08-08 stsp -----------------------------------------------
1767 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1773 af5a81b2 2019-08-08 stsp -----------------------------------------------
1774 af5a81b2 2019-08-08 stsp M numbers (change 3 of 3)
1775 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1777 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1779 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1780 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1781 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1785 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1786 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1787 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1789 fc414659 2022-04-16 thomas 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 # stage last hunk
1796 af5a81b2 2019-08-08 stsp printf "n\ny\n" > $testroot/patchscript
1797 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1798 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1800 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1801 af5a81b2 2019-08-08 stsp -----------------------------------------------
1802 fe621944 2020-11-10 stsp @@ -1,5 +1,5 @@
1809 af5a81b2 2019-08-08 stsp -----------------------------------------------
1810 af5a81b2 2019-08-08 stsp M numbers (change 1 of 2)
1811 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1812 af5a81b2 2019-08-08 stsp -----------------------------------------------
1813 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@ b
1819 af5a81b2 2019-08-08 stsp -----------------------------------------------
1820 af5a81b2 2019-08-08 stsp M numbers (change 2 of 2)
1821 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1823 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1825 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1826 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1827 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1831 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1832 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1833 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1835 fc414659 2022-04-16 thomas 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 diff -s > $testroot/stdout)
1843 af5a81b2 2019-08-08 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1844 af5a81b2 2019-08-08 stsp > $testroot/stdout.expected
1845 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1846 af5a81b2 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
1847 af5a81b2 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1848 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1849 af5a81b2 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1850 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1851 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1852 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1853 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1854 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1855 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1864 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1871 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1873 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1874 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1875 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1879 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1881 af5a81b2 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
1882 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1883 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
1884 af5a81b2 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
1885 af5a81b2 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
1886 af5a81b2 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
1887 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1888 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1889 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1890 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1898 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1900 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1901 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1903 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1906 f6cae3ed 2020-09-13 naddy test_stage_patch_added() {
1907 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_added`
1908 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1910 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1912 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1913 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1917 dc424a06 2019-08-07 stsp echo "new" > $testroot/wt/epsilon/new
1918 dc424a06 2019-08-07 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1920 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
1921 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1922 dc424a06 2019-08-07 stsp epsilon/new > $testroot/stdout)
1924 dc424a06 2019-08-07 stsp echo "A epsilon/new" > $testroot/stdout.expected
1925 c8ede203 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1926 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1928 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1929 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1930 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1934 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1935 dc424a06 2019-08-07 stsp echo " A epsilon/new" > $testroot/stdout.expected
1936 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1938 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1939 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1940 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1944 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1946 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
1947 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
1948 dc424a06 2019-08-07 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1949 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1950 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \
1951 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1952 dc424a06 2019-08-07 stsp echo "--- /dev/null" >> $testroot/stdout.expected
1953 dc424a06 2019-08-07 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
1954 dc424a06 2019-08-07 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
1955 dc424a06 2019-08-07 stsp echo "+new" >> $testroot/stdout.expected
1956 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1958 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1959 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1961 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1964 f6cae3ed 2020-09-13 naddy test_stage_patch_added_twice() {
1965 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_added_twice`
1966 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1968 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1970 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1971 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1975 e70a841e 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
1976 e70a841e 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1978 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
1979 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1980 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout)
1982 e70a841e 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
1983 e70a841e 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1984 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1986 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1987 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1988 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1992 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1993 e70a841e 2019-08-08 stsp echo " A epsilon/new" > $testroot/stdout.expected
1994 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1996 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1997 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1998 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2002 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2003 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout 2> $testroot/stderr)
2005 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
2006 e70a841e 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2007 e70a841e 2019-08-08 stsp test_done "$testroot" "1"
2011 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2012 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2014 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2015 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2016 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2020 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2021 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2023 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2024 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2026 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2029 f6cae3ed 2020-09-13 naddy test_stage_patch_removed() {
2030 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_removed`
2031 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2033 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2035 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2036 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2040 dc424a06 2019-08-07 stsp (cd $testroot/wt && got rm beta > /dev/null)
2042 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
2043 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2044 dc424a06 2019-08-07 stsp beta > $testroot/stdout)
2046 dc424a06 2019-08-07 stsp echo -n > $testroot/stdout.expected
2048 dc424a06 2019-08-07 stsp echo "D beta" > $testroot/stdout.expected
2049 f5a17245 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2050 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2052 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2053 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2054 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2058 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2059 dc424a06 2019-08-07 stsp echo " D beta" > $testroot/stdout.expected
2060 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2062 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2063 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2064 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2068 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2070 dc424a06 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
2071 dc424a06 2019-08-07 stsp > $testroot/stdout.expected
2072 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2073 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \
2074 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
2075 dc424a06 2019-08-07 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2076 dc424a06 2019-08-07 stsp echo "--- beta" >> $testroot/stdout.expected
2077 dc424a06 2019-08-07 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
2078 dc424a06 2019-08-07 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
2079 dc424a06 2019-08-07 stsp echo "-beta" >> $testroot/stdout.expected
2080 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2082 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2083 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2085 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2088 f6cae3ed 2020-09-13 naddy test_stage_patch_removed_twice() {
2089 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_removed_twice`
2090 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2092 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2094 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2095 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2099 e70a841e 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
2101 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2102 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2103 e70a841e 2019-08-08 stsp beta > $testroot/stdout)
2105 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2107 e70a841e 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
2108 e70a841e 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2109 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2111 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2112 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2113 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2117 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2118 e70a841e 2019-08-08 stsp echo " D beta" > $testroot/stdout.expected
2119 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2121 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2122 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2123 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2127 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p beta \
2128 e70a841e 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2130 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
2131 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
2132 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2136 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2137 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2139 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2140 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2141 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2145 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2146 f289c82c 2022-06-13 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2148 f289c82c 2022-06-13 thomas if [ $ret -ne 0 ]; then
2149 f289c82c 2022-06-13 thomas diff -u $testroot/stdout.expected $testroot/stdout
2151 f289c82c 2022-06-13 thomas test_done "$testroot" "$ret"
2154 f289c82c 2022-06-13 thomas test_stage_patch_reversed() {
2155 f289c82c 2022-06-13 thomas local testroot=`test_init stage_patch_reversed`
2157 f289c82c 2022-06-13 thomas got checkout $testroot/repo $testroot/wt > /dev/null
2159 f289c82c 2022-06-13 thomas if [ $ret -ne 0 ]; then
2160 f289c82c 2022-06-13 thomas test_done "$testroot" "$ret"
2161 f289c82c 2022-06-13 thomas return 1
2164 f289c82c 2022-06-13 thomas echo 'ALPHA' > $testroot/wt/alpha
2165 f289c82c 2022-06-13 thomas (cd $testroot/wt && got stage alpha > $testroot/stdout)
2167 f289c82c 2022-06-13 thomas if [ $ret -ne 0 ]; then
2168 f289c82c 2022-06-13 thomas test_done "$testroot" "$ret"
2169 f289c82c 2022-06-13 thomas return 1
2172 f289c82c 2022-06-13 thomas echo ' M alpha' > $testroot/stdout.expected
2173 f289c82c 2022-06-13 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2175 f289c82c 2022-06-13 thomas if [ $ret -ne 0 ]; then
2176 f289c82c 2022-06-13 thomas diff -u $testroot/stdout.expected $testroot/stdout
2177 f289c82c 2022-06-13 thomas test_done "$testroot" "$ret"
2178 f289c82c 2022-06-13 thomas return 1
2181 f289c82c 2022-06-13 thomas echo 'alpha' > $testroot/wt/alpha
2182 f289c82c 2022-06-13 thomas (cd $testroot/wt && got stage alpha > $testroot/stdout)
2184 f289c82c 2022-06-13 thomas if [ $ret -ne 0 ]; then
2185 f289c82c 2022-06-13 thomas test_done "$testroot" "$ret"
2186 f289c82c 2022-06-13 thomas return 1
2189 f289c82c 2022-06-13 thomas echo ' M alpha' > $testroot/stdout.expected
2190 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2192 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2193 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2194 f289c82c 2022-06-13 thomas test_done "$testroot" "$ret"
2195 f289c82c 2022-06-13 thomas return 1
2198 f289c82c 2022-06-13 thomas (cd $testroot/wt && got status > $testroot/stdout)
2199 f289c82c 2022-06-13 thomas cmp -s /dev/null $testroot/stdout
2201 f289c82c 2022-06-13 thomas if [ $ret -ne 0 ]; then
2202 f289c82c 2022-06-13 thomas diff -u /dev/null $testroot/stdout
2204 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2207 f6cae3ed 2020-09-13 naddy test_stage_patch_quit() {
2208 b353a198 2019-08-07 stsp local testroot=`test_init stage_patch_quit`
2210 b353a198 2019-08-07 stsp jot 16 > $testroot/repo/numbers
2211 88f33a19 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2212 88f33a19 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2213 88f33a19 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2214 b353a198 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2216 b353a198 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2218 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2219 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2223 c206b220 2021-10-09 thomas sed -i '' -e 's/^2$/a/' $testroot/wt/numbers
2224 c206b220 2021-10-09 thomas sed -i '' -e 's/^7$/b/' $testroot/wt/numbers
2225 c206b220 2021-10-09 thomas sed -i '' -e 's/^16$/c/' $testroot/wt/numbers
2226 88f33a19 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
2228 88f33a19 2019-08-08 stsp # stage first hunk and quit; and don't pass a path argument to
2229 88f33a19 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
2230 88f33a19 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
2231 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2232 2db2652d 2019-08-07 stsp > $testroot/stdout)
2234 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2235 b353a198 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
2236 b353a198 2019-08-07 stsp test_done "$testroot" "1"
2239 b353a198 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
2240 b353a198 2019-08-07 stsp -----------------------------------------------
2241 b353a198 2019-08-07 stsp @@ -1,5 +1,5 @@
2248 b353a198 2019-08-07 stsp -----------------------------------------------
2249 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
2250 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
2251 b353a198 2019-08-07 stsp -----------------------------------------------
2252 b353a198 2019-08-07 stsp @@ -4,7 +4,7 @@
2261 b353a198 2019-08-07 stsp -----------------------------------------------
2262 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
2263 b353a198 2019-08-07 stsp stage this change? [y/n/q] q
2265 f5a17245 2019-08-08 stsp stage this deletion? [y/n] n
2267 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2269 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2270 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2271 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2275 b353a198 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2276 b353a198 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
2277 88f33a19 2019-08-08 stsp echo "D zzz" >> $testroot/stdout.expected
2278 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2280 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2281 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2282 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2286 b353a198 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2288 b353a198 2019-08-07 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
2289 b353a198 2019-08-07 stsp > $testroot/stdout.expected
2290 b353a198 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2291 b353a198 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
2292 b353a198 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
2293 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2294 b353a198 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2295 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
2296 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2297 b353a198 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
2298 b353a198 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
2299 b353a198 2019-08-07 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
2300 b353a198 2019-08-07 stsp echo " 1" >> $testroot/stdout.expected
2301 b353a198 2019-08-07 stsp echo "-2" >> $testroot/stdout.expected
2302 b353a198 2019-08-07 stsp echo "+a" >> $testroot/stdout.expected
2303 b353a198 2019-08-07 stsp echo " 3" >> $testroot/stdout.expected
2304 b353a198 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
2305 b353a198 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
2306 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2308 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2309 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2311 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2315 f6cae3ed 2020-09-13 naddy test_stage_patch_incomplete_script() {
2316 eba70f38 2019-08-08 stsp local testroot=`test_init stage_incomplete_script`
2318 eba70f38 2019-08-08 stsp jot 16 > $testroot/repo/numbers
2319 eba70f38 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2320 eba70f38 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2321 eba70f38 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2322 eba70f38 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2324 eba70f38 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2326 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2327 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2331 c206b220 2021-10-09 thomas sed -i '' -e 's/^2$/a/' $testroot/wt/numbers
2332 c206b220 2021-10-09 thomas sed -i '' -e 's/^7$/b/' $testroot/wt/numbers
2333 c206b220 2021-10-09 thomas sed -i '' -e 's/^16$/c/' $testroot/wt/numbers
2335 eba70f38 2019-08-08 stsp # stage first hunk and then stop responding; got should error out
2336 eba70f38 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2337 eba70f38 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2338 eba70f38 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2340 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
2341 eba70f38 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2342 eba70f38 2019-08-08 stsp test_done "$testroot" "1"
2345 eba70f38 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
2346 eba70f38 2019-08-08 stsp -----------------------------------------------
2347 eba70f38 2019-08-08 stsp @@ -1,5 +1,5 @@
2354 eba70f38 2019-08-08 stsp -----------------------------------------------
2355 eba70f38 2019-08-08 stsp M numbers (change 1 of 3)
2356 eba70f38 2019-08-08 stsp stage this change? [y/n/q] y
2357 eba70f38 2019-08-08 stsp -----------------------------------------------
2358 eba70f38 2019-08-08 stsp @@ -4,7 +4,7 @@
2367 eba70f38 2019-08-08 stsp -----------------------------------------------
2368 eba70f38 2019-08-08 stsp M numbers (change 2 of 3)
2370 eba70f38 2019-08-08 stsp echo -n "stage this change? [y/n/q] " >> $testroot/stdout.expected
2371 eba70f38 2019-08-08 stsp echo "got: invalid patch choice" > $testroot/stderr.expected
2372 eba70f38 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2374 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2375 eba70f38 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2376 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2380 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2382 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2383 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2384 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2388 eba70f38 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2389 eba70f38 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
2390 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2392 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2393 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2394 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2398 eba70f38 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2399 eba70f38 2019-08-08 stsp echo -n > $testroot/stdout.expected
2400 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2402 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2403 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2405 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2409 f6cae3ed 2020-09-13 naddy test_stage_symlink() {
2410 c631b115 2020-07-23 stsp local testroot=`test_init stage_symlink`
2412 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2413 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2414 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2415 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2416 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2417 c631b115 2020-07-23 stsp (cd $testroot/repo && git add .)
2418 c631b115 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2419 c631b115 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2421 c631b115 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2423 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2424 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2428 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2429 dd6165e4 2021-09-21 thomas.ad (cd $testroot/wt && ln -sfT gamma epsilon.link)
2430 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2431 c631b115 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2432 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2433 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2434 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2435 c631b115 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2436 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2437 c631b115 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2439 35213c7c 2020-07-23 stsp (cd $testroot/wt && got stage > $testroot/stdout 2> $testroot/stderr)
2441 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
2442 35213c7c 2020-07-23 stsp echo "got stage succeeded unexpectedly" >&2
2443 4e2bdb0d 2022-06-13 thomas test_done "$testroot" 1
2446 35213c7c 2020-07-23 stsp echo -n "got: $testroot/wt/dotgotbar.link: " > $testroot/stderr.expected
2447 35213c7c 2020-07-23 stsp echo "symbolic link points outside of paths under version control" \
2448 35213c7c 2020-07-23 stsp >> $testroot/stderr.expected
2449 35213c7c 2020-07-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2451 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2452 35213c7c 2020-07-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
2453 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
2457 35213c7c 2020-07-23 stsp (cd $testroot/wt && got stage -S > $testroot/stdout)
2459 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2460 c631b115 2020-07-23 stsp M alpha.link
2461 c631b115 2020-07-23 stsp A dotgotbar.link
2462 c631b115 2020-07-23 stsp A dotgotfoo.link
2463 c631b115 2020-07-23 stsp M epsilon/beta.link
2464 c631b115 2020-07-23 stsp M epsilon.link
2465 c631b115 2020-07-23 stsp D nonexistent.link
2466 c631b115 2020-07-23 stsp A zeta.link
2468 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2470 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2471 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2472 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2476 0aeb8099 2020-07-23 stsp rm $testroot/wt/alpha.link
2477 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2479 c631b115 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2481 c631b115 2020-07-23 stsp echo "diff $head_commit $testroot/wt (staged changes)" \
2482 c631b115 2020-07-23 stsp > $testroot/stdout.expected
2483 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2484 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2485 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2486 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2487 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2488 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2489 c631b115 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2490 c631b115 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2491 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2492 c631b115 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2493 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2494 c631b115 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2495 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2496 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2497 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2498 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotbar.link) | cut -d' ' -f 1 \
2499 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2500 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2501 c631b115 2020-07-23 stsp echo '+++ dotgotbar.link' >> $testroot/stdout.expected
2502 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2503 c631b115 2020-07-23 stsp echo '+.got/bar' >> $testroot/stdout.expected
2504 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2505 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2506 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2507 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2508 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2509 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2510 c631b115 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2511 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2512 c631b115 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2513 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2514 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i epsilon | grep 'beta.link@ -> ../beta$' | \
2515 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2516 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2517 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon/beta.link) | cut -d' ' -f 1 \
2518 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2519 c631b115 2020-07-23 stsp echo '--- epsilon/beta.link' >> $testroot/stdout.expected
2520 c631b115 2020-07-23 stsp echo '+++ epsilon/beta.link' >> $testroot/stdout.expected
2521 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2522 c631b115 2020-07-23 stsp echo '-../beta' >> $testroot/stdout.expected
2523 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2524 c631b115 2020-07-23 stsp echo '+../gamma/delta' >> $testroot/stdout.expected
2525 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2526 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2527 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2528 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2529 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2530 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2531 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2532 c631b115 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2533 c631b115 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2534 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2535 c631b115 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2536 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2537 c631b115 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2538 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2539 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2540 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2541 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2542 c631b115 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2543 c631b115 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2544 c631b115 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2545 c631b115 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2546 c631b115 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2547 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2548 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2549 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2550 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2551 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2552 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2553 c631b115 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2554 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2555 c631b115 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2556 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2558 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2560 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2561 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2562 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2566 c631b115 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2567 c631b115 2020-07-23 stsp > $testroot/stdout)
2569 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2570 c631b115 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2571 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2575 c631b115 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2576 c631b115 2020-07-23 stsp echo "A dotgotbar.link" > $testroot/stdout.expected
2577 c631b115 2020-07-23 stsp echo "A dotgotfoo.link" >> $testroot/stdout.expected
2578 c631b115 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2579 c631b115 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2580 c631b115 2020-07-23 stsp echo "M epsilon/beta.link" >> $testroot/stdout.expected
2581 c631b115 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2582 c631b115 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2583 c631b115 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2584 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2586 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2587 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2588 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2592 c631b115 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2594 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2595 c631b115 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2596 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2600 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2602 c631b115 2020-07-23 stsp alpha.link@ -> beta
2604 c631b115 2020-07-23 stsp dotgotbar.link@ -> .got/bar
2605 c631b115 2020-07-23 stsp dotgotfoo.link
2607 c631b115 2020-07-23 stsp epsilon.link@ -> gamma
2609 c631b115 2020-07-23 stsp passwd.link@ -> /etc/passwd
2610 c631b115 2020-07-23 stsp zeta.link@ -> gamma/delta
2612 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2614 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2615 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2619 0aeb8099 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2620 0aeb8099 2020-07-23 stsp echo "alpha.link is a symlink"
2621 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2625 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2626 0aeb8099 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2627 0aeb8099 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2629 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2630 0aeb8099 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2631 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2635 75f0a0fb 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2636 75f0a0fb 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2637 75f0a0fb 2020-07-23 stsp test_done "$testroot" "1"
2640 75f0a0fb 2020-07-23 stsp (cd $testroot/wt && got update > /dev/null)
2641 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2642 c631b115 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2643 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2646 0aeb8099 2020-07-23 stsp echo -n ".got/bar" > $testroot/content.expected
2647 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2648 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2650 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2651 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2652 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2656 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2657 fa3cef63 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2658 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2661 fa3cef63 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2662 fa3cef63 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2663 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2665 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2666 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2667 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2671 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2672 fa3cef63 2020-07-23 stsp echo "epsilon.link is not a symlink"
2673 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2677 fa3cef63 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2678 fa3cef63 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
2679 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2681 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2682 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2683 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2687 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2688 fa3cef63 2020-07-23 stsp echo "passwd.link is a symlink"
2689 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2692 fa3cef63 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2693 fa3cef63 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2694 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2696 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2697 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2698 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2702 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
2703 fa3cef63 2020-07-23 stsp echo "zeta.link is not a symlink"
2704 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2708 fa3cef63 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
2709 fa3cef63 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
2710 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2712 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2713 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2714 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2718 fa3cef63 2020-07-23 stsp test_done "$testroot" "0"
2721 f6cae3ed 2020-09-13 naddy test_stage_patch_symlink() {
2722 fa3cef63 2020-07-23 stsp local testroot=`test_init stage_patch_symlink`
2724 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2725 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2726 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2727 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2728 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2729 fa3cef63 2020-07-23 stsp (cd $testroot/repo && git add .)
2730 fa3cef63 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2731 fa3cef63 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2733 fa3cef63 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2735 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2736 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2740 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2741 dd6165e4 2021-09-21 thomas.ad (cd $testroot/wt && ln -sfT gamma epsilon.link)
2742 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2743 fa3cef63 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2744 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2745 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2746 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2747 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2748 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2749 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2751 fa3cef63 2020-07-23 stsp printf "y\nn\ny\nn\ny\ny\ny" > $testroot/patchscript
2752 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2753 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2755 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2756 fa3cef63 2020-07-23 stsp -----------------------------------------------
2757 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2759 fa3cef63 2020-07-23 stsp \ No newline at end of file
2761 fa3cef63 2020-07-23 stsp \ No newline at end of file
2762 fa3cef63 2020-07-23 stsp -----------------------------------------------
2763 fa3cef63 2020-07-23 stsp M alpha.link (change 1 of 1)
2764 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2765 fa3cef63 2020-07-23 stsp A dotgotbar.link
2766 fa3cef63 2020-07-23 stsp stage this addition? [y/n] n
2767 fa3cef63 2020-07-23 stsp A dotgotfoo.link
2768 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2769 fa3cef63 2020-07-23 stsp -----------------------------------------------
2770 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2772 fa3cef63 2020-07-23 stsp \ No newline at end of file
2773 fa3cef63 2020-07-23 stsp +../gamma/delta
2774 fa3cef63 2020-07-23 stsp \ No newline at end of file
2775 fa3cef63 2020-07-23 stsp -----------------------------------------------
2776 fa3cef63 2020-07-23 stsp M epsilon/beta.link (change 1 of 1)
2777 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] n
2778 fa3cef63 2020-07-23 stsp -----------------------------------------------
2779 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2781 fa3cef63 2020-07-23 stsp \ No newline at end of file
2783 fa3cef63 2020-07-23 stsp \ No newline at end of file
2784 fa3cef63 2020-07-23 stsp -----------------------------------------------
2785 fa3cef63 2020-07-23 stsp M epsilon.link (change 1 of 1)
2786 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2787 fa3cef63 2020-07-23 stsp D nonexistent.link
2788 fa3cef63 2020-07-23 stsp stage this deletion? [y/n] y
2789 fa3cef63 2020-07-23 stsp A zeta.link
2790 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2792 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2794 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2795 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2796 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2800 fa3cef63 2020-07-23 stsp rm $testroot/wt/alpha.link
2801 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2803 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2805 fa3cef63 2020-07-23 stsp echo "diff $head_commit $testroot/wt (staged changes)" \
2806 fa3cef63 2020-07-23 stsp > $testroot/stdout.expected
2807 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2808 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2809 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2810 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2811 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2812 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2813 fa3cef63 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2814 fa3cef63 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2815 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2816 fa3cef63 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2817 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2818 fa3cef63 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2819 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2820 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2821 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2822 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2823 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2824 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2825 fa3cef63 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2826 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2827 fa3cef63 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2828 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2829 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2830 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2831 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2832 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2833 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2834 fa3cef63 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2835 fa3cef63 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2836 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2837 fa3cef63 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2838 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2839 fa3cef63 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2840 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2841 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2842 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2843 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2844 fa3cef63 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2845 fa3cef63 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2846 fa3cef63 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2847 fa3cef63 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2848 fa3cef63 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2849 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2850 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2851 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2852 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2853 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2854 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2855 fa3cef63 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2856 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2857 fa3cef63 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2858 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2860 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2862 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2863 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2864 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2868 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2869 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2871 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2872 fa3cef63 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2873 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2877 fa3cef63 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2878 fa3cef63 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2879 fa3cef63 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2880 fa3cef63 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2881 fa3cef63 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2882 fa3cef63 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2883 fa3cef63 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2884 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2886 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2887 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2888 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2892 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2894 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2895 fa3cef63 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2896 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2900 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2902 fa3cef63 2020-07-23 stsp alpha.link@ -> beta
2904 fa3cef63 2020-07-23 stsp dotgotfoo.link
2906 fa3cef63 2020-07-23 stsp epsilon.link@ -> gamma
2908 fa3cef63 2020-07-23 stsp passwd.link@ -> /etc/passwd
2909 fa3cef63 2020-07-23 stsp zeta.link@ -> gamma/delta
2911 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2913 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2914 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2918 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2919 fa3cef63 2020-07-23 stsp echo "alpha.link is a symlink"
2920 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2924 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2925 fa3cef63 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2926 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2928 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2929 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2930 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2934 fa3cef63 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2935 fa3cef63 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2936 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2939 fa3cef63 2020-07-23 stsp readlink $testroot/wt/dotgotbar.link > $testroot/stdout
2940 fa3cef63 2020-07-23 stsp echo ".got/bar" > $testroot/stdout.expected
2941 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2943 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2944 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2945 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2949 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2950 c631b115 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2951 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2954 c631b115 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2955 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2956 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2958 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2959 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2960 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2964 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2965 c631b115 2020-07-23 stsp echo "epsilon.link is not a symlink"
2966 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2970 c631b115 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2971 c631b115 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
2972 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2974 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2975 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2976 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2980 c631b115 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2981 c631b115 2020-07-23 stsp echo "passwd.link is a symlink"
2982 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2985 c631b115 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2986 c631b115 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2987 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2989 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2990 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2991 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2995 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
2996 c631b115 2020-07-23 stsp echo "zeta.link is not a symlink"
2997 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3001 c631b115 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
3002 c631b115 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
3003 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3005 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3006 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3007 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3011 c631b115 2020-07-23 stsp test_done "$testroot" "0"
3014 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3015 fccbfb98 2019-08-03 stsp run_test test_stage_basic
3016 31b20a6e 2019-08-06 stsp run_test test_stage_no_changes
3017 8b13ce36 2019-08-08 stsp run_test test_stage_unversioned
3018 8564cb21 2019-08-08 stsp run_test test_stage_nonexistent
3019 a4f692bb 2019-08-04 stsp run_test test_stage_list
3020 ebf48fd5 2019-08-03 stsp run_test test_stage_conflict
3021 735ef5ac 2019-08-03 stsp run_test test_stage_out_of_date
3022 d3e7c587 2019-08-03 stsp run_test test_double_stage
3023 c363b2c1 2019-08-03 stsp run_test test_stage_status
3024 1e1446d3 2019-08-03 stsp run_test test_stage_add_already_staged_file
3025 9acbc4fa 2019-08-03 stsp run_test test_stage_rm_already_staged_file
3026 24278f30 2019-08-03 stsp run_test test_stage_revert
3027 408b4ebc 2019-08-03 stsp run_test test_stage_diff
3028 b9622844 2019-08-03 stsp run_test test_stage_histedit
3029 243d7cf1 2019-08-03 stsp run_test test_stage_rebase
3030 a76c42e6 2019-08-03 stsp run_test test_stage_update
3031 f0b75401 2019-08-03 stsp run_test test_stage_commit_non_staged
3032 0f1cfa7f 2019-08-08 stsp run_test test_stage_commit_out_of_date
3033 5f8a88c6 2019-08-03 stsp run_test test_stage_commit
3034 dc424a06 2019-08-07 stsp run_test test_stage_patch
3035 af5a81b2 2019-08-08 stsp run_test test_stage_patch_twice
3036 dc424a06 2019-08-07 stsp run_test test_stage_patch_added
3037 e70a841e 2019-08-08 stsp run_test test_stage_patch_added_twice
3038 dc424a06 2019-08-07 stsp run_test test_stage_patch_removed
3039 e70a841e 2019-08-08 stsp run_test test_stage_patch_removed_twice
3040 f289c82c 2022-06-13 thomas run_test test_stage_patch_reversed
3041 b353a198 2019-08-07 stsp run_test test_stage_patch_quit
3042 eba70f38 2019-08-08 stsp run_test test_stage_patch_incomplete_script
3043 c631b115 2020-07-23 stsp run_test test_stage_symlink
3044 fa3cef63 2020-07-23 stsp run_test test_stage_patch_symlink