3 fccbfb98 2019-08-03 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 fccbfb98 2019-08-03 stsp # Permission to use, copy, modify, and distribute this software for any
6 fccbfb98 2019-08-03 stsp # purpose with or without fee is hereby granted, provided that the above
7 fccbfb98 2019-08-03 stsp # copyright notice and this permission notice appear in all copies.
9 fccbfb98 2019-08-03 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 fccbfb98 2019-08-03 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 fccbfb98 2019-08-03 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 fccbfb98 2019-08-03 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 fccbfb98 2019-08-03 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 fccbfb98 2019-08-03 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 fccbfb98 2019-08-03 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 fccbfb98 2019-08-03 stsp . ./common.sh
19 c861864b 2022-01-03 stsp # disable automatic packing for these tests
20 c861864b 2022-01-03 stsp export GOT_TEST_PACK=""
22 f6cae3ed 2020-09-13 naddy test_stage_basic() {
23 fccbfb98 2019-08-03 stsp local testroot=`test_init stage_basic`
25 fccbfb98 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
27 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
28 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
32 fccbfb98 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
33 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
34 fccbfb98 2019-08-03 stsp echo "new file" > $testroot/wt/foo
35 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
37 88d0e355 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
38 88d0e355 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
39 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
40 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R > $testroot/stdout)
42 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
44 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
45 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
47 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
50 bb068081 2024-04-22 stsp test_stage_directory() {
51 bb068081 2024-04-22 stsp local testroot=`test_init stage_directory`
53 bb068081 2024-04-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
55 bb068081 2024-04-22 stsp if [ $ret -ne 0 ]; then
56 bb068081 2024-04-22 stsp test_done "$testroot" "$ret"
60 bb068081 2024-04-22 stsp (cd $testroot/wt && echo -n > test && got add test > /dev/null)
61 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage . > $testroot/stdout 2> $testroot/stderr)
63 bb068081 2024-04-22 stsp echo "got: staging directories requires -R option" \
64 bb068081 2024-04-22 stsp > $testroot/stderr.expected
65 bb068081 2024-04-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
67 bb068081 2024-04-22 stsp if [ $ret -ne 0 ]; then
68 bb068081 2024-04-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
69 bb068081 2024-04-22 stsp test_done "$testroot" "$ret"
73 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R . > $testroot/stdout)
75 f1f83f31 2024-04-22 stsp echo ' A test' >> $testroot/stdout.expected
76 bb068081 2024-04-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
78 bb068081 2024-04-22 stsp if [ $ret -ne 0 ]; then
79 bb068081 2024-04-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
81 f1f83f31 2024-04-22 stsp test_done "$testroot" "$ret"
84 f6cae3ed 2020-09-13 naddy test_stage_no_changes() {
85 31b20a6e 2019-08-06 stsp local testroot=`test_init stage_no_changes`
87 31b20a6e 2019-08-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
89 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
90 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
94 31b20a6e 2019-08-06 stsp (cd $testroot/wt && got stage alpha beta > $testroot/stdout \
95 31b20a6e 2019-08-06 stsp 2> $testroot/stderr)
97 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
98 31b20a6e 2019-08-06 stsp echo "got stage command succeeded unexpectedly" >&2
99 31b20a6e 2019-08-06 stsp test_done "$testroot" "1"
103 2db2652d 2019-08-07 stsp echo "got: no changes to stage" > $testroot/stderr.expected
105 31b20a6e 2019-08-06 stsp cmp -s $testroot/stderr.expected $testroot/stderr
107 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
108 31b20a6e 2019-08-06 stsp diff -u $testroot/stderr.expected $testroot/stderr
109 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
113 31b20a6e 2019-08-06 stsp echo -n > $testroot/stdout.expected
114 31b20a6e 2019-08-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
116 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
117 31b20a6e 2019-08-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
119 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
122 f6cae3ed 2020-09-13 naddy test_stage_unversioned() {
123 8b13ce36 2019-08-08 stsp local testroot=`test_init stage_unversioned`
125 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
127 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
128 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
132 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
133 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
135 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
136 8b13ce36 2019-08-08 stsp echo "M alpha" > $testroot/stdout.expected
137 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
138 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
140 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
141 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
142 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
146 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R > $testroot/stdout)
148 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
149 8b13ce36 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
150 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
154 8b13ce36 2019-08-08 stsp echo " M alpha" > $testroot/stdout.expected
155 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
157 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
158 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
159 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
163 8b13ce36 2019-08-08 stsp echo "modified file again" > $testroot/wt/alpha
165 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage unversioned-file > $testroot/stdout \
166 8b13ce36 2019-08-08 stsp 2> $testroot/stderr)
168 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
169 8b13ce36 2019-08-08 stsp echo "got stage command succeed unexpectedly" >&2
170 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
174 8b13ce36 2019-08-08 stsp echo "got: no changes to stage" > $testroot/stderr.expected
175 8b13ce36 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
177 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
178 8b13ce36 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
180 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
184 f6cae3ed 2020-09-13 naddy test_stage_nonexistent() {
185 8564cb21 2019-08-08 stsp local testroot=`test_init stage_nonexistent`
187 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
189 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
190 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
194 8564cb21 2019-08-08 stsp (cd $testroot/wt && got stage nonexistent-file \
195 8564cb21 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
196 2a06fe5f 2019-08-24 stsp echo "got: nonexistent-file: No such file or directory" \
197 2a06fe5f 2019-08-24 stsp > $testroot/stderr.expected
198 8564cb21 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
200 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
201 8564cb21 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
203 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
206 f6cae3ed 2020-09-13 naddy test_stage_list() {
207 a4f692bb 2019-08-04 stsp local testroot=`test_init stage_list`
209 a4f692bb 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
211 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
212 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
216 a4f692bb 2019-08-04 stsp echo "modified file" > $testroot/wt/alpha
217 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got rm beta > /dev/null)
218 a4f692bb 2019-08-04 stsp echo "new file" > $testroot/wt/foo
219 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got add foo > /dev/null)
221 a4f692bb 2019-08-04 stsp echo ' M alpha' > $testroot/stdout.expected
222 a4f692bb 2019-08-04 stsp echo ' D beta' >> $testroot/stdout.expected
223 a4f692bb 2019-08-04 stsp echo ' A foo' >> $testroot/stdout.expected
224 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
226 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -Rl > $testroot/stdout)
227 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
228 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
229 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
230 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s beta | grep '^blob -' | \
231 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
232 a4f692bb 2019-08-04 stsp echo " D beta" >> $testroot/stdout.expected
233 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s foo | grep '^blob +' | \
234 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
235 a4f692bb 2019-08-04 stsp echo " A foo" >> $testroot/stdout.expected
236 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
238 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
239 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
240 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
244 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l epsilon nonexistent \
245 a4f692bb 2019-08-04 stsp > $testroot/stdout)
247 a4f692bb 2019-08-04 stsp echo -n > $testroot/stdout.expected
248 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
250 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
251 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
252 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
256 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l alpha > $testroot/stdout)
258 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
259 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
260 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
261 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
263 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
264 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
270 f6cae3ed 2020-09-13 naddy test_stage_conflict() {
271 ebf48fd5 2019-08-03 stsp local testroot=`test_init stage_conflict`
272 ebf48fd5 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
274 ebf48fd5 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
276 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
277 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
281 ebf48fd5 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
282 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
284 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
286 ebf48fd5 2019-08-03 stsp echo "modified alpha, too" > $testroot/wt/alpha
288 ebf48fd5 2019-08-03 stsp echo "C alpha" > $testroot/stdout.expected
289 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
290 ebf48fd5 2019-08-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
291 ebf48fd5 2019-08-03 stsp echo >> $testroot/stdout.expected
292 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
294 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout)
296 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
298 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
299 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
300 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
304 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
305 ebf48fd5 2019-08-03 stsp 2> $testroot/stderr)
307 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
308 ebf48fd5 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
309 ebf48fd5 2019-08-03 stsp test_done "$testroot" "1"
313 ebf48fd5 2019-08-03 stsp echo -n > $testroot/stdout.expected
314 ebf48fd5 2019-08-03 stsp echo "got: alpha: cannot stage file in conflicted status" \
315 735ef5ac 2019-08-03 stsp > $testroot/stderr.expected
317 735ef5ac 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
319 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
320 735ef5ac 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
321 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
324 735ef5ac 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
326 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
327 735ef5ac 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
329 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
332 f6cae3ed 2020-09-13 naddy test_stage_out_of_date() {
333 735ef5ac 2019-08-03 stsp local testroot=`test_init stage_out_of_date`
334 735ef5ac 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
336 735ef5ac 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
338 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
339 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
343 735ef5ac 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
344 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
346 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
348 735ef5ac 2019-08-03 stsp echo "modified alpha again" > $testroot/wt/alpha
349 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
350 735ef5ac 2019-08-03 stsp 2> $testroot/stderr)
352 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
353 735ef5ac 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
354 735ef5ac 2019-08-03 stsp test_done "$testroot" "1"
358 735ef5ac 2019-08-03 stsp echo -n > $testroot/stdout.expected
359 735ef5ac 2019-08-03 stsp echo "got: work tree must be updated before changes can be staged" \
360 ebf48fd5 2019-08-03 stsp > $testroot/stderr.expected
362 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
364 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
365 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
366 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
369 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
371 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
372 ebf48fd5 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
374 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
378 f6cae3ed 2020-09-13 naddy test_double_stage() {
379 d3e7c587 2019-08-03 stsp local testroot=`test_init double_stage`
381 d3e7c587 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
383 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
384 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
387 d3e7c587 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
388 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
389 d3e7c587 2019-08-03 stsp echo "new file" > $testroot/wt/foo
390 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
391 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
393 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
394 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha 2> $testroot/stderr)
395 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
397 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
398 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
399 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
403 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage beta \
404 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
406 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
407 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
408 7b5dc508 2019-10-28 stsp test_done "$testroot" "1"
411 7b5dc508 2019-10-28 stsp echo -n > $testroot/stdout.expected
412 7b5dc508 2019-10-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
414 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
415 7b5dc508 2019-10-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
416 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
420 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
421 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
422 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
424 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
425 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
426 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
430 7b5dc508 2019-10-28 stsp printf "q\n" > $testroot/patchscript
431 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
432 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
434 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
435 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
436 d3e7c587 2019-08-03 stsp test_done "$testroot" "1"
439 d3e7c587 2019-08-03 stsp echo -n > $testroot/stdout.expected
440 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
442 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
443 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
444 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
448 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
449 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
450 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
452 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
453 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
454 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
458 d3e7c587 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
459 d3e7c587 2019-08-03 stsp echo "modified new file" > $testroot/wt/foo
461 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
462 88d0e355 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
463 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
464 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
466 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
467 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
468 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
472 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
473 d3e7c587 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
474 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
476 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
477 fccbfb98 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
479 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
480 fccbfb98 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
482 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
485 f6cae3ed 2020-09-13 naddy test_stage_status() {
486 c363b2c1 2019-08-03 stsp local testroot=`test_init stage_status`
488 c363b2c1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
490 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
491 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
495 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
496 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
497 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/foo
498 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
499 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/epsilon/new
500 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
501 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/epsilon/zeta
502 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm gamma/delta > /dev/null)
504 c363b2c1 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
505 c363b2c1 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
506 c363b2c1 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
507 c363b2c1 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
508 c363b2c1 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
509 c363b2c1 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
510 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
512 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
513 c363b2c1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
515 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
516 c363b2c1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
517 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
521 244725f2 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
522 244725f2 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
524 244725f2 2019-08-03 stsp echo 'MM alpha' > $testroot/stdout.expected
525 244725f2 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
526 244725f2 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
527 244725f2 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
528 244725f2 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
529 244725f2 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
531 244725f2 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
532 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
534 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
535 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
536 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
540 244725f2 2019-08-03 stsp # test no-op change of added file with new stat(2) timestamp
541 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/foo
542 244725f2 2019-08-03 stsp echo ' A foo' > $testroot/stdout.expected
543 244725f2 2019-08-03 stsp (cd $testroot/wt && got status foo > $testroot/stdout)
544 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
546 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
547 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
548 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
552 244725f2 2019-08-03 stsp # test staged deleted file which is restored on disk
553 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/beta
554 244725f2 2019-08-03 stsp echo ' D beta' > $testroot/stdout.expected
555 244725f2 2019-08-03 stsp (cd $testroot/wt && got status beta > $testroot/stdout)
556 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
558 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
559 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
561 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
565 f6cae3ed 2020-09-13 naddy test_stage_add_already_staged_file() {
566 1e1446d3 2019-08-03 stsp local testroot=`test_init stage_add_already_staged_file`
568 1e1446d3 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
570 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
571 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
575 1e1446d3 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
576 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
577 1e1446d3 2019-08-03 stsp echo "new file" > $testroot/wt/foo
578 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
580 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
582 1e1446d3 2019-08-03 stsp echo -n > $testroot/stdout.expected
583 6d022e97 2019-08-04 stsp for f in alpha beta foo; do
584 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add $f \
585 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
586 6d022e97 2019-08-04 stsp echo "got: $f: file has unexpected status" \
587 6d022e97 2019-08-04 stsp > $testroot/stderr.expected
588 6d022e97 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
590 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
591 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
592 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
595 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
597 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
598 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
599 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
604 1e1446d3 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
605 1e1446d3 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
606 1e1446d3 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
608 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
609 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
611 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
612 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
614 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
617 f6cae3ed 2020-09-13 naddy test_stage_rm_already_staged_file() {
618 9acbc4fa 2019-08-03 stsp local testroot=`test_init stage_rm_already_staged_file`
620 9acbc4fa 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
622 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
623 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
627 9acbc4fa 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
628 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
629 9acbc4fa 2019-08-03 stsp echo "new file" > $testroot/wt/foo
630 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
632 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
634 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta \
635 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
638 6d022e97 2019-08-04 stsp echo "got rm command failed unexpectedly" >&2
639 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
642 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
643 6d022e97 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
645 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
646 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
647 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
650 6d022e97 2019-08-04 stsp echo -n > $testroot/stderr.expected
651 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
653 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
654 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
655 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
659 9acbc4fa 2019-08-03 stsp for f in alpha foo; do
660 24278f30 2019-08-03 stsp echo "got: $f: file is staged" > $testroot/stderr.expected
661 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm $f \
662 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
664 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
665 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
666 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
669 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
671 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
672 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
673 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
678 9acbc4fa 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
679 9acbc4fa 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
680 9acbc4fa 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
682 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
683 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
685 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
686 9acbc4fa 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
688 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
691 f6cae3ed 2020-09-13 naddy test_stage_revert() {
692 24278f30 2019-08-03 stsp local testroot=`test_init stage_revert`
694 24278f30 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
696 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
697 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
701 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
702 24278f30 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
703 24278f30 2019-08-03 stsp echo "new file" > $testroot/wt/foo
704 24278f30 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
705 24278f30 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
707 24278f30 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
708 24278f30 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
710 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
712 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
713 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
714 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
718 24278f30 2019-08-03 stsp echo "R alpha" > $testroot/stdout.expected
719 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
721 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
722 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
723 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
727 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
728 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
729 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
731 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
732 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
733 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
737 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
738 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
739 24278f30 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
740 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
741 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
743 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
744 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
745 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
749 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
751 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
752 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
753 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
757 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
758 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
760 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
761 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
762 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
766 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
767 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
768 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
770 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
771 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
772 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
776 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert beta > $testroot/stdout \
777 24278f30 2019-08-03 stsp 2> $testroot/stderr)
779 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
780 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
781 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
785 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stdout.expected
786 d3bcc3d1 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
788 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
789 d3bcc3d1 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
790 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
794 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
795 24278f30 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
797 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
798 24278f30 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
799 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
803 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
805 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
806 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
807 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
811 24278f30 2019-08-03 stsp echo "R foo" > $testroot/stdout.expected
812 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
814 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
815 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
816 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
820 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
821 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
822 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
824 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
825 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
826 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
830 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
831 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
832 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
833 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
834 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
836 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
837 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
838 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
842 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
844 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
845 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
846 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
850 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
851 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
853 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
854 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
855 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
859 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
860 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
861 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
863 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
864 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
865 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
869 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
870 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
871 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
872 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
873 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
875 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
876 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
877 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
881 0f6d7415 2019-08-08 stsp echo "modified file again" >> $testroot/wt/alpha
882 0f6d7415 2019-08-08 stsp echo "modified added file again" >> $testroot/wt/foo
884 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout \
885 0f6d7415 2019-08-08 stsp 2> $testroot/stderr)
887 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
888 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
889 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
893 0f6d7415 2019-08-08 stsp echo "R alpha" > $testroot/stdout.expected
894 d3bcc3d1 2019-08-08 stsp echo "R foo" >> $testroot/stdout.expected
895 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
897 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
898 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
899 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
903 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
904 0f6d7415 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
906 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
907 0f6d7415 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
908 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
912 0f6d7415 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
913 0f6d7415 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
914 d3bcc3d1 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
915 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
916 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
918 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
919 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
921 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
924 f6cae3ed 2020-09-13 naddy test_stage_diff() {
925 408b4ebc 2019-08-03 stsp local testroot=`test_init stage_diff`
926 408b4ebc 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
928 408b4ebc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
930 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
931 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
935 408b4ebc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
936 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
937 408b4ebc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
938 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
940 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
941 98eaaa12 2019-08-03 stsp echo -n > $testroot/stdout.expected
942 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
944 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
945 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
946 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
950 408b4ebc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
951 408b4ebc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
952 408b4ebc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
953 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
955 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
956 408b4ebc 2019-08-03 stsp echo -n > $testroot/stdout.expected
957 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
959 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
960 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
961 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
965 408b4ebc 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
966 408b4ebc 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
968 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
970 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
971 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
972 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
973 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
974 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 | tr -d '\n' \
975 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
976 4ce46740 2019-08-08 stsp echo ' (staged)' >> $testroot/stdout.expected
977 408b4ebc 2019-08-03 stsp echo 'file + alpha' >> $testroot/stdout.expected
978 408b4ebc 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
979 408b4ebc 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
980 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
981 408b4ebc 2019-08-03 stsp echo '-modified file' >> $testroot/stdout.expected
982 408b4ebc 2019-08-03 stsp echo '+modified file again' >> $testroot/stdout.expected
983 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
984 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 | tr -d '\n' \
985 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
986 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
987 408b4ebc 2019-08-03 stsp echo 'file + foo' >> $testroot/stdout.expected
988 408b4ebc 2019-08-03 stsp echo '--- foo' >> $testroot/stdout.expected
989 408b4ebc 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
990 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
991 408b4ebc 2019-08-03 stsp echo '-new file' >> $testroot/stdout.expected
992 408b4ebc 2019-08-03 stsp echo '+new file changed' >> $testroot/stdout.expected
994 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
996 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
997 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
998 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
1002 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1004 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1005 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
1006 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1007 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1008 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
1009 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
1010 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1011 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
1012 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
1013 98eaaa12 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
1014 98eaaa12 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
1015 98eaaa12 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1016 98eaaa12 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
1017 98eaaa12 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
1018 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1019 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1020 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
1021 98eaaa12 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1022 98eaaa12 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
1023 98eaaa12 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1024 98eaaa12 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1025 98eaaa12 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
1026 98eaaa12 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1027 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1028 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
1029 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
1030 98eaaa12 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
1031 98eaaa12 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
1032 98eaaa12 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1033 98eaaa12 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1035 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1037 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1038 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1040 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
1044 f6cae3ed 2020-09-13 naddy test_stage_histedit() {
1045 b9622844 2019-08-03 stsp local testroot=`test_init stage_histedit`
1046 b9622844 2019-08-03 stsp local orig_commit=`git_show_head $testroot/repo`
1048 b9622844 2019-08-03 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1050 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1051 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1055 b9622844 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1056 b9622844 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1058 b9622844 2019-08-03 stsp echo "modified alpha on master" > $testroot/repo/alpha
1059 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
1060 b9622844 2019-08-03 stsp echo "new file on master" > $testroot/repo/epsilon/new
1061 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon/new
1062 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing changes"
1063 b9622844 2019-08-03 stsp local old_commit1=`git_show_head $testroot/repo`
1065 b9622844 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1066 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1067 b9622844 2019-08-03 stsp local old_commit2=`git_show_head $testroot/repo`
1069 b9622844 2019-08-03 stsp echo "pick $old_commit1" > $testroot/histedit-script
1070 b9622844 2019-08-03 stsp echo "pick $old_commit2" >> $testroot/histedit-script
1072 b9622844 2019-08-03 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1073 b9622844 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1075 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1076 b9622844 2019-08-03 stsp echo "got histedit command succeeded unexpectedly" >&2
1077 b9622844 2019-08-03 stsp test_done "$testroot" "1"
1081 b9622844 2019-08-03 stsp echo -n > $testroot/stdout.expected
1082 b9622844 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1084 b9622844 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1086 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1087 b9622844 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1088 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1091 b9622844 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1093 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1094 b9622844 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1096 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1100 f6cae3ed 2020-09-13 naddy test_stage_rebase() {
1101 243d7cf1 2019-08-03 stsp local testroot=`test_init stage_rebase`
1103 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1104 243d7cf1 2019-08-03 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
1105 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
1107 243d7cf1 2019-08-03 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1108 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
1109 243d7cf1 2019-08-03 stsp echo "new file on branch" > $testroot/repo/epsilon/new
1110 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon/new
1111 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
1113 243d7cf1 2019-08-03 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
1114 243d7cf1 2019-08-03 stsp local orig_commit2=`git_show_head $testroot/repo`
1116 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q master
1117 243d7cf1 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1118 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1119 243d7cf1 2019-08-03 stsp local master_commit=`git_show_head $testroot/repo`
1121 243d7cf1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1123 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1124 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1128 243d7cf1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1129 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1131 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got rebase newbranch \
1132 243d7cf1 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1134 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1135 243d7cf1 2019-08-03 stsp echo "got rebase command succeeded unexpectedly" >&2
1136 243d7cf1 2019-08-03 stsp test_done "$testroot" "1"
1140 243d7cf1 2019-08-03 stsp echo -n > $testroot/stdout.expected
1141 243d7cf1 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1143 243d7cf1 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1145 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1146 243d7cf1 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1147 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1150 243d7cf1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1152 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1153 243d7cf1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1155 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1158 f6cae3ed 2020-09-13 naddy test_stage_update() {
1159 a76c42e6 2019-08-03 stsp local testroot=`test_init stage_update`
1161 a76c42e6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1163 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1164 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1168 a76c42e6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1169 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1171 a76c42e6 2019-08-03 stsp echo "modified alpha" > $testroot/repo/alpha
1172 a76c42e6 2019-08-03 stsp git_commit $testroot/repo -m "modified alpha"
1174 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout \
1175 a76c42e6 2019-08-03 stsp 2> $testroot/stderr)
1177 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1178 a76c42e6 2019-08-03 stsp echo "got update command succeeded unexpectedly" >&2
1179 a76c42e6 2019-08-03 stsp test_done "$testroot" "1"
1183 a76c42e6 2019-08-03 stsp echo -n > $testroot/stdout.expected
1184 a76c42e6 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1186 a76c42e6 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1188 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1189 a76c42e6 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1190 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1193 a76c42e6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1195 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1196 a76c42e6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1198 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1201 f6cae3ed 2020-09-13 naddy test_stage_commit_non_staged() {
1202 f0b75401 2019-08-03 stsp local testroot=`test_init stage_commit_non_staged`
1204 f0b75401 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1206 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1207 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1211 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1212 f0b75401 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1213 f0b75401 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1214 f0b75401 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1215 f0b75401 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1217 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/gamma/delta
1218 f0b75401 2019-08-03 stsp (cd $testroot/wt && got commit -m "change delta" gamma/delta \
1219 f0b75401 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1221 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1222 f0b75401 2019-08-03 stsp echo "got commit command succeeded unexpectedly" >&2
1223 f0b75401 2019-08-03 stsp test_done "$testroot" "1"
1227 f0b75401 2019-08-03 stsp echo -n > $testroot/stdout.expected
1228 f0b75401 2019-08-03 stsp echo "got: gamma/delta: file is not staged" > $testroot/stderr.expected
1230 f0b75401 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1232 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1233 f0b75401 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1234 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1237 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1239 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1240 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1242 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1245 f6cae3ed 2020-09-13 naddy test_stage_commit_out_of_date() {
1246 0f1cfa7f 2019-08-08 stsp local testroot=`test_init stage_commit_out_of_date`
1248 0f1cfa7f 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1250 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1251 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1255 0f1cfa7f 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
1256 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
1257 0f1cfa7f 2019-08-08 stsp echo "new file" > $testroot/wt/foo
1258 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
1259 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1261 0f1cfa7f 2019-08-08 stsp echo "changed file" > $testroot/repo/alpha
1262 0f1cfa7f 2019-08-08 stsp git_commit $testroot/repo -m "changed alpha in repo"
1264 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try to commit" > $testroot/stdout \
1265 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1267 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1268 0f1cfa7f 2019-08-08 stsp echo "got commit command succeeded unexpectedly" >&2
1269 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "1"
1273 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1274 0f1cfa7f 2019-08-08 stsp echo -n "got: work tree must be updated before these changes " \
1275 0f1cfa7f 2019-08-08 stsp > $testroot/stderr.expected
1276 0f1cfa7f 2019-08-08 stsp echo "can be committed" >> $testroot/stderr.expected
1278 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1280 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1281 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1282 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1285 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1287 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1288 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1289 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1293 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout \
1294 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1295 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1296 0f1cfa7f 2019-08-08 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1298 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1300 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1301 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1302 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1305 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1307 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1308 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1309 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1313 bb068081 2024-04-22 stsp (cd $testroot/wt && got unstage -R > /dev/null)
1314 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
1316 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1317 0f1cfa7f 2019-08-08 stsp echo "got update command failed unexpectedly" >&2
1318 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1322 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1323 0f1cfa7f 2019-08-08 stsp echo "C alpha" > $testroot/stdout.expected
1324 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1325 0f1cfa7f 2019-08-08 stsp echo "A foo" >> $testroot/stdout.expected
1326 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1328 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1329 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1330 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1334 0f1cfa7f 2019-08-08 stsp # resolve conflict
1335 0f1cfa7f 2019-08-08 stsp echo "resolved file" > $testroot/wt/alpha
1337 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R > /dev/null)
1339 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try again" > $testroot/stdout)
1341 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1342 0f1cfa7f 2019-08-08 stsp echo "got commit command failed unexpectedly" >&2
1343 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1347 0f1cfa7f 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1348 0f1cfa7f 2019-08-08 stsp echo "A foo" > $testroot/stdout.expected
1349 0f1cfa7f 2019-08-08 stsp echo "M alpha" >> $testroot/stdout.expected
1350 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1351 0f1cfa7f 2019-08-08 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1352 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1354 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1355 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1357 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1361 f6cae3ed 2020-09-13 naddy test_stage_commit() {
1362 5f8a88c6 2019-08-03 stsp local testroot=`test_init stage_commit`
1363 5f8a88c6 2019-08-03 stsp local first_commit=`git_show_head $testroot/repo`
1365 5f8a88c6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1367 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1368 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1372 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1373 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1374 5f8a88c6 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1375 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1376 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1377 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1379 5f8a88c6 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
1380 5f8a88c6 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
1381 5f8a88c6 2019-08-03 stsp echo "non-staged change" > $testroot/wt/gamma/delta
1382 5f8a88c6 2019-08-03 stsp echo "non-staged new file" > $testroot/wt/epsilon/new
1383 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1384 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm epsilon/zeta > /dev/null)
1386 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
1387 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_alpha
1388 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
1389 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_foo
1391 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got commit -m "staged changes" \
1392 5f8a88c6 2019-08-03 stsp > $testroot/stdout)
1394 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1395 5f8a88c6 2019-08-03 stsp echo "got commit command failed unexpectedly" >&2
1396 5f8a88c6 2019-08-03 stsp test_done "$testroot" "1"
1400 5f8a88c6 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
1401 5f8a88c6 2019-08-03 stsp echo "A foo" > $testroot/stdout.expected
1402 5f8a88c6 2019-08-03 stsp echo "M alpha" >> $testroot/stdout.expected
1403 5f8a88c6 2019-08-03 stsp echo "D beta" >> $testroot/stdout.expected
1404 5f8a88c6 2019-08-03 stsp echo "Created commit $head_commit" >> $testroot/stdout.expected
1406 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1408 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1409 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1410 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1414 5f8a88c6 2019-08-03 stsp got diff -r $testroot/repo $first_commit $head_commit \
1415 5f8a88c6 2019-08-03 stsp > $testroot/stdout
1417 5f8a88c6 2019-08-03 stsp echo "diff $first_commit $head_commit" \
1418 5f8a88c6 2019-08-03 stsp > $testroot/stdout.expected
1419 8469d821 2022-06-25 stsp echo "commit - $first_commit" >> $testroot/stdout.expected
1420 8469d821 2022-06-25 stsp echo "commit + $head_commit" >> $testroot/stdout.expected
1421 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1422 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit | \
1423 5f8a88c6 2019-08-03 stsp grep 'alpha$' | cut -d' ' -f 1 \
1424 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1425 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1426 5f8a88c6 2019-08-03 stsp cat $testroot/blob_id_alpha >> $testroot/stdout.expected
1427 5f8a88c6 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
1428 5f8a88c6 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
1429 5f8a88c6 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1430 5f8a88c6 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
1431 5f8a88c6 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
1432 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1433 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit \
1434 46f68b20 2019-10-19 stsp | grep 'beta$' | cut -d' ' -f 1 | tr -d '\n' \
1435 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1436 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1437 5f8a88c6 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1438 5f8a88c6 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
1439 5f8a88c6 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1440 5f8a88c6 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1441 5f8a88c6 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
1442 5f8a88c6 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1443 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1444 46f68b20 2019-10-19 stsp cat $testroot/blob_id_foo | tr -d '\n' >> $testroot/stdout.expected
1445 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1446 5f8a88c6 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
1447 5f8a88c6 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
1448 5f8a88c6 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1449 5f8a88c6 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1451 f0b75401 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1453 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1454 f0b75401 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1455 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1459 72fd46fa 2019-09-06 stsp echo 'M alpha' > $testroot/stdout.expected
1460 72fd46fa 2019-09-06 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
1461 5f8a88c6 2019-08-03 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
1462 72fd46fa 2019-09-06 stsp echo 'M foo' >> $testroot/stdout.expected
1463 5f8a88c6 2019-08-03 stsp echo 'M gamma/delta' >> $testroot/stdout.expected
1465 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
1466 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1468 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1469 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1471 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1474 f6cae3ed 2020-09-13 naddy test_stage_patch() {
1475 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch`
1477 2fed5287 2024-04-09 op seq 16 > $testroot/repo/numbers
1478 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers
1479 dc424a06 2019-08-07 stsp git_commit $testroot/repo -m "added numbers file"
1480 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1482 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1484 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1485 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1489 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
1490 885e96df 2023-03-06 naddy ,s/^2$/a/
1491 885e96df 2023-03-06 naddy ,s/^7$/b/
1492 885e96df 2023-03-06 naddy ,s/^16$/c/
1496 dc424a06 2019-08-07 stsp # don't stage any hunks
1497 dc424a06 2019-08-07 stsp printf "n\nn\nn\n" > $testroot/patchscript
1498 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1499 7b5dc508 2019-10-28 stsp numbers > $testroot/stdout 2> $testroot/stderr)
1501 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1502 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
1503 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1506 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1507 dc424a06 2019-08-07 stsp -----------------------------------------------
1508 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1515 dc424a06 2019-08-07 stsp -----------------------------------------------
1516 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1517 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1518 dc424a06 2019-08-07 stsp -----------------------------------------------
1519 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1528 dc424a06 2019-08-07 stsp -----------------------------------------------
1529 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1530 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1531 dc424a06 2019-08-07 stsp -----------------------------------------------
1532 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1538 dc424a06 2019-08-07 stsp -----------------------------------------------
1539 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1540 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1542 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1544 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1545 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1546 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1550 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
1551 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1553 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1554 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
1555 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
1560 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1561 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1562 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1564 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1565 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1566 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1570 dc424a06 2019-08-07 stsp # stage middle hunk
1571 dc424a06 2019-08-07 stsp printf "n\ny\nn\n" > $testroot/patchscript
1572 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1573 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1575 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1576 dc424a06 2019-08-07 stsp -----------------------------------------------
1577 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1584 dc424a06 2019-08-07 stsp -----------------------------------------------
1585 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1586 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1587 dc424a06 2019-08-07 stsp -----------------------------------------------
1588 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1597 dc424a06 2019-08-07 stsp -----------------------------------------------
1598 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1599 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1600 dc424a06 2019-08-07 stsp -----------------------------------------------
1601 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1607 dc424a06 2019-08-07 stsp -----------------------------------------------
1608 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1609 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1611 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1613 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1614 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1615 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1619 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1620 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1621 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1623 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1624 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1625 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1629 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1631 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1632 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1633 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1634 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1635 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1636 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1637 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1638 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1639 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1640 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1641 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1642 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1643 dc424a06 2019-08-07 stsp echo "@@ -4,7 +4,7 @@" >> $testroot/stdout.expected
1644 dc424a06 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
1645 dc424a06 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
1646 dc424a06 2019-08-07 stsp echo " 6" >> $testroot/stdout.expected
1647 dc424a06 2019-08-07 stsp echo "-7" >> $testroot/stdout.expected
1648 dc424a06 2019-08-07 stsp echo "+b" >> $testroot/stdout.expected
1649 dc424a06 2019-08-07 stsp echo " 8" >> $testroot/stdout.expected
1650 dc424a06 2019-08-07 stsp echo " 9" >> $testroot/stdout.expected
1651 dc424a06 2019-08-07 stsp echo " 10" >> $testroot/stdout.expected
1652 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1654 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1655 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1656 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1660 bb068081 2024-04-22 stsp (cd $testroot/wt && got unstage -R >/dev/null)
1662 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1663 dc424a06 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
1664 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1667 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1668 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1669 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1671 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1672 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1673 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1677 dc424a06 2019-08-07 stsp # stage last hunk
1678 dc424a06 2019-08-07 stsp printf "n\nn\ny\n" > $testroot/patchscript
1679 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1680 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1682 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1683 dc424a06 2019-08-07 stsp -----------------------------------------------
1684 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1691 dc424a06 2019-08-07 stsp -----------------------------------------------
1692 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1693 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1694 dc424a06 2019-08-07 stsp -----------------------------------------------
1695 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1704 dc424a06 2019-08-07 stsp -----------------------------------------------
1705 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1706 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1707 dc424a06 2019-08-07 stsp -----------------------------------------------
1708 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1714 dc424a06 2019-08-07 stsp -----------------------------------------------
1715 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1716 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1718 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1720 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1721 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1722 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1726 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1727 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1728 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1730 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1731 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1732 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1736 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1738 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1739 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1740 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1741 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1742 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1743 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1744 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1745 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1746 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1747 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1748 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1749 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1750 dc424a06 2019-08-07 stsp echo "@@ -13,4 +13,4 @@" >> $testroot/stdout.expected
1751 dc424a06 2019-08-07 stsp echo " 13" >> $testroot/stdout.expected
1752 dc424a06 2019-08-07 stsp echo " 14" >> $testroot/stdout.expected
1753 dc424a06 2019-08-07 stsp echo " 15" >> $testroot/stdout.expected
1754 dc424a06 2019-08-07 stsp echo "-16" >> $testroot/stdout.expected
1755 dc424a06 2019-08-07 stsp echo "+c" >> $testroot/stdout.expected
1756 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1758 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1759 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1761 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1764 f6cae3ed 2020-09-13 naddy test_stage_patch_twice() {
1765 af5a81b2 2019-08-08 stsp local testroot=`test_init stage_patch_twice`
1767 2fed5287 2024-04-09 op seq 16 > $testroot/repo/numbers
1768 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers
1769 af5a81b2 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
1770 af5a81b2 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1772 af5a81b2 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1774 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1775 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1779 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
1780 885e96df 2023-03-06 naddy ,s/^2$/a/
1781 885e96df 2023-03-06 naddy ,s/^7$/b/
1782 885e96df 2023-03-06 naddy ,s/^16$/c/
1786 af5a81b2 2019-08-08 stsp # stage middle hunk
1787 af5a81b2 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
1788 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1789 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1791 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1792 af5a81b2 2019-08-08 stsp -----------------------------------------------
1793 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1800 af5a81b2 2019-08-08 stsp -----------------------------------------------
1801 af5a81b2 2019-08-08 stsp M numbers (change 1 of 3)
1802 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1803 af5a81b2 2019-08-08 stsp -----------------------------------------------
1804 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1813 af5a81b2 2019-08-08 stsp -----------------------------------------------
1814 af5a81b2 2019-08-08 stsp M numbers (change 2 of 3)
1815 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1816 af5a81b2 2019-08-08 stsp -----------------------------------------------
1817 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1823 af5a81b2 2019-08-08 stsp -----------------------------------------------
1824 af5a81b2 2019-08-08 stsp M numbers (change 3 of 3)
1825 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1827 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1829 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1830 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1831 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1835 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1836 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1837 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1839 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1840 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1841 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1845 af5a81b2 2019-08-08 stsp # stage last hunk
1846 af5a81b2 2019-08-08 stsp printf "n\ny\n" > $testroot/patchscript
1847 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1848 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1850 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1851 af5a81b2 2019-08-08 stsp -----------------------------------------------
1852 fe621944 2020-11-10 stsp @@ -1,5 +1,5 @@
1859 af5a81b2 2019-08-08 stsp -----------------------------------------------
1860 af5a81b2 2019-08-08 stsp M numbers (change 1 of 2)
1861 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1862 af5a81b2 2019-08-08 stsp -----------------------------------------------
1863 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@ b
1869 af5a81b2 2019-08-08 stsp -----------------------------------------------
1870 af5a81b2 2019-08-08 stsp M numbers (change 2 of 2)
1871 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1873 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1875 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1876 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1877 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1881 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1882 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1883 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1885 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1886 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1887 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1891 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1893 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1894 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1895 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1896 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1897 af5a81b2 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
1898 af5a81b2 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1899 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1900 af5a81b2 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1901 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1902 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1903 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1904 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1905 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1906 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1915 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1922 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1924 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1925 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1926 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1930 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1932 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1933 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1934 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1935 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1936 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
1937 af5a81b2 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
1938 af5a81b2 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
1939 af5a81b2 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
1940 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1941 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1942 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1943 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1951 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1953 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1954 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1956 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1959 f6cae3ed 2020-09-13 naddy test_stage_patch_added() {
1960 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_added`
1961 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1963 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1965 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1966 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1970 dc424a06 2019-08-07 stsp echo "new" > $testroot/wt/epsilon/new
1971 dc424a06 2019-08-07 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1973 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
1974 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1975 dc424a06 2019-08-07 stsp epsilon/new > $testroot/stdout)
1977 dc424a06 2019-08-07 stsp echo "A epsilon/new" > $testroot/stdout.expected
1978 c8ede203 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1979 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1981 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1982 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1983 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1987 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1988 dc424a06 2019-08-07 stsp echo " A epsilon/new" > $testroot/stdout.expected
1989 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1991 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1992 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1993 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1997 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1999 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2000 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2001 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2002 dc424a06 2019-08-07 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2003 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2004 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \
2005 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
2006 dc424a06 2019-08-07 stsp echo "--- /dev/null" >> $testroot/stdout.expected
2007 dc424a06 2019-08-07 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
2008 dc424a06 2019-08-07 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
2009 dc424a06 2019-08-07 stsp echo "+new" >> $testroot/stdout.expected
2010 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2012 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2013 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2015 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2018 f6cae3ed 2020-09-13 naddy test_stage_patch_added_twice() {
2019 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_added_twice`
2020 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2022 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2024 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2025 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2029 e70a841e 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
2030 e70a841e 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
2032 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2033 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2034 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout)
2036 e70a841e 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
2037 e70a841e 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
2038 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2040 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2041 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2042 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2046 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2047 e70a841e 2019-08-08 stsp echo " A epsilon/new" > $testroot/stdout.expected
2048 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2050 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2051 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2052 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2056 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2057 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout 2> $testroot/stderr)
2059 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2060 e70a841e 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2061 e70a841e 2019-08-08 stsp test_done "$testroot" "1"
2065 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2066 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2068 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2069 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2070 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2074 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2075 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2077 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2078 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2080 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2083 f6cae3ed 2020-09-13 naddy test_stage_patch_removed() {
2084 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_removed`
2085 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2087 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2089 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2090 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2094 dc424a06 2019-08-07 stsp (cd $testroot/wt && got rm beta > /dev/null)
2096 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
2097 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2098 dc424a06 2019-08-07 stsp beta > $testroot/stdout)
2100 dc424a06 2019-08-07 stsp echo -n > $testroot/stdout.expected
2102 dc424a06 2019-08-07 stsp echo "D beta" > $testroot/stdout.expected
2103 f5a17245 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2104 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2106 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2107 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2108 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2112 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2113 dc424a06 2019-08-07 stsp echo " D beta" > $testroot/stdout.expected
2114 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2116 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2117 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2118 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2122 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2124 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2125 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2126 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2127 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2128 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \
2129 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
2130 dc424a06 2019-08-07 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2131 dc424a06 2019-08-07 stsp echo "--- beta" >> $testroot/stdout.expected
2132 dc424a06 2019-08-07 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
2133 dc424a06 2019-08-07 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
2134 dc424a06 2019-08-07 stsp echo "-beta" >> $testroot/stdout.expected
2135 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2137 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2138 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2140 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2143 f6cae3ed 2020-09-13 naddy test_stage_patch_removed_twice() {
2144 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_removed_twice`
2145 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2147 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2149 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2150 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2154 e70a841e 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
2156 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2157 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2158 e70a841e 2019-08-08 stsp beta > $testroot/stdout)
2160 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2162 e70a841e 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
2163 e70a841e 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2164 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2166 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2167 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2168 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2172 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2173 e70a841e 2019-08-08 stsp echo " D beta" > $testroot/stdout.expected
2174 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2176 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2177 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2178 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2182 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p beta \
2183 e70a841e 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2185 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2186 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
2187 ea4ee74a 2023-06-17 op test_done "$testroot" "1"
2191 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2192 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2194 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2195 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2196 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2200 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2201 9fdde394 2022-06-04 op cmp -s $testroot/stdout.expected $testroot/stdout
2203 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2204 9fdde394 2022-06-04 op diff -u $testroot/stdout.expected $testroot/stdout
2206 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2209 9fdde394 2022-06-04 op test_stage_patch_reversed() {
2210 9fdde394 2022-06-04 op local testroot=`test_init stage_patch_reversed`
2212 9fdde394 2022-06-04 op got checkout $testroot/repo $testroot/wt > /dev/null
2214 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2215 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2219 9fdde394 2022-06-04 op echo 'ALPHA' > $testroot/wt/alpha
2220 9fdde394 2022-06-04 op (cd $testroot/wt && got stage alpha > $testroot/stdout)
2222 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2223 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2227 9fdde394 2022-06-04 op echo ' M alpha' > $testroot/stdout.expected
2228 9fdde394 2022-06-04 op cmp -s $testroot/stdout.expected $testroot/stdout
2230 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2231 9fdde394 2022-06-04 op diff -u $testroot/stdout.expected $testroot/stdout
2232 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2236 9fdde394 2022-06-04 op echo 'alpha' > $testroot/wt/alpha
2237 9fdde394 2022-06-04 op (cd $testroot/wt && got stage alpha > $testroot/stdout)
2239 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2240 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2244 9fdde394 2022-06-04 op echo ' M alpha' > $testroot/stdout.expected
2245 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2247 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2248 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2249 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2253 9fdde394 2022-06-04 op (cd $testroot/wt && got status > $testroot/stdout)
2254 9fdde394 2022-06-04 op cmp -s /dev/null $testroot/stdout
2256 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2257 9fdde394 2022-06-04 op diff -u /dev/null $testroot/stdout
2259 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2262 f6cae3ed 2020-09-13 naddy test_stage_patch_quit() {
2263 b353a198 2019-08-07 stsp local testroot=`test_init stage_patch_quit`
2265 2fed5287 2024-04-09 op seq 16 > $testroot/repo/numbers
2266 88f33a19 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2267 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers zzz
2268 88f33a19 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2269 b353a198 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2271 b353a198 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2273 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2274 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2278 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
2279 885e96df 2023-03-06 naddy ,s/^2$/a/
2280 885e96df 2023-03-06 naddy ,s/^7$/b/
2281 885e96df 2023-03-06 naddy ,s/^16$/c/
2284 88f33a19 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
2286 88f33a19 2019-08-08 stsp # stage first hunk and quit; and don't pass a path argument to
2287 88f33a19 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
2288 88f33a19 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
2289 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R -F $testroot/patchscript -p \
2290 2db2652d 2019-08-07 stsp > $testroot/stdout)
2292 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2293 b353a198 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
2294 b353a198 2019-08-07 stsp test_done "$testroot" "1"
2297 b353a198 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
2298 b353a198 2019-08-07 stsp -----------------------------------------------
2299 b353a198 2019-08-07 stsp @@ -1,5 +1,5 @@
2306 b353a198 2019-08-07 stsp -----------------------------------------------
2307 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
2308 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
2309 b353a198 2019-08-07 stsp -----------------------------------------------
2310 b353a198 2019-08-07 stsp @@ -4,7 +4,7 @@
2319 b353a198 2019-08-07 stsp -----------------------------------------------
2320 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
2321 b353a198 2019-08-07 stsp stage this change? [y/n/q] q
2323 f5a17245 2019-08-08 stsp stage this deletion? [y/n] n
2325 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2327 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2328 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2329 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2333 b353a198 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2334 b353a198 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
2335 88f33a19 2019-08-08 stsp echo "D zzz" >> $testroot/stdout.expected
2336 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2338 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2339 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2340 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2344 b353a198 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2346 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2347 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2348 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2349 b353a198 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2350 b353a198 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
2351 b353a198 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
2352 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2353 b353a198 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2354 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
2355 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2356 b353a198 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
2357 b353a198 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
2358 b353a198 2019-08-07 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
2359 b353a198 2019-08-07 stsp echo " 1" >> $testroot/stdout.expected
2360 b353a198 2019-08-07 stsp echo "-2" >> $testroot/stdout.expected
2361 b353a198 2019-08-07 stsp echo "+a" >> $testroot/stdout.expected
2362 b353a198 2019-08-07 stsp echo " 3" >> $testroot/stdout.expected
2363 b353a198 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
2364 b353a198 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
2365 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2367 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2368 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2370 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2374 f6cae3ed 2020-09-13 naddy test_stage_patch_incomplete_script() {
2375 eba70f38 2019-08-08 stsp local testroot=`test_init stage_incomplete_script`
2377 2fed5287 2024-04-09 op seq 16 > $testroot/repo/numbers
2378 eba70f38 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2379 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers zzz
2380 eba70f38 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2381 eba70f38 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2383 eba70f38 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2385 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2386 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2390 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
2391 885e96df 2023-03-06 naddy ,s/^2$/a/
2392 885e96df 2023-03-06 naddy ,s/^7$/b/
2393 885e96df 2023-03-06 naddy ,s/^16$/c/
2397 eba70f38 2019-08-08 stsp # stage first hunk and then stop responding; got should error out
2398 eba70f38 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2399 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R -F $testroot/patchscript -p \
2400 eba70f38 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2402 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2403 eba70f38 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2404 eba70f38 2019-08-08 stsp test_done "$testroot" "1"
2407 eba70f38 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
2408 eba70f38 2019-08-08 stsp -----------------------------------------------
2409 eba70f38 2019-08-08 stsp @@ -1,5 +1,5 @@
2416 eba70f38 2019-08-08 stsp -----------------------------------------------
2417 eba70f38 2019-08-08 stsp M numbers (change 1 of 3)
2418 eba70f38 2019-08-08 stsp stage this change? [y/n/q] y
2419 eba70f38 2019-08-08 stsp -----------------------------------------------
2420 eba70f38 2019-08-08 stsp @@ -4,7 +4,7 @@
2429 eba70f38 2019-08-08 stsp -----------------------------------------------
2430 eba70f38 2019-08-08 stsp M numbers (change 2 of 3)
2432 eba70f38 2019-08-08 stsp echo -n "stage this change? [y/n/q] " >> $testroot/stdout.expected
2433 eba70f38 2019-08-08 stsp echo "got: invalid patch choice" > $testroot/stderr.expected
2434 eba70f38 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2436 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2437 eba70f38 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2438 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2442 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2444 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2445 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2446 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2450 eba70f38 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2451 eba70f38 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
2452 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2454 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2455 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2456 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2460 eba70f38 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2461 eba70f38 2019-08-08 stsp echo -n > $testroot/stdout.expected
2462 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2464 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2465 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2467 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2471 f6cae3ed 2020-09-13 naddy test_stage_symlink() {
2472 c631b115 2020-07-23 stsp local testroot=`test_init stage_symlink`
2474 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2475 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2476 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2477 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2478 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2479 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2480 c631b115 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2481 c631b115 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2483 c631b115 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2485 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2486 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2490 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2491 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
2492 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2493 c631b115 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2494 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2495 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2496 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2497 c631b115 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2498 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2499 c631b115 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2501 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R > $testroot/stdout 2> $testroot/stderr)
2503 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2504 35213c7c 2020-07-23 stsp echo "got stage succeeded unexpectedly" >&2
2505 a19f439c 2022-06-03 op test_done "$testroot" 1
2508 35213c7c 2020-07-23 stsp echo -n "got: $testroot/wt/dotgotbar.link: " > $testroot/stderr.expected
2509 35213c7c 2020-07-23 stsp echo "symbolic link points outside of paths under version control" \
2510 35213c7c 2020-07-23 stsp >> $testroot/stderr.expected
2511 35213c7c 2020-07-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2513 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2514 35213c7c 2020-07-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
2515 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
2519 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -RS > $testroot/stdout)
2521 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2522 c631b115 2020-07-23 stsp M alpha.link
2523 c631b115 2020-07-23 stsp A dotgotbar.link
2524 c631b115 2020-07-23 stsp A dotgotfoo.link
2525 c631b115 2020-07-23 stsp M epsilon/beta.link
2526 c631b115 2020-07-23 stsp M epsilon.link
2527 c631b115 2020-07-23 stsp D nonexistent.link
2528 c631b115 2020-07-23 stsp A zeta.link
2530 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2532 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2533 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2534 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2538 0aeb8099 2020-07-23 stsp rm $testroot/wt/alpha.link
2539 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2541 c631b115 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2543 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2544 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
2545 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2546 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2547 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2548 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $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 alpha.link) | cut -d' ' -f 1 \
2551 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2552 c631b115 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2553 c631b115 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2554 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2555 c631b115 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2556 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2557 c631b115 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2558 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2559 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2560 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2561 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotbar.link) | cut -d' ' -f 1 \
2562 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2563 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2564 c631b115 2020-07-23 stsp echo '+++ dotgotbar.link' >> $testroot/stdout.expected
2565 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2566 c631b115 2020-07-23 stsp echo '+.got/bar' >> $testroot/stdout.expected
2567 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2568 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2569 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2570 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2571 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2572 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2573 c631b115 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2574 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2575 c631b115 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2576 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2577 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i epsilon | grep 'beta.link@ -> ../beta$' | \
2578 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2579 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2580 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon/beta.link) | cut -d' ' -f 1 \
2581 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2582 c631b115 2020-07-23 stsp echo '--- epsilon/beta.link' >> $testroot/stdout.expected
2583 c631b115 2020-07-23 stsp echo '+++ epsilon/beta.link' >> $testroot/stdout.expected
2584 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2585 c631b115 2020-07-23 stsp echo '-../beta' >> $testroot/stdout.expected
2586 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2587 c631b115 2020-07-23 stsp echo '+../gamma/delta' >> $testroot/stdout.expected
2588 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2589 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2590 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2591 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2592 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2593 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2594 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2595 c631b115 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2596 c631b115 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2597 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2598 c631b115 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2599 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2600 c631b115 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2601 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2602 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2603 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2604 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2605 c631b115 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2606 c631b115 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2607 c631b115 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2608 c631b115 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2609 c631b115 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2610 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2611 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2612 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2613 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2614 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2615 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2616 c631b115 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2617 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2618 c631b115 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2619 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2621 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2623 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2624 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2625 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2629 c631b115 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2630 c631b115 2020-07-23 stsp > $testroot/stdout)
2632 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2633 c631b115 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2634 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2638 c631b115 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2639 c631b115 2020-07-23 stsp echo "A dotgotbar.link" > $testroot/stdout.expected
2640 c631b115 2020-07-23 stsp echo "A dotgotfoo.link" >> $testroot/stdout.expected
2641 c631b115 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2642 c631b115 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2643 c631b115 2020-07-23 stsp echo "M epsilon/beta.link" >> $testroot/stdout.expected
2644 c631b115 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2645 c631b115 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2646 c631b115 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2647 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2649 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2650 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2651 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2655 c631b115 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2657 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2658 c631b115 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2659 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2663 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2665 c631b115 2020-07-23 stsp alpha.link@ -> beta
2667 c631b115 2020-07-23 stsp dotgotbar.link@ -> .got/bar
2668 c631b115 2020-07-23 stsp dotgotfoo.link
2670 c631b115 2020-07-23 stsp epsilon.link@ -> gamma
2672 c631b115 2020-07-23 stsp passwd.link@ -> /etc/passwd
2673 c631b115 2020-07-23 stsp zeta.link@ -> gamma/delta
2675 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2677 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2678 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2682 0aeb8099 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2683 0aeb8099 2020-07-23 stsp echo "alpha.link is a symlink"
2684 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2688 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2689 0aeb8099 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2690 0aeb8099 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2692 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2693 0aeb8099 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2694 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2698 75f0a0fb 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2699 75f0a0fb 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2700 75f0a0fb 2020-07-23 stsp test_done "$testroot" "1"
2703 75f0a0fb 2020-07-23 stsp (cd $testroot/wt && got update > /dev/null)
2704 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2705 c631b115 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2706 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2709 0aeb8099 2020-07-23 stsp echo -n ".got/bar" > $testroot/content.expected
2710 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2711 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2713 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2714 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2715 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2719 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2720 fa3cef63 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2721 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2724 fa3cef63 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2725 fa3cef63 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2726 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2728 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2729 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2730 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2734 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2735 fa3cef63 2020-07-23 stsp echo "epsilon.link is not a symlink"
2736 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2740 fa3cef63 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2741 fa3cef63 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
2742 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2744 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2745 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2746 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2750 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2751 fa3cef63 2020-07-23 stsp echo "passwd.link is a symlink"
2752 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2755 fa3cef63 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2756 fa3cef63 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2757 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2759 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2760 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2761 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2765 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
2766 fa3cef63 2020-07-23 stsp echo "zeta.link is not a symlink"
2767 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2771 fa3cef63 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
2772 fa3cef63 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
2773 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2775 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2776 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2777 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2781 fa3cef63 2020-07-23 stsp test_done "$testroot" "0"
2784 f6cae3ed 2020-09-13 naddy test_stage_patch_symlink() {
2785 fa3cef63 2020-07-23 stsp local testroot=`test_init stage_patch_symlink`
2787 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2788 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2789 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2790 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2791 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2792 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2793 fa3cef63 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2794 fa3cef63 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2796 fa3cef63 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2798 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2799 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2803 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2804 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
2805 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2806 fa3cef63 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2807 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2808 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2809 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2810 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2811 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2812 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2814 fa3cef63 2020-07-23 stsp printf "y\nn\ny\nn\ny\ny\ny" > $testroot/patchscript
2815 bb068081 2024-04-22 stsp (cd $testroot/wt && got stage -R -F $testroot/patchscript -p \
2816 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2818 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2819 fa3cef63 2020-07-23 stsp -----------------------------------------------
2820 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2822 fa3cef63 2020-07-23 stsp \ No newline at end of file
2824 fa3cef63 2020-07-23 stsp \ No newline at end of file
2825 fa3cef63 2020-07-23 stsp -----------------------------------------------
2826 fa3cef63 2020-07-23 stsp M alpha.link (change 1 of 1)
2827 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2828 fa3cef63 2020-07-23 stsp A dotgotbar.link
2829 fa3cef63 2020-07-23 stsp stage this addition? [y/n] n
2830 fa3cef63 2020-07-23 stsp A dotgotfoo.link
2831 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2832 fa3cef63 2020-07-23 stsp -----------------------------------------------
2833 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2835 fa3cef63 2020-07-23 stsp \ No newline at end of file
2836 fa3cef63 2020-07-23 stsp +../gamma/delta
2837 fa3cef63 2020-07-23 stsp \ No newline at end of file
2838 fa3cef63 2020-07-23 stsp -----------------------------------------------
2839 fa3cef63 2020-07-23 stsp M epsilon/beta.link (change 1 of 1)
2840 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] n
2841 fa3cef63 2020-07-23 stsp -----------------------------------------------
2842 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2844 fa3cef63 2020-07-23 stsp \ No newline at end of file
2846 fa3cef63 2020-07-23 stsp \ No newline at end of file
2847 fa3cef63 2020-07-23 stsp -----------------------------------------------
2848 fa3cef63 2020-07-23 stsp M epsilon.link (change 1 of 1)
2849 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2850 fa3cef63 2020-07-23 stsp D nonexistent.link
2851 fa3cef63 2020-07-23 stsp stage this deletion? [y/n] y
2852 fa3cef63 2020-07-23 stsp A zeta.link
2853 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2855 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2857 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2858 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2859 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2863 fa3cef63 2020-07-23 stsp rm $testroot/wt/alpha.link
2864 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2866 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2868 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2869 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
2870 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2871 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2872 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2873 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2874 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2875 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2876 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2877 fa3cef63 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2878 fa3cef63 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2879 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2880 fa3cef63 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2881 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2882 fa3cef63 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2883 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2884 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2885 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2886 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2887 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2888 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2889 fa3cef63 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2890 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2891 fa3cef63 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2892 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2893 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2894 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2895 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2896 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2897 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2898 fa3cef63 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2899 fa3cef63 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2900 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2901 fa3cef63 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2902 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2903 fa3cef63 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2904 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2905 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2906 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2907 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2908 fa3cef63 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2909 fa3cef63 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2910 fa3cef63 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2911 fa3cef63 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2912 fa3cef63 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2913 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2914 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2915 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2916 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2917 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2918 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2919 fa3cef63 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2920 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2921 fa3cef63 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2922 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2924 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2926 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2927 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2928 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2932 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2933 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2935 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2936 fa3cef63 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2937 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2941 fa3cef63 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2942 fa3cef63 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2943 fa3cef63 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2944 fa3cef63 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2945 fa3cef63 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2946 fa3cef63 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2947 fa3cef63 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2948 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2950 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2951 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2952 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2956 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2958 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2959 fa3cef63 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2960 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2964 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2966 fa3cef63 2020-07-23 stsp alpha.link@ -> beta
2968 fa3cef63 2020-07-23 stsp dotgotfoo.link
2970 fa3cef63 2020-07-23 stsp epsilon.link@ -> gamma
2972 fa3cef63 2020-07-23 stsp passwd.link@ -> /etc/passwd
2973 fa3cef63 2020-07-23 stsp zeta.link@ -> gamma/delta
2975 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2977 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2978 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2982 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2983 fa3cef63 2020-07-23 stsp echo "alpha.link is a symlink"
2984 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2988 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2989 fa3cef63 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2990 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2992 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2993 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2994 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2998 fa3cef63 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2999 fa3cef63 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
3000 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
3003 fa3cef63 2020-07-23 stsp readlink $testroot/wt/dotgotbar.link > $testroot/stdout
3004 fa3cef63 2020-07-23 stsp echo ".got/bar" > $testroot/stdout.expected
3005 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3007 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3008 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3009 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
3013 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
3014 c631b115 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
3015 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3018 c631b115 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
3019 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
3020 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
3022 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3023 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
3024 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3028 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
3029 c631b115 2020-07-23 stsp echo "epsilon.link is not a symlink"
3030 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3034 c631b115 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
3035 c631b115 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
3036 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3038 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3039 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3040 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3044 c631b115 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
3045 c631b115 2020-07-23 stsp echo "passwd.link is a symlink"
3046 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3049 c631b115 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
3050 c631b115 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
3051 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
3053 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3054 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
3055 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3059 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
3060 c631b115 2020-07-23 stsp echo "zeta.link is not a symlink"
3061 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3065 c631b115 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
3066 c631b115 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
3067 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3069 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3070 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3071 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3075 c631b115 2020-07-23 stsp test_done "$testroot" "0"
3078 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3079 fccbfb98 2019-08-03 stsp run_test test_stage_basic
3080 f1f83f31 2024-04-22 stsp run_test test_stage_directory
3081 31b20a6e 2019-08-06 stsp run_test test_stage_no_changes
3082 8b13ce36 2019-08-08 stsp run_test test_stage_unversioned
3083 8564cb21 2019-08-08 stsp run_test test_stage_nonexistent
3084 a4f692bb 2019-08-04 stsp run_test test_stage_list
3085 ebf48fd5 2019-08-03 stsp run_test test_stage_conflict
3086 735ef5ac 2019-08-03 stsp run_test test_stage_out_of_date
3087 d3e7c587 2019-08-03 stsp run_test test_double_stage
3088 c363b2c1 2019-08-03 stsp run_test test_stage_status
3089 1e1446d3 2019-08-03 stsp run_test test_stage_add_already_staged_file
3090 9acbc4fa 2019-08-03 stsp run_test test_stage_rm_already_staged_file
3091 24278f30 2019-08-03 stsp run_test test_stage_revert
3092 408b4ebc 2019-08-03 stsp run_test test_stage_diff
3093 b9622844 2019-08-03 stsp run_test test_stage_histedit
3094 243d7cf1 2019-08-03 stsp run_test test_stage_rebase
3095 a76c42e6 2019-08-03 stsp run_test test_stage_update
3096 f0b75401 2019-08-03 stsp run_test test_stage_commit_non_staged
3097 0f1cfa7f 2019-08-08 stsp run_test test_stage_commit_out_of_date
3098 5f8a88c6 2019-08-03 stsp run_test test_stage_commit
3099 dc424a06 2019-08-07 stsp run_test test_stage_patch
3100 af5a81b2 2019-08-08 stsp run_test test_stage_patch_twice
3101 dc424a06 2019-08-07 stsp run_test test_stage_patch_added
3102 e70a841e 2019-08-08 stsp run_test test_stage_patch_added_twice
3103 dc424a06 2019-08-07 stsp run_test test_stage_patch_removed
3104 e70a841e 2019-08-08 stsp run_test test_stage_patch_removed_twice
3105 9fdde394 2022-06-04 op run_test test_stage_patch_reversed
3106 b353a198 2019-08-07 stsp run_test test_stage_patch_quit
3107 eba70f38 2019-08-08 stsp run_test test_stage_patch_incomplete_script
3108 c631b115 2020-07-23 stsp run_test test_stage_symlink
3109 fa3cef63 2020-07-23 stsp run_test test_stage_patch_symlink