Blame


1 fccbfb98 2019-08-03 stsp #!/bin/sh
2 fccbfb98 2019-08-03 stsp #
3 fccbfb98 2019-08-03 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 fccbfb98 2019-08-03 stsp #
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.
8 fccbfb98 2019-08-03 stsp #
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.
16 fccbfb98 2019-08-03 stsp
17 fccbfb98 2019-08-03 stsp . ./common.sh
18 fccbfb98 2019-08-03 stsp
19 c861864b 2022-01-03 stsp # disable automatic packing for these tests
20 c861864b 2022-01-03 stsp export GOT_TEST_PACK=""
21 c861864b 2022-01-03 stsp
22 f6cae3ed 2020-09-13 naddy test_stage_basic() {
23 fccbfb98 2019-08-03 stsp local testroot=`test_init stage_basic`
24 fccbfb98 2019-08-03 stsp
25 fccbfb98 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
26 49c543a6 2022-03-31 naddy ret=$?
27 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
28 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
29 fccbfb98 2019-08-03 stsp return 1
30 fccbfb98 2019-08-03 stsp fi
31 fccbfb98 2019-08-03 stsp
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)
36 fccbfb98 2019-08-03 stsp
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 ec9d9b2f 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
41 d3e7c587 2019-08-03 stsp
42 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
43 49c543a6 2022-03-31 naddy ret=$?
44 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
45 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
46 d3e7c587 2019-08-03 stsp fi
47 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
48 d3e7c587 2019-08-03 stsp }
49 d3e7c587 2019-08-03 stsp
50 f6cae3ed 2020-09-13 naddy test_stage_no_changes() {
51 31b20a6e 2019-08-06 stsp local testroot=`test_init stage_no_changes`
52 31b20a6e 2019-08-06 stsp
53 31b20a6e 2019-08-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
54 49c543a6 2022-03-31 naddy ret=$?
55 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
56 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
57 31b20a6e 2019-08-06 stsp return 1
58 31b20a6e 2019-08-06 stsp fi
59 31b20a6e 2019-08-06 stsp
60 31b20a6e 2019-08-06 stsp (cd $testroot/wt && got stage alpha beta > $testroot/stdout \
61 31b20a6e 2019-08-06 stsp 2> $testroot/stderr)
62 49c543a6 2022-03-31 naddy ret=$?
63 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
64 31b20a6e 2019-08-06 stsp echo "got stage command succeeded unexpectedly" >&2
65 31b20a6e 2019-08-06 stsp test_done "$testroot" "1"
66 31b20a6e 2019-08-06 stsp return 1
67 31b20a6e 2019-08-06 stsp fi
68 31b20a6e 2019-08-06 stsp
69 2db2652d 2019-08-07 stsp echo "got: no changes to stage" > $testroot/stderr.expected
70 31b20a6e 2019-08-06 stsp
71 31b20a6e 2019-08-06 stsp cmp -s $testroot/stderr.expected $testroot/stderr
72 49c543a6 2022-03-31 naddy ret=$?
73 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
74 31b20a6e 2019-08-06 stsp diff -u $testroot/stderr.expected $testroot/stderr
75 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
76 31b20a6e 2019-08-06 stsp return 1
77 31b20a6e 2019-08-06 stsp fi
78 31b20a6e 2019-08-06 stsp
79 31b20a6e 2019-08-06 stsp echo -n > $testroot/stdout.expected
80 31b20a6e 2019-08-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
81 49c543a6 2022-03-31 naddy ret=$?
82 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
83 31b20a6e 2019-08-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
84 31b20a6e 2019-08-06 stsp fi
85 31b20a6e 2019-08-06 stsp test_done "$testroot" "$ret"
86 31b20a6e 2019-08-06 stsp }
87 31b20a6e 2019-08-06 stsp
88 f6cae3ed 2020-09-13 naddy test_stage_unversioned() {
89 8b13ce36 2019-08-08 stsp local testroot=`test_init stage_unversioned`
90 8b13ce36 2019-08-08 stsp
91 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
92 49c543a6 2022-03-31 naddy ret=$?
93 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
94 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
95 8b13ce36 2019-08-08 stsp return 1
96 8b13ce36 2019-08-08 stsp fi
97 8b13ce36 2019-08-08 stsp
98 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
99 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
100 8b13ce36 2019-08-08 stsp
101 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
102 8b13ce36 2019-08-08 stsp echo "M alpha" > $testroot/stdout.expected
103 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
104 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
105 49c543a6 2022-03-31 naddy ret=$?
106 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
107 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
108 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
109 8b13ce36 2019-08-08 stsp return 1
110 8b13ce36 2019-08-08 stsp fi
111 8b13ce36 2019-08-08 stsp
112 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage > $testroot/stdout)
113 49c543a6 2022-03-31 naddy ret=$?
114 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
115 8b13ce36 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
116 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
117 8b13ce36 2019-08-08 stsp return 1
118 8b13ce36 2019-08-08 stsp fi
119 8b13ce36 2019-08-08 stsp
120 8b13ce36 2019-08-08 stsp echo " M alpha" > $testroot/stdout.expected
121 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
122 49c543a6 2022-03-31 naddy ret=$?
123 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
124 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
125 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
126 8b13ce36 2019-08-08 stsp return 1
127 8b13ce36 2019-08-08 stsp fi
128 8b13ce36 2019-08-08 stsp
129 8b13ce36 2019-08-08 stsp echo "modified file again" > $testroot/wt/alpha
130 8b13ce36 2019-08-08 stsp
131 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage unversioned-file > $testroot/stdout \
132 8b13ce36 2019-08-08 stsp 2> $testroot/stderr)
133 49c543a6 2022-03-31 naddy ret=$?
134 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
135 8b13ce36 2019-08-08 stsp echo "got stage command succeed unexpectedly" >&2
136 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
137 8b13ce36 2019-08-08 stsp return 1
138 8b13ce36 2019-08-08 stsp fi
139 8b13ce36 2019-08-08 stsp
140 8b13ce36 2019-08-08 stsp echo "got: no changes to stage" > $testroot/stderr.expected
141 8b13ce36 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
142 49c543a6 2022-03-31 naddy ret=$?
143 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
144 8b13ce36 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
145 8b13ce36 2019-08-08 stsp fi
146 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
147 8564cb21 2019-08-08 stsp
148 8564cb21 2019-08-08 stsp }
149 8564cb21 2019-08-08 stsp
150 f6cae3ed 2020-09-13 naddy test_stage_nonexistent() {
151 8564cb21 2019-08-08 stsp local testroot=`test_init stage_nonexistent`
152 8564cb21 2019-08-08 stsp
153 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
154 49c543a6 2022-03-31 naddy ret=$?
155 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
156 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
157 8564cb21 2019-08-08 stsp return 1
158 8564cb21 2019-08-08 stsp fi
159 8b13ce36 2019-08-08 stsp
160 8564cb21 2019-08-08 stsp (cd $testroot/wt && got stage nonexistent-file \
161 8564cb21 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
162 2a06fe5f 2019-08-24 stsp echo "got: nonexistent-file: No such file or directory" \
163 2a06fe5f 2019-08-24 stsp > $testroot/stderr.expected
164 8564cb21 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
165 49c543a6 2022-03-31 naddy ret=$?
166 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
167 8564cb21 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
168 8564cb21 2019-08-08 stsp fi
169 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
170 8b13ce36 2019-08-08 stsp }
171 8b13ce36 2019-08-08 stsp
172 f6cae3ed 2020-09-13 naddy test_stage_list() {
173 a4f692bb 2019-08-04 stsp local testroot=`test_init stage_list`
174 a4f692bb 2019-08-04 stsp
175 a4f692bb 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
176 49c543a6 2022-03-31 naddy ret=$?
177 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
178 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
179 a4f692bb 2019-08-04 stsp return 1
180 a4f692bb 2019-08-04 stsp fi
181 a4f692bb 2019-08-04 stsp
182 a4f692bb 2019-08-04 stsp echo "modified file" > $testroot/wt/alpha
183 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got rm beta > /dev/null)
184 a4f692bb 2019-08-04 stsp echo "new file" > $testroot/wt/foo
185 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got add foo > /dev/null)
186 a4f692bb 2019-08-04 stsp
187 a4f692bb 2019-08-04 stsp echo ' M alpha' > $testroot/stdout.expected
188 a4f692bb 2019-08-04 stsp echo ' D beta' >> $testroot/stdout.expected
189 a4f692bb 2019-08-04 stsp echo ' A foo' >> $testroot/stdout.expected
190 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
191 a4f692bb 2019-08-04 stsp
192 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l > $testroot/stdout)
193 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
194 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
195 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
196 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s beta | grep '^blob -' | \
197 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
198 a4f692bb 2019-08-04 stsp echo " D beta" >> $testroot/stdout.expected
199 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s foo | grep '^blob +' | \
200 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' >> $testroot/stdout.expected)
201 a4f692bb 2019-08-04 stsp echo " A foo" >> $testroot/stdout.expected
202 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
203 49c543a6 2022-03-31 naddy ret=$?
204 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
205 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
206 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
207 a4f692bb 2019-08-04 stsp return 1
208 a4f692bb 2019-08-04 stsp fi
209 a4f692bb 2019-08-04 stsp
210 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l epsilon nonexistent \
211 a4f692bb 2019-08-04 stsp > $testroot/stdout)
212 a4f692bb 2019-08-04 stsp
213 a4f692bb 2019-08-04 stsp echo -n > $testroot/stdout.expected
214 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
215 49c543a6 2022-03-31 naddy ret=$?
216 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
217 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
218 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
219 a4f692bb 2019-08-04 stsp return 1
220 a4f692bb 2019-08-04 stsp fi
221 a4f692bb 2019-08-04 stsp
222 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got stage -l alpha > $testroot/stdout)
223 a4f692bb 2019-08-04 stsp
224 a4f692bb 2019-08-04 stsp (cd $testroot/wt && got diff -s alpha | grep '^blob +' | \
225 a4f692bb 2019-08-04 stsp cut -d' ' -f3 | tr -d '\n' > $testroot/stdout.expected)
226 a4f692bb 2019-08-04 stsp echo " M alpha" >> $testroot/stdout.expected
227 a4f692bb 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
228 49c543a6 2022-03-31 naddy ret=$?
229 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
230 a4f692bb 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
231 a4f692bb 2019-08-04 stsp fi
232 a4f692bb 2019-08-04 stsp test_done "$testroot" "$ret"
233 a4f692bb 2019-08-04 stsp
234 a4f692bb 2019-08-04 stsp }
235 a4f692bb 2019-08-04 stsp
236 f6cae3ed 2020-09-13 naddy test_stage_conflict() {
237 ebf48fd5 2019-08-03 stsp local testroot=`test_init stage_conflict`
238 ebf48fd5 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
239 ebf48fd5 2019-08-03 stsp
240 ebf48fd5 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
241 49c543a6 2022-03-31 naddy ret=$?
242 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
243 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
244 ebf48fd5 2019-08-03 stsp return 1
245 ebf48fd5 2019-08-03 stsp fi
246 ebf48fd5 2019-08-03 stsp
247 ebf48fd5 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
248 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
249 ebf48fd5 2019-08-03 stsp
250 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
251 ebf48fd5 2019-08-03 stsp
252 ebf48fd5 2019-08-03 stsp echo "modified alpha, too" > $testroot/wt/alpha
253 ebf48fd5 2019-08-03 stsp
254 ebf48fd5 2019-08-03 stsp echo "C alpha" > $testroot/stdout.expected
255 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
256 ebf48fd5 2019-08-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
257 ebf48fd5 2019-08-03 stsp echo >> $testroot/stdout.expected
258 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
259 ebf48fd5 2019-08-03 stsp
260 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout)
261 ebf48fd5 2019-08-03 stsp
262 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
263 49c543a6 2022-03-31 naddy ret=$?
264 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
265 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
267 ebf48fd5 2019-08-03 stsp return 1
268 ebf48fd5 2019-08-03 stsp fi
269 ebf48fd5 2019-08-03 stsp
270 ebf48fd5 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
271 ebf48fd5 2019-08-03 stsp 2> $testroot/stderr)
272 49c543a6 2022-03-31 naddy ret=$?
273 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
274 ebf48fd5 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
275 ebf48fd5 2019-08-03 stsp test_done "$testroot" "1"
276 ebf48fd5 2019-08-03 stsp return 1
277 ebf48fd5 2019-08-03 stsp fi
278 ebf48fd5 2019-08-03 stsp
279 ebf48fd5 2019-08-03 stsp echo -n > $testroot/stdout.expected
280 ebf48fd5 2019-08-03 stsp echo "got: alpha: cannot stage file in conflicted status" \
281 735ef5ac 2019-08-03 stsp > $testroot/stderr.expected
282 735ef5ac 2019-08-03 stsp
283 735ef5ac 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
284 49c543a6 2022-03-31 naddy ret=$?
285 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
286 735ef5ac 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
287 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
288 735ef5ac 2019-08-03 stsp return 1
289 735ef5ac 2019-08-03 stsp fi
290 735ef5ac 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
291 49c543a6 2022-03-31 naddy ret=$?
292 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
293 735ef5ac 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
294 735ef5ac 2019-08-03 stsp fi
295 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
296 735ef5ac 2019-08-03 stsp }
297 735ef5ac 2019-08-03 stsp
298 f6cae3ed 2020-09-13 naddy test_stage_out_of_date() {
299 735ef5ac 2019-08-03 stsp local testroot=`test_init stage_out_of_date`
300 735ef5ac 2019-08-03 stsp local initial_commit=`git_show_head $testroot/repo`
301 735ef5ac 2019-08-03 stsp
302 735ef5ac 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
303 49c543a6 2022-03-31 naddy ret=$?
304 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
305 735ef5ac 2019-08-03 stsp test_done "$testroot" "$ret"
306 735ef5ac 2019-08-03 stsp return 1
307 735ef5ac 2019-08-03 stsp fi
308 735ef5ac 2019-08-03 stsp
309 735ef5ac 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
310 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
311 735ef5ac 2019-08-03 stsp
312 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got update -c $initial_commit > /dev/null)
313 735ef5ac 2019-08-03 stsp
314 735ef5ac 2019-08-03 stsp echo "modified alpha again" > $testroot/wt/alpha
315 735ef5ac 2019-08-03 stsp (cd $testroot/wt && got stage alpha > $testroot/stdout \
316 735ef5ac 2019-08-03 stsp 2> $testroot/stderr)
317 49c543a6 2022-03-31 naddy ret=$?
318 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
319 735ef5ac 2019-08-03 stsp echo "got stage command succeeded unexpectedly" >&2
320 735ef5ac 2019-08-03 stsp test_done "$testroot" "1"
321 735ef5ac 2019-08-03 stsp return 1
322 735ef5ac 2019-08-03 stsp fi
323 735ef5ac 2019-08-03 stsp
324 735ef5ac 2019-08-03 stsp echo -n > $testroot/stdout.expected
325 735ef5ac 2019-08-03 stsp echo "got: work tree must be updated before changes can be staged" \
326 ebf48fd5 2019-08-03 stsp > $testroot/stderr.expected
327 ebf48fd5 2019-08-03 stsp
328 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
329 49c543a6 2022-03-31 naddy ret=$?
330 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
331 ebf48fd5 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
332 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
333 ebf48fd5 2019-08-03 stsp return 1
334 ebf48fd5 2019-08-03 stsp fi
335 ebf48fd5 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
336 49c543a6 2022-03-31 naddy ret=$?
337 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
338 ebf48fd5 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
339 ebf48fd5 2019-08-03 stsp fi
340 ebf48fd5 2019-08-03 stsp test_done "$testroot" "$ret"
341 ebf48fd5 2019-08-03 stsp }
342 ebf48fd5 2019-08-03 stsp
343 ebf48fd5 2019-08-03 stsp
344 f6cae3ed 2020-09-13 naddy test_double_stage() {
345 d3e7c587 2019-08-03 stsp local testroot=`test_init double_stage`
346 d3e7c587 2019-08-03 stsp
347 d3e7c587 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
348 49c543a6 2022-03-31 naddy ret=$?
349 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
350 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
351 d3e7c587 2019-08-03 stsp return 1
352 d3e7c587 2019-08-03 stsp fi
353 d3e7c587 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
354 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
355 d3e7c587 2019-08-03 stsp echo "new file" > $testroot/wt/foo
356 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
357 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
358 d3e7c587 2019-08-03 stsp
359 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
360 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage alpha 2> $testroot/stderr)
361 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
362 49c543a6 2022-03-31 naddy ret=$?
363 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
364 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
365 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
366 d3e7c587 2019-08-03 stsp return 1
367 d3e7c587 2019-08-03 stsp fi
368 d3e7c587 2019-08-03 stsp
369 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage beta \
370 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
371 49c543a6 2022-03-31 naddy ret=$?
372 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
373 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
374 7b5dc508 2019-10-28 stsp test_done "$testroot" "1"
375 7b5dc508 2019-10-28 stsp return 1
376 7b5dc508 2019-10-28 stsp fi
377 7b5dc508 2019-10-28 stsp echo -n > $testroot/stdout.expected
378 7b5dc508 2019-10-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
379 49c543a6 2022-03-31 naddy ret=$?
380 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
381 7b5dc508 2019-10-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
382 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
383 7b5dc508 2019-10-28 stsp return 1
384 7b5dc508 2019-10-28 stsp fi
385 7b5dc508 2019-10-28 stsp
386 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
387 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
388 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
389 49c543a6 2022-03-31 naddy ret=$?
390 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
391 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
392 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
393 7b5dc508 2019-10-28 stsp return 1
394 7b5dc508 2019-10-28 stsp fi
395 7b5dc508 2019-10-28 stsp
396 7b5dc508 2019-10-28 stsp printf "q\n" > $testroot/patchscript
397 7b5dc508 2019-10-28 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
398 7b5dc508 2019-10-28 stsp > $testroot/stdout 2> $testroot/stderr)
399 49c543a6 2022-03-31 naddy ret=$?
400 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
401 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
402 d3e7c587 2019-08-03 stsp test_done "$testroot" "1"
403 d3e7c587 2019-08-03 stsp return 1
404 d3e7c587 2019-08-03 stsp fi
405 d3e7c587 2019-08-03 stsp echo -n > $testroot/stdout.expected
406 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
407 49c543a6 2022-03-31 naddy ret=$?
408 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
409 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
410 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
411 d3e7c587 2019-08-03 stsp return 1
412 d3e7c587 2019-08-03 stsp fi
413 d3e7c587 2019-08-03 stsp
414 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
415 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got stage foo 2> $testroot/stderr)
416 d3e7c587 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
417 49c543a6 2022-03-31 naddy ret=$?
418 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
419 d3e7c587 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
420 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
421 d3e7c587 2019-08-03 stsp return 1
422 d3e7c587 2019-08-03 stsp fi
423 d3e7c587 2019-08-03 stsp
424 d3e7c587 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
425 d3e7c587 2019-08-03 stsp echo "modified new file" > $testroot/wt/foo
426 d3e7c587 2019-08-03 stsp
427 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
428 88d0e355 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
429 fccbfb98 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
430 d3e7c587 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
431 49c543a6 2022-03-31 naddy ret=$?
432 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
433 d3e7c587 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
434 d3e7c587 2019-08-03 stsp test_done "$testroot" "$ret"
435 d3e7c587 2019-08-03 stsp return 1
436 d3e7c587 2019-08-03 stsp fi
437 d3e7c587 2019-08-03 stsp
438 d3e7c587 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
439 d3e7c587 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
440 d3e7c587 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
441 fccbfb98 2019-08-03 stsp
442 d3e7c587 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
443 fccbfb98 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
444 49c543a6 2022-03-31 naddy ret=$?
445 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
446 fccbfb98 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
447 fccbfb98 2019-08-03 stsp fi
448 fccbfb98 2019-08-03 stsp test_done "$testroot" "$ret"
449 fccbfb98 2019-08-03 stsp }
450 fccbfb98 2019-08-03 stsp
451 f6cae3ed 2020-09-13 naddy test_stage_status() {
452 c363b2c1 2019-08-03 stsp local testroot=`test_init stage_status`
453 c363b2c1 2019-08-03 stsp
454 c363b2c1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
455 49c543a6 2022-03-31 naddy ret=$?
456 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
457 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
458 c363b2c1 2019-08-03 stsp return 1
459 c363b2c1 2019-08-03 stsp fi
460 c363b2c1 2019-08-03 stsp
461 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
462 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
463 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/foo
464 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
465 c363b2c1 2019-08-03 stsp echo "new file" > $testroot/wt/epsilon/new
466 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
467 c363b2c1 2019-08-03 stsp echo "modified file" > $testroot/wt/epsilon/zeta
468 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got rm gamma/delta > /dev/null)
469 c363b2c1 2019-08-03 stsp
470 c363b2c1 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
471 c363b2c1 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
472 c363b2c1 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
473 c363b2c1 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
474 c363b2c1 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
475 c363b2c1 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
476 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
477 c363b2c1 2019-08-03 stsp
478 c363b2c1 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
479 c363b2c1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
480 49c543a6 2022-03-31 naddy ret=$?
481 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
482 c363b2c1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
483 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
484 244725f2 2019-08-03 stsp return 1
485 c363b2c1 2019-08-03 stsp fi
486 244725f2 2019-08-03 stsp
487 244725f2 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
488 244725f2 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
489 244725f2 2019-08-03 stsp
490 244725f2 2019-08-03 stsp echo 'MM alpha' > $testroot/stdout.expected
491 244725f2 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
492 244725f2 2019-08-03 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
493 244725f2 2019-08-03 stsp echo 'M epsilon/zeta' >> $testroot/stdout.expected
494 244725f2 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
495 244725f2 2019-08-03 stsp echo 'D gamma/delta' >> $testroot/stdout.expected
496 244725f2 2019-08-03 stsp
497 244725f2 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
498 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
499 49c543a6 2022-03-31 naddy ret=$?
500 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
501 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
502 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
503 244725f2 2019-08-03 stsp return 1
504 244725f2 2019-08-03 stsp fi
505 244725f2 2019-08-03 stsp
506 244725f2 2019-08-03 stsp # test no-op change of added file with new stat(2) timestamp
507 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/foo
508 244725f2 2019-08-03 stsp echo ' A foo' > $testroot/stdout.expected
509 244725f2 2019-08-03 stsp (cd $testroot/wt && got status foo > $testroot/stdout)
510 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
511 49c543a6 2022-03-31 naddy ret=$?
512 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
513 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
514 244725f2 2019-08-03 stsp test_done "$testroot" "$ret"
515 244725f2 2019-08-03 stsp return 1
516 244725f2 2019-08-03 stsp fi
517 244725f2 2019-08-03 stsp
518 244725f2 2019-08-03 stsp # test staged deleted file which is restored on disk
519 244725f2 2019-08-03 stsp echo "new file" > $testroot/wt/beta
520 244725f2 2019-08-03 stsp echo ' D beta' > $testroot/stdout.expected
521 244725f2 2019-08-03 stsp (cd $testroot/wt && got status beta > $testroot/stdout)
522 244725f2 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
523 49c543a6 2022-03-31 naddy ret=$?
524 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
525 244725f2 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
526 244725f2 2019-08-03 stsp fi
527 c363b2c1 2019-08-03 stsp test_done "$testroot" "$ret"
528 244725f2 2019-08-03 stsp
529 c363b2c1 2019-08-03 stsp }
530 c363b2c1 2019-08-03 stsp
531 f6cae3ed 2020-09-13 naddy test_stage_add_already_staged_file() {
532 1e1446d3 2019-08-03 stsp local testroot=`test_init stage_add_already_staged_file`
533 1e1446d3 2019-08-03 stsp
534 1e1446d3 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
535 49c543a6 2022-03-31 naddy ret=$?
536 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
537 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
538 1e1446d3 2019-08-03 stsp return 1
539 1e1446d3 2019-08-03 stsp fi
540 1e1446d3 2019-08-03 stsp
541 1e1446d3 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
542 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
543 1e1446d3 2019-08-03 stsp echo "new file" > $testroot/wt/foo
544 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
545 1e1446d3 2019-08-03 stsp
546 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
547 1e1446d3 2019-08-03 stsp
548 1e1446d3 2019-08-03 stsp echo -n > $testroot/stdout.expected
549 6d022e97 2019-08-04 stsp for f in alpha beta foo; do
550 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got add $f \
551 1e1446d3 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
552 6d022e97 2019-08-04 stsp echo "got: $f: file has unexpected status" \
553 6d022e97 2019-08-04 stsp > $testroot/stderr.expected
554 6d022e97 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
555 49c543a6 2022-03-31 naddy ret=$?
556 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
557 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
558 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
559 1e1446d3 2019-08-03 stsp return 1
560 1e1446d3 2019-08-03 stsp fi
561 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
562 49c543a6 2022-03-31 naddy ret=$?
563 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
564 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
565 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
566 1e1446d3 2019-08-03 stsp return 1
567 1e1446d3 2019-08-03 stsp fi
568 1e1446d3 2019-08-03 stsp done
569 1e1446d3 2019-08-03 stsp
570 1e1446d3 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
571 1e1446d3 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
572 1e1446d3 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
573 1e1446d3 2019-08-03 stsp
574 1e1446d3 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
575 1e1446d3 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
576 49c543a6 2022-03-31 naddy ret=$?
577 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
578 1e1446d3 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
579 1e1446d3 2019-08-03 stsp fi
580 1e1446d3 2019-08-03 stsp test_done "$testroot" "$ret"
581 1e1446d3 2019-08-03 stsp }
582 1e1446d3 2019-08-03 stsp
583 f6cae3ed 2020-09-13 naddy test_stage_rm_already_staged_file() {
584 9acbc4fa 2019-08-03 stsp local testroot=`test_init stage_rm_already_staged_file`
585 9acbc4fa 2019-08-03 stsp
586 9acbc4fa 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
587 49c543a6 2022-03-31 naddy ret=$?
588 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
589 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
590 9acbc4fa 2019-08-03 stsp return 1
591 9acbc4fa 2019-08-03 stsp fi
592 9acbc4fa 2019-08-03 stsp
593 9acbc4fa 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
594 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
595 9acbc4fa 2019-08-03 stsp echo "new file" > $testroot/wt/foo
596 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
597 9acbc4fa 2019-08-03 stsp
598 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > $testroot/stdout)
599 9acbc4fa 2019-08-03 stsp
600 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm beta \
601 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
602 49c543a6 2022-03-31 naddy ret=$?
603 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
604 6d022e97 2019-08-04 stsp echo "got rm command failed unexpectedly" >&2
605 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
606 9acbc4fa 2019-08-03 stsp return 1
607 9acbc4fa 2019-08-03 stsp fi
608 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
609 6d022e97 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
610 49c543a6 2022-03-31 naddy ret=$?
611 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
612 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
613 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
614 6d022e97 2019-08-04 stsp return 1
615 6d022e97 2019-08-04 stsp fi
616 6d022e97 2019-08-04 stsp echo -n > $testroot/stderr.expected
617 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
618 49c543a6 2022-03-31 naddy ret=$?
619 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
620 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
621 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
622 9acbc4fa 2019-08-03 stsp return 1
623 9acbc4fa 2019-08-03 stsp fi
624 9acbc4fa 2019-08-03 stsp
625 9acbc4fa 2019-08-03 stsp for f in alpha foo; do
626 24278f30 2019-08-03 stsp echo "got: $f: file is staged" > $testroot/stderr.expected
627 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got rm $f \
628 9acbc4fa 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
629 49c543a6 2022-03-31 naddy ret=$?
630 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
631 9acbc4fa 2019-08-03 stsp echo "got rm command succeeded unexpectedly" >&2
632 9acbc4fa 2019-08-03 stsp test_done "$testroot" "1"
633 9acbc4fa 2019-08-03 stsp return 1
634 9acbc4fa 2019-08-03 stsp fi
635 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
636 49c543a6 2022-03-31 naddy ret=$?
637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
638 9acbc4fa 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
639 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
640 9acbc4fa 2019-08-03 stsp return 1
641 9acbc4fa 2019-08-03 stsp fi
642 9acbc4fa 2019-08-03 stsp done
643 9acbc4fa 2019-08-03 stsp
644 9acbc4fa 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
645 9acbc4fa 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
646 9acbc4fa 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
647 9acbc4fa 2019-08-03 stsp
648 9acbc4fa 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
649 9acbc4fa 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
650 49c543a6 2022-03-31 naddy ret=$?
651 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
652 9acbc4fa 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
653 9acbc4fa 2019-08-03 stsp fi
654 9acbc4fa 2019-08-03 stsp test_done "$testroot" "$ret"
655 9acbc4fa 2019-08-03 stsp }
656 24278f30 2019-08-03 stsp
657 f6cae3ed 2020-09-13 naddy test_stage_revert() {
658 24278f30 2019-08-03 stsp local testroot=`test_init stage_revert`
659 24278f30 2019-08-03 stsp
660 24278f30 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
661 49c543a6 2022-03-31 naddy ret=$?
662 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
663 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
664 24278f30 2019-08-03 stsp return 1
665 24278f30 2019-08-03 stsp fi
666 24278f30 2019-08-03 stsp
667 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
668 24278f30 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
669 24278f30 2019-08-03 stsp echo "new file" > $testroot/wt/foo
670 24278f30 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
671 24278f30 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
672 24278f30 2019-08-03 stsp
673 24278f30 2019-08-03 stsp echo "modified file again" >> $testroot/wt/alpha
674 24278f30 2019-08-03 stsp echo "modified added file again" >> $testroot/wt/foo
675 24278f30 2019-08-03 stsp
676 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
677 49c543a6 2022-03-31 naddy ret=$?
678 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
679 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
680 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
681 24278f30 2019-08-03 stsp return 1
682 24278f30 2019-08-03 stsp fi
683 24278f30 2019-08-03 stsp
684 24278f30 2019-08-03 stsp echo "R alpha" > $testroot/stdout.expected
685 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
686 49c543a6 2022-03-31 naddy ret=$?
687 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
688 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
689 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
690 24278f30 2019-08-03 stsp return 1
691 24278f30 2019-08-03 stsp fi
692 24278f30 2019-08-03 stsp
693 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
694 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
695 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
696 49c543a6 2022-03-31 naddy ret=$?
697 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
698 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
699 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
700 24278f30 2019-08-03 stsp return 1
701 24278f30 2019-08-03 stsp fi
702 9acbc4fa 2019-08-03 stsp
703 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
704 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
705 24278f30 2019-08-03 stsp echo 'MA foo' >> $testroot/stdout.expected
706 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
707 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
708 49c543a6 2022-03-31 naddy ret=$?
709 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
710 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
711 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
712 24278f30 2019-08-03 stsp return 1
713 24278f30 2019-08-03 stsp fi
714 24278f30 2019-08-03 stsp
715 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert alpha > $testroot/stdout)
716 49c543a6 2022-03-31 naddy ret=$?
717 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
718 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
719 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
720 24278f30 2019-08-03 stsp return 1
721 24278f30 2019-08-03 stsp fi
722 24278f30 2019-08-03 stsp
723 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
724 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
725 49c543a6 2022-03-31 naddy ret=$?
726 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
727 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
728 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
729 24278f30 2019-08-03 stsp return 1
730 24278f30 2019-08-03 stsp fi
731 24278f30 2019-08-03 stsp
732 24278f30 2019-08-03 stsp echo "modified alpha" > $testroot/content.expected
733 24278f30 2019-08-03 stsp cat $testroot/wt/alpha > $testroot/content
734 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
735 49c543a6 2022-03-31 naddy ret=$?
736 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
737 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
738 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
739 24278f30 2019-08-03 stsp return 1
740 24278f30 2019-08-03 stsp fi
741 24278f30 2019-08-03 stsp
742 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert beta > $testroot/stdout \
743 24278f30 2019-08-03 stsp 2> $testroot/stderr)
744 49c543a6 2022-03-31 naddy ret=$?
745 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
746 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
747 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
748 24278f30 2019-08-03 stsp return 1
749 24278f30 2019-08-03 stsp fi
750 24278f30 2019-08-03 stsp
751 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stdout.expected
752 d3bcc3d1 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
753 49c543a6 2022-03-31 naddy ret=$?
754 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
755 d3bcc3d1 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
756 d3bcc3d1 2019-08-08 stsp test_done "$testroot" "$ret"
757 d3bcc3d1 2019-08-08 stsp return 1
758 d3bcc3d1 2019-08-08 stsp fi
759 d3bcc3d1 2019-08-08 stsp
760 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
761 24278f30 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
762 49c543a6 2022-03-31 naddy ret=$?
763 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
764 24278f30 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
765 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
766 24278f30 2019-08-03 stsp return 1
767 24278f30 2019-08-03 stsp fi
768 24278f30 2019-08-03 stsp
769 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
770 49c543a6 2022-03-31 naddy ret=$?
771 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
772 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
773 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
774 24278f30 2019-08-03 stsp return 1
775 24278f30 2019-08-03 stsp fi
776 24278f30 2019-08-03 stsp
777 24278f30 2019-08-03 stsp echo "R foo" > $testroot/stdout.expected
778 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
779 49c543a6 2022-03-31 naddy ret=$?
780 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
781 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
782 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
783 24278f30 2019-08-03 stsp return 1
784 24278f30 2019-08-03 stsp fi
785 24278f30 2019-08-03 stsp
786 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
787 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
788 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
789 49c543a6 2022-03-31 naddy ret=$?
790 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
791 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
792 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
793 24278f30 2019-08-03 stsp return 1
794 24278f30 2019-08-03 stsp fi
795 24278f30 2019-08-03 stsp
796 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
797 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
798 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
799 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
800 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
801 49c543a6 2022-03-31 naddy ret=$?
802 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
803 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
804 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
805 24278f30 2019-08-03 stsp return 1
806 24278f30 2019-08-03 stsp fi
807 24278f30 2019-08-03 stsp
808 24278f30 2019-08-03 stsp (cd $testroot/wt && got revert foo > $testroot/stdout)
809 49c543a6 2022-03-31 naddy ret=$?
810 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
811 24278f30 2019-08-03 stsp echo "revert command failed unexpectedly" >&2
812 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
813 24278f30 2019-08-03 stsp return 1
814 24278f30 2019-08-03 stsp fi
815 24278f30 2019-08-03 stsp
816 24278f30 2019-08-03 stsp echo -n > $testroot/stdout.expected
817 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
818 49c543a6 2022-03-31 naddy ret=$?
819 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
820 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
821 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
822 24278f30 2019-08-03 stsp return 1
823 24278f30 2019-08-03 stsp fi
824 24278f30 2019-08-03 stsp
825 24278f30 2019-08-03 stsp echo "new file" > $testroot/content.expected
826 24278f30 2019-08-03 stsp cat $testroot/wt/foo > $testroot/content
827 24278f30 2019-08-03 stsp cmp -s $testroot/content.expected $testroot/content
828 49c543a6 2022-03-31 naddy ret=$?
829 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
830 24278f30 2019-08-03 stsp diff -u $testroot/content.expected $testroot/content
831 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
832 24278f30 2019-08-03 stsp return 1
833 24278f30 2019-08-03 stsp fi
834 24278f30 2019-08-03 stsp
835 24278f30 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
836 24278f30 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
837 24278f30 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
838 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
839 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
840 49c543a6 2022-03-31 naddy ret=$?
841 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
842 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
843 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
844 0f6d7415 2019-08-08 stsp return 1
845 0f6d7415 2019-08-08 stsp fi
846 0f6d7415 2019-08-08 stsp
847 0f6d7415 2019-08-08 stsp echo "modified file again" >> $testroot/wt/alpha
848 0f6d7415 2019-08-08 stsp echo "modified added file again" >> $testroot/wt/foo
849 0f6d7415 2019-08-08 stsp
850 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout \
851 0f6d7415 2019-08-08 stsp 2> $testroot/stderr)
852 49c543a6 2022-03-31 naddy ret=$?
853 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
854 d3bcc3d1 2019-08-08 stsp echo "revert command failed unexpectedly" >&2
855 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
856 0f6d7415 2019-08-08 stsp return 1
857 0f6d7415 2019-08-08 stsp fi
858 0f6d7415 2019-08-08 stsp
859 0f6d7415 2019-08-08 stsp echo "R alpha" > $testroot/stdout.expected
860 d3bcc3d1 2019-08-08 stsp echo "R foo" >> $testroot/stdout.expected
861 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
862 49c543a6 2022-03-31 naddy ret=$?
863 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
864 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
865 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
866 0f6d7415 2019-08-08 stsp return 1
867 0f6d7415 2019-08-08 stsp fi
868 0f6d7415 2019-08-08 stsp
869 d3bcc3d1 2019-08-08 stsp echo -n > $testroot/stderr.expected
870 0f6d7415 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
871 49c543a6 2022-03-31 naddy ret=$?
872 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
873 0f6d7415 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
874 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
875 0f6d7415 2019-08-08 stsp return 1
876 0f6d7415 2019-08-08 stsp fi
877 0f6d7415 2019-08-08 stsp
878 0f6d7415 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
879 0f6d7415 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
880 d3bcc3d1 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
881 24278f30 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
882 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
883 49c543a6 2022-03-31 naddy ret=$?
884 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
885 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
886 408b4ebc 2019-08-03 stsp fi
887 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
888 408b4ebc 2019-08-03 stsp }
889 408b4ebc 2019-08-03 stsp
890 f6cae3ed 2020-09-13 naddy test_stage_diff() {
891 408b4ebc 2019-08-03 stsp local testroot=`test_init stage_diff`
892 408b4ebc 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
893 408b4ebc 2019-08-03 stsp
894 408b4ebc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
895 49c543a6 2022-03-31 naddy ret=$?
896 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
897 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
898 408b4ebc 2019-08-03 stsp return 1
899 408b4ebc 2019-08-03 stsp fi
900 408b4ebc 2019-08-03 stsp
901 408b4ebc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
902 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
903 408b4ebc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
904 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
905 98eaaa12 2019-08-03 stsp
906 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
907 98eaaa12 2019-08-03 stsp echo -n > $testroot/stdout.expected
908 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
909 49c543a6 2022-03-31 naddy ret=$?
910 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
911 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
912 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
913 98eaaa12 2019-08-03 stsp return 1
914 98eaaa12 2019-08-03 stsp fi
915 408b4ebc 2019-08-03 stsp
916 408b4ebc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
917 408b4ebc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
918 408b4ebc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
919 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
920 408b4ebc 2019-08-03 stsp
921 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
922 408b4ebc 2019-08-03 stsp echo -n > $testroot/stdout.expected
923 408b4ebc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
924 49c543a6 2022-03-31 naddy ret=$?
925 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
926 408b4ebc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
927 408b4ebc 2019-08-03 stsp test_done "$testroot" "$ret"
928 408b4ebc 2019-08-03 stsp return 1
929 408b4ebc 2019-08-03 stsp fi
930 408b4ebc 2019-08-03 stsp
931 408b4ebc 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
932 408b4ebc 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
933 408b4ebc 2019-08-03 stsp
934 408b4ebc 2019-08-03 stsp (cd $testroot/wt && got diff > $testroot/stdout)
935 408b4ebc 2019-08-03 stsp
936 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
937 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
938 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
939 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
940 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 | tr -d '\n' \
941 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
942 4ce46740 2019-08-08 stsp echo ' (staged)' >> $testroot/stdout.expected
943 408b4ebc 2019-08-03 stsp echo 'file + alpha' >> $testroot/stdout.expected
944 408b4ebc 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
945 408b4ebc 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
946 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
947 408b4ebc 2019-08-03 stsp echo '-modified file' >> $testroot/stdout.expected
948 408b4ebc 2019-08-03 stsp echo '+modified file again' >> $testroot/stdout.expected
949 408b4ebc 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
950 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 | tr -d '\n' \
951 408b4ebc 2019-08-03 stsp >> $testroot/stdout.expected
952 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
953 408b4ebc 2019-08-03 stsp echo 'file + foo' >> $testroot/stdout.expected
954 408b4ebc 2019-08-03 stsp echo '--- foo' >> $testroot/stdout.expected
955 408b4ebc 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
956 408b4ebc 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
957 408b4ebc 2019-08-03 stsp echo '-new file' >> $testroot/stdout.expected
958 408b4ebc 2019-08-03 stsp echo '+new file changed' >> $testroot/stdout.expected
959 98eaaa12 2019-08-03 stsp
960 98eaaa12 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
961 49c543a6 2022-03-31 naddy ret=$?
962 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
963 98eaaa12 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
964 98eaaa12 2019-08-03 stsp test_done "$testroot" "$ret"
965 98eaaa12 2019-08-03 stsp return 1
966 98eaaa12 2019-08-03 stsp fi
967 98eaaa12 2019-08-03 stsp
968 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
969 98eaaa12 2019-08-03 stsp
970 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
971 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
972 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
973 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
974 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
975 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
976 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
977 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
978 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
979 98eaaa12 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
980 98eaaa12 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
981 98eaaa12 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
982 98eaaa12 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
983 98eaaa12 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
984 98eaaa12 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
985 98eaaa12 2019-08-03 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
986 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
987 98eaaa12 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
988 98eaaa12 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
989 98eaaa12 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
990 98eaaa12 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
991 98eaaa12 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
992 98eaaa12 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
993 98eaaa12 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
994 98eaaa12 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
995 98eaaa12 2019-08-03 stsp >> $testroot/stdout.expected
996 98eaaa12 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
997 98eaaa12 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
998 98eaaa12 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
999 98eaaa12 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1000 408b4ebc 2019-08-03 stsp
1001 24278f30 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1002 49c543a6 2022-03-31 naddy ret=$?
1003 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1004 24278f30 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1005 24278f30 2019-08-03 stsp fi
1006 24278f30 2019-08-03 stsp test_done "$testroot" "$ret"
1007 408b4ebc 2019-08-03 stsp
1008 24278f30 2019-08-03 stsp }
1009 b9622844 2019-08-03 stsp
1010 f6cae3ed 2020-09-13 naddy test_stage_histedit() {
1011 b9622844 2019-08-03 stsp local testroot=`test_init stage_histedit`
1012 b9622844 2019-08-03 stsp local orig_commit=`git_show_head $testroot/repo`
1013 b9622844 2019-08-03 stsp
1014 b9622844 2019-08-03 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1015 49c543a6 2022-03-31 naddy ret=$?
1016 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1017 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1018 b9622844 2019-08-03 stsp return 1
1019 b9622844 2019-08-03 stsp fi
1020 b9622844 2019-08-03 stsp
1021 b9622844 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1022 b9622844 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1023 b9622844 2019-08-03 stsp
1024 b9622844 2019-08-03 stsp echo "modified alpha on master" > $testroot/repo/alpha
1025 b9622844 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1026 b9622844 2019-08-03 stsp echo "new file on master" > $testroot/repo/epsilon/new
1027 b9622844 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1028 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing changes"
1029 b9622844 2019-08-03 stsp local old_commit1=`git_show_head $testroot/repo`
1030 24278f30 2019-08-03 stsp
1031 b9622844 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1032 b9622844 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1033 b9622844 2019-08-03 stsp local old_commit2=`git_show_head $testroot/repo`
1034 b9622844 2019-08-03 stsp
1035 b9622844 2019-08-03 stsp echo "pick $old_commit1" > $testroot/histedit-script
1036 b9622844 2019-08-03 stsp echo "pick $old_commit2" >> $testroot/histedit-script
1037 b9622844 2019-08-03 stsp
1038 b9622844 2019-08-03 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1039 b9622844 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1040 49c543a6 2022-03-31 naddy ret=$?
1041 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1042 b9622844 2019-08-03 stsp echo "got histedit command succeeded unexpectedly" >&2
1043 b9622844 2019-08-03 stsp test_done "$testroot" "1"
1044 b9622844 2019-08-03 stsp return 1
1045 b9622844 2019-08-03 stsp fi
1046 b9622844 2019-08-03 stsp
1047 b9622844 2019-08-03 stsp echo -n > $testroot/stdout.expected
1048 b9622844 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1049 b9622844 2019-08-03 stsp
1050 b9622844 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1051 49c543a6 2022-03-31 naddy ret=$?
1052 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1053 b9622844 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1054 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1055 b9622844 2019-08-03 stsp return 1
1056 b9622844 2019-08-03 stsp fi
1057 b9622844 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1058 49c543a6 2022-03-31 naddy ret=$?
1059 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1060 b9622844 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1061 b9622844 2019-08-03 stsp fi
1062 b9622844 2019-08-03 stsp test_done "$testroot" "$ret"
1063 243d7cf1 2019-08-03 stsp
1064 243d7cf1 2019-08-03 stsp }
1065 243d7cf1 2019-08-03 stsp
1066 f6cae3ed 2020-09-13 naddy test_stage_rebase() {
1067 243d7cf1 2019-08-03 stsp local testroot=`test_init stage_rebase`
1068 243d7cf1 2019-08-03 stsp
1069 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1070 243d7cf1 2019-08-03 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
1071 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
1072 243d7cf1 2019-08-03 stsp
1073 243d7cf1 2019-08-03 stsp echo "modified alpha on branch" > $testroot/repo/alpha
1074 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git rm -q beta)
1075 243d7cf1 2019-08-03 stsp echo "new file on branch" > $testroot/repo/epsilon/new
1076 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git add epsilon/new)
1077 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing more changes on newbranch"
1078 243d7cf1 2019-08-03 stsp
1079 243d7cf1 2019-08-03 stsp local orig_commit1=`git_show_parent_commit $testroot/repo`
1080 243d7cf1 2019-08-03 stsp local orig_commit2=`git_show_head $testroot/repo`
1081 243d7cf1 2019-08-03 stsp
1082 243d7cf1 2019-08-03 stsp (cd $testroot/repo && git checkout -q master)
1083 243d7cf1 2019-08-03 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1084 243d7cf1 2019-08-03 stsp git_commit $testroot/repo -m "committing to zeta on master"
1085 243d7cf1 2019-08-03 stsp local master_commit=`git_show_head $testroot/repo`
1086 243d7cf1 2019-08-03 stsp
1087 243d7cf1 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1088 49c543a6 2022-03-31 naddy ret=$?
1089 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1090 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1091 243d7cf1 2019-08-03 stsp return 1
1092 243d7cf1 2019-08-03 stsp fi
1093 243d7cf1 2019-08-03 stsp
1094 243d7cf1 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1095 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1096 b9622844 2019-08-03 stsp
1097 243d7cf1 2019-08-03 stsp (cd $testroot/wt && got rebase newbranch \
1098 243d7cf1 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1099 49c543a6 2022-03-31 naddy ret=$?
1100 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1101 243d7cf1 2019-08-03 stsp echo "got rebase command succeeded unexpectedly" >&2
1102 243d7cf1 2019-08-03 stsp test_done "$testroot" "1"
1103 243d7cf1 2019-08-03 stsp return 1
1104 243d7cf1 2019-08-03 stsp fi
1105 243d7cf1 2019-08-03 stsp
1106 243d7cf1 2019-08-03 stsp echo -n > $testroot/stdout.expected
1107 243d7cf1 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1108 243d7cf1 2019-08-03 stsp
1109 243d7cf1 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1110 49c543a6 2022-03-31 naddy ret=$?
1111 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1112 243d7cf1 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1113 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1114 243d7cf1 2019-08-03 stsp return 1
1115 243d7cf1 2019-08-03 stsp fi
1116 243d7cf1 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1117 49c543a6 2022-03-31 naddy ret=$?
1118 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1119 243d7cf1 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1120 243d7cf1 2019-08-03 stsp fi
1121 243d7cf1 2019-08-03 stsp test_done "$testroot" "$ret"
1122 b9622844 2019-08-03 stsp }
1123 b9622844 2019-08-03 stsp
1124 f6cae3ed 2020-09-13 naddy test_stage_update() {
1125 a76c42e6 2019-08-03 stsp local testroot=`test_init stage_update`
1126 a76c42e6 2019-08-03 stsp
1127 a76c42e6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1128 49c543a6 2022-03-31 naddy ret=$?
1129 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1130 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1131 a76c42e6 2019-08-03 stsp return 1
1132 a76c42e6 2019-08-03 stsp fi
1133 243d7cf1 2019-08-03 stsp
1134 a76c42e6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1135 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got stage alpha > /dev/null)
1136 a76c42e6 2019-08-03 stsp
1137 a76c42e6 2019-08-03 stsp echo "modified alpha" > $testroot/repo/alpha
1138 a76c42e6 2019-08-03 stsp git_commit $testroot/repo -m "modified alpha"
1139 a76c42e6 2019-08-03 stsp
1140 a76c42e6 2019-08-03 stsp (cd $testroot/wt && got update > $testroot/stdout \
1141 a76c42e6 2019-08-03 stsp 2> $testroot/stderr)
1142 49c543a6 2022-03-31 naddy ret=$?
1143 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1144 a76c42e6 2019-08-03 stsp echo "got update command succeeded unexpectedly" >&2
1145 a76c42e6 2019-08-03 stsp test_done "$testroot" "1"
1146 a76c42e6 2019-08-03 stsp return 1
1147 a76c42e6 2019-08-03 stsp fi
1148 a76c42e6 2019-08-03 stsp
1149 a76c42e6 2019-08-03 stsp echo -n > $testroot/stdout.expected
1150 a76c42e6 2019-08-03 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1151 a76c42e6 2019-08-03 stsp
1152 a76c42e6 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1153 49c543a6 2022-03-31 naddy ret=$?
1154 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1155 a76c42e6 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1156 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1157 a76c42e6 2019-08-03 stsp return 1
1158 a76c42e6 2019-08-03 stsp fi
1159 a76c42e6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1160 49c543a6 2022-03-31 naddy ret=$?
1161 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1162 a76c42e6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1163 a76c42e6 2019-08-03 stsp fi
1164 a76c42e6 2019-08-03 stsp test_done "$testroot" "$ret"
1165 a76c42e6 2019-08-03 stsp }
1166 f0b75401 2019-08-03 stsp
1167 f6cae3ed 2020-09-13 naddy test_stage_commit_non_staged() {
1168 f0b75401 2019-08-03 stsp local testroot=`test_init stage_commit_non_staged`
1169 f0b75401 2019-08-03 stsp
1170 f0b75401 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1171 49c543a6 2022-03-31 naddy ret=$?
1172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1173 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1174 f0b75401 2019-08-03 stsp return 1
1175 f0b75401 2019-08-03 stsp fi
1176 f0b75401 2019-08-03 stsp
1177 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1178 f0b75401 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1179 f0b75401 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1180 f0b75401 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1181 f0b75401 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1182 a76c42e6 2019-08-03 stsp
1183 f0b75401 2019-08-03 stsp echo "modified file" > $testroot/wt/gamma/delta
1184 f0b75401 2019-08-03 stsp (cd $testroot/wt && got commit -m "change delta" gamma/delta \
1185 f0b75401 2019-08-03 stsp > $testroot/stdout 2> $testroot/stderr)
1186 49c543a6 2022-03-31 naddy ret=$?
1187 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1188 f0b75401 2019-08-03 stsp echo "got commit command succeeded unexpectedly" >&2
1189 f0b75401 2019-08-03 stsp test_done "$testroot" "1"
1190 f0b75401 2019-08-03 stsp return 1
1191 f0b75401 2019-08-03 stsp fi
1192 f0b75401 2019-08-03 stsp
1193 f0b75401 2019-08-03 stsp echo -n > $testroot/stdout.expected
1194 f0b75401 2019-08-03 stsp echo "got: gamma/delta: file is not staged" > $testroot/stderr.expected
1195 f0b75401 2019-08-03 stsp
1196 f0b75401 2019-08-03 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1197 49c543a6 2022-03-31 naddy ret=$?
1198 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1199 f0b75401 2019-08-03 stsp diff -u $testroot/stderr.expected $testroot/stderr
1200 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1201 5f8a88c6 2019-08-03 stsp return 1
1202 5f8a88c6 2019-08-03 stsp fi
1203 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1204 49c543a6 2022-03-31 naddy ret=$?
1205 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1206 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1207 5f8a88c6 2019-08-03 stsp fi
1208 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1209 5f8a88c6 2019-08-03 stsp }
1210 0f1cfa7f 2019-08-08 stsp
1211 f6cae3ed 2020-09-13 naddy test_stage_commit_out_of_date() {
1212 0f1cfa7f 2019-08-08 stsp local testroot=`test_init stage_commit_out_of_date`
1213 0f1cfa7f 2019-08-08 stsp
1214 0f1cfa7f 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1215 49c543a6 2022-03-31 naddy ret=$?
1216 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1217 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1218 0f1cfa7f 2019-08-08 stsp return 1
1219 0f1cfa7f 2019-08-08 stsp fi
1220 0f1cfa7f 2019-08-08 stsp
1221 0f1cfa7f 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
1222 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
1223 0f1cfa7f 2019-08-08 stsp echo "new file" > $testroot/wt/foo
1224 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
1225 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1226 0f1cfa7f 2019-08-08 stsp
1227 0f1cfa7f 2019-08-08 stsp echo "changed file" > $testroot/repo/alpha
1228 0f1cfa7f 2019-08-08 stsp git_commit $testroot/repo -m "changed alpha in repo"
1229 0f1cfa7f 2019-08-08 stsp
1230 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try to commit" > $testroot/stdout \
1231 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1232 49c543a6 2022-03-31 naddy ret=$?
1233 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1234 0f1cfa7f 2019-08-08 stsp echo "got commit command succeeded unexpectedly" >&2
1235 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "1"
1236 0f1cfa7f 2019-08-08 stsp return 1
1237 0f1cfa7f 2019-08-08 stsp fi
1238 0f1cfa7f 2019-08-08 stsp
1239 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1240 0f1cfa7f 2019-08-08 stsp echo -n "got: work tree must be updated before these changes " \
1241 0f1cfa7f 2019-08-08 stsp > $testroot/stderr.expected
1242 0f1cfa7f 2019-08-08 stsp echo "can be committed" >> $testroot/stderr.expected
1243 5f8a88c6 2019-08-03 stsp
1244 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1245 49c543a6 2022-03-31 naddy ret=$?
1246 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1247 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1248 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1249 0f1cfa7f 2019-08-08 stsp return 1
1250 0f1cfa7f 2019-08-08 stsp fi
1251 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1252 49c543a6 2022-03-31 naddy ret=$?
1253 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1254 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1255 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1256 0f1cfa7f 2019-08-08 stsp return 1
1257 0f1cfa7f 2019-08-08 stsp fi
1258 0f1cfa7f 2019-08-08 stsp
1259 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout \
1260 0f1cfa7f 2019-08-08 stsp 2> $testroot/stderr)
1261 0f1cfa7f 2019-08-08 stsp echo -n > $testroot/stdout.expected
1262 0f1cfa7f 2019-08-08 stsp echo "got: alpha: file is staged" > $testroot/stderr.expected
1263 0f1cfa7f 2019-08-08 stsp
1264 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1265 49c543a6 2022-03-31 naddy ret=$?
1266 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1267 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
1268 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1269 0f1cfa7f 2019-08-08 stsp return 1
1270 0f1cfa7f 2019-08-08 stsp fi
1271 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1272 49c543a6 2022-03-31 naddy ret=$?
1273 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1274 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1275 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1276 0f1cfa7f 2019-08-08 stsp return 1
1277 0f1cfa7f 2019-08-08 stsp fi
1278 0f1cfa7f 2019-08-08 stsp
1279 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got unstage > /dev/null)
1280 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
1281 49c543a6 2022-03-31 naddy ret=$?
1282 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1283 0f1cfa7f 2019-08-08 stsp echo "got update command failed unexpectedly" >&2
1284 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1285 0f1cfa7f 2019-08-08 stsp return 1
1286 0f1cfa7f 2019-08-08 stsp fi
1287 0f1cfa7f 2019-08-08 stsp
1288 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1289 0f1cfa7f 2019-08-08 stsp echo "C alpha" > $testroot/stdout.expected
1290 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1291 0f1cfa7f 2019-08-08 stsp echo "A foo" >> $testroot/stdout.expected
1292 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1293 49c543a6 2022-03-31 naddy ret=$?
1294 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1295 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1296 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1297 0f1cfa7f 2019-08-08 stsp return 1
1298 0f1cfa7f 2019-08-08 stsp fi
1299 0f1cfa7f 2019-08-08 stsp
1300 0f1cfa7f 2019-08-08 stsp # resolve conflict
1301 0f1cfa7f 2019-08-08 stsp echo "resolved file" > $testroot/wt/alpha
1302 0f1cfa7f 2019-08-08 stsp
1303 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
1304 0f1cfa7f 2019-08-08 stsp
1305 0f1cfa7f 2019-08-08 stsp (cd $testroot/wt && got commit -m "try again" > $testroot/stdout)
1306 49c543a6 2022-03-31 naddy ret=$?
1307 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1308 0f1cfa7f 2019-08-08 stsp echo "got commit command failed unexpectedly" >&2
1309 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1310 0f1cfa7f 2019-08-08 stsp return 1
1311 0f1cfa7f 2019-08-08 stsp fi
1312 0f1cfa7f 2019-08-08 stsp
1313 0f1cfa7f 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1314 0f1cfa7f 2019-08-08 stsp echo "A foo" > $testroot/stdout.expected
1315 0f1cfa7f 2019-08-08 stsp echo "M alpha" >> $testroot/stdout.expected
1316 0f1cfa7f 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
1317 0f1cfa7f 2019-08-08 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1318 0f1cfa7f 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1319 49c543a6 2022-03-31 naddy ret=$?
1320 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1321 0f1cfa7f 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1322 0f1cfa7f 2019-08-08 stsp fi
1323 0f1cfa7f 2019-08-08 stsp test_done "$testroot" "$ret"
1324 0f1cfa7f 2019-08-08 stsp
1325 0f1cfa7f 2019-08-08 stsp }
1326 0f1cfa7f 2019-08-08 stsp
1327 f6cae3ed 2020-09-13 naddy test_stage_commit() {
1328 5f8a88c6 2019-08-03 stsp local testroot=`test_init stage_commit`
1329 5f8a88c6 2019-08-03 stsp local first_commit=`git_show_head $testroot/repo`
1330 5f8a88c6 2019-08-03 stsp
1331 5f8a88c6 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1332 49c543a6 2022-03-31 naddy ret=$?
1333 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1334 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1335 5f8a88c6 2019-08-03 stsp return 1
1336 5f8a88c6 2019-08-03 stsp fi
1337 5f8a88c6 2019-08-03 stsp
1338 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1339 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
1340 5f8a88c6 2019-08-03 stsp echo "new file" > $testroot/wt/foo
1341 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
1342 5f8a88c6 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
1343 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
1344 5f8a88c6 2019-08-03 stsp
1345 5f8a88c6 2019-08-03 stsp echo "modified file again" > $testroot/wt/alpha
1346 5f8a88c6 2019-08-03 stsp echo "new file changed" > $testroot/wt/foo
1347 5f8a88c6 2019-08-03 stsp echo "non-staged change" > $testroot/wt/gamma/delta
1348 5f8a88c6 2019-08-03 stsp echo "non-staged new file" > $testroot/wt/epsilon/new
1349 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1350 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got rm epsilon/zeta > /dev/null)
1351 5f8a88c6 2019-08-03 stsp
1352 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \
1353 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_alpha
1354 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
1355 5f8a88c6 2019-08-03 stsp > $testroot/blob_id_foo
1356 5f8a88c6 2019-08-03 stsp
1357 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got commit -m "staged changes" \
1358 5f8a88c6 2019-08-03 stsp > $testroot/stdout)
1359 49c543a6 2022-03-31 naddy ret=$?
1360 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1361 5f8a88c6 2019-08-03 stsp echo "got commit command failed unexpectedly" >&2
1362 5f8a88c6 2019-08-03 stsp test_done "$testroot" "1"
1363 5f8a88c6 2019-08-03 stsp return 1
1364 5f8a88c6 2019-08-03 stsp fi
1365 5f8a88c6 2019-08-03 stsp
1366 5f8a88c6 2019-08-03 stsp local head_commit=`git_show_head $testroot/repo`
1367 5f8a88c6 2019-08-03 stsp echo "A foo" > $testroot/stdout.expected
1368 5f8a88c6 2019-08-03 stsp echo "M alpha" >> $testroot/stdout.expected
1369 5f8a88c6 2019-08-03 stsp echo "D beta" >> $testroot/stdout.expected
1370 5f8a88c6 2019-08-03 stsp echo "Created commit $head_commit" >> $testroot/stdout.expected
1371 5f8a88c6 2019-08-03 stsp
1372 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1373 49c543a6 2022-03-31 naddy ret=$?
1374 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1375 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1376 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1377 f0b75401 2019-08-03 stsp return 1
1378 f0b75401 2019-08-03 stsp fi
1379 5f8a88c6 2019-08-03 stsp
1380 5f8a88c6 2019-08-03 stsp got diff -r $testroot/repo $first_commit $head_commit \
1381 5f8a88c6 2019-08-03 stsp > $testroot/stdout
1382 5f8a88c6 2019-08-03 stsp
1383 5f8a88c6 2019-08-03 stsp echo "diff $first_commit $head_commit" \
1384 5f8a88c6 2019-08-03 stsp > $testroot/stdout.expected
1385 8469d821 2022-06-25 stsp echo "commit - $first_commit" >> $testroot/stdout.expected
1386 8469d821 2022-06-25 stsp echo "commit + $head_commit" >> $testroot/stdout.expected
1387 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1388 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit | \
1389 5f8a88c6 2019-08-03 stsp grep 'alpha$' | cut -d' ' -f 1 \
1390 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1391 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1392 5f8a88c6 2019-08-03 stsp cat $testroot/blob_id_alpha >> $testroot/stdout.expected
1393 5f8a88c6 2019-08-03 stsp echo '--- alpha' >> $testroot/stdout.expected
1394 5f8a88c6 2019-08-03 stsp echo '+++ alpha' >> $testroot/stdout.expected
1395 5f8a88c6 2019-08-03 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1396 5f8a88c6 2019-08-03 stsp echo '-alpha' >> $testroot/stdout.expected
1397 5f8a88c6 2019-08-03 stsp echo '+modified file' >> $testroot/stdout.expected
1398 5f8a88c6 2019-08-03 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1399 5f8a88c6 2019-08-03 stsp got tree -r $testroot/repo -i -c $first_commit \
1400 46f68b20 2019-10-19 stsp | grep 'beta$' | cut -d' ' -f 1 | tr -d '\n' \
1401 5f8a88c6 2019-08-03 stsp >> $testroot/stdout.expected
1402 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1403 5f8a88c6 2019-08-03 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1404 5f8a88c6 2019-08-03 stsp echo '--- beta' >> $testroot/stdout.expected
1405 5f8a88c6 2019-08-03 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1406 5f8a88c6 2019-08-03 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1407 5f8a88c6 2019-08-03 stsp echo '-beta' >> $testroot/stdout.expected
1408 5f8a88c6 2019-08-03 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1409 5f8a88c6 2019-08-03 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1410 46f68b20 2019-10-19 stsp cat $testroot/blob_id_foo | tr -d '\n' >> $testroot/stdout.expected
1411 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
1412 5f8a88c6 2019-08-03 stsp echo '--- /dev/null' >> $testroot/stdout.expected
1413 5f8a88c6 2019-08-03 stsp echo '+++ foo' >> $testroot/stdout.expected
1414 5f8a88c6 2019-08-03 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1415 5f8a88c6 2019-08-03 stsp echo '+new file' >> $testroot/stdout.expected
1416 5f8a88c6 2019-08-03 stsp
1417 f0b75401 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1418 49c543a6 2022-03-31 naddy ret=$?
1419 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1420 f0b75401 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1421 5f8a88c6 2019-08-03 stsp test_done "$testroot" "$ret"
1422 5f8a88c6 2019-08-03 stsp return 1
1423 f0b75401 2019-08-03 stsp fi
1424 5f8a88c6 2019-08-03 stsp
1425 72fd46fa 2019-09-06 stsp echo 'M alpha' > $testroot/stdout.expected
1426 72fd46fa 2019-09-06 stsp echo 'A epsilon/new' >> $testroot/stdout.expected
1427 5f8a88c6 2019-08-03 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
1428 72fd46fa 2019-09-06 stsp echo 'M foo' >> $testroot/stdout.expected
1429 5f8a88c6 2019-08-03 stsp echo 'M gamma/delta' >> $testroot/stdout.expected
1430 5f8a88c6 2019-08-03 stsp
1431 5f8a88c6 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
1432 5f8a88c6 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1433 49c543a6 2022-03-31 naddy ret=$?
1434 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1435 5f8a88c6 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1436 5f8a88c6 2019-08-03 stsp fi
1437 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
1438 f0b75401 2019-08-03 stsp }
1439 dc424a06 2019-08-07 stsp
1440 f6cae3ed 2020-09-13 naddy test_stage_patch() {
1441 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch`
1442 dc424a06 2019-08-07 stsp
1443 dc424a06 2019-08-07 stsp jot 16 > $testroot/repo/numbers
1444 dc424a06 2019-08-07 stsp (cd $testroot/repo && git add numbers)
1445 dc424a06 2019-08-07 stsp git_commit $testroot/repo -m "added numbers file"
1446 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1447 dc424a06 2019-08-07 stsp
1448 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1449 49c543a6 2022-03-31 naddy ret=$?
1450 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1451 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1452 dc424a06 2019-08-07 stsp return 1
1453 dc424a06 2019-08-07 stsp fi
1454 dc424a06 2019-08-07 stsp
1455 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
1456 885e96df 2023-03-06 naddy ,s/^2$/a/
1457 885e96df 2023-03-06 naddy ,s/^7$/b/
1458 885e96df 2023-03-06 naddy ,s/^16$/c/
1459 885e96df 2023-03-06 naddy w
1460 885e96df 2023-03-06 naddy EOF
1461 dc424a06 2019-08-07 stsp
1462 dc424a06 2019-08-07 stsp # don't stage any hunks
1463 dc424a06 2019-08-07 stsp printf "n\nn\nn\n" > $testroot/patchscript
1464 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1465 7b5dc508 2019-10-28 stsp numbers > $testroot/stdout 2> $testroot/stderr)
1466 49c543a6 2022-03-31 naddy ret=$?
1467 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1468 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
1469 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1470 dc424a06 2019-08-07 stsp return 1
1471 dc424a06 2019-08-07 stsp fi
1472 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1473 dc424a06 2019-08-07 stsp -----------------------------------------------
1474 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1475 dc424a06 2019-08-07 stsp 1
1476 dc424a06 2019-08-07 stsp -2
1477 dc424a06 2019-08-07 stsp +a
1478 dc424a06 2019-08-07 stsp 3
1479 dc424a06 2019-08-07 stsp 4
1480 dc424a06 2019-08-07 stsp 5
1481 dc424a06 2019-08-07 stsp -----------------------------------------------
1482 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1483 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1484 dc424a06 2019-08-07 stsp -----------------------------------------------
1485 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1486 dc424a06 2019-08-07 stsp 4
1487 dc424a06 2019-08-07 stsp 5
1488 dc424a06 2019-08-07 stsp 6
1489 dc424a06 2019-08-07 stsp -7
1490 dc424a06 2019-08-07 stsp +b
1491 dc424a06 2019-08-07 stsp 8
1492 dc424a06 2019-08-07 stsp 9
1493 dc424a06 2019-08-07 stsp 10
1494 dc424a06 2019-08-07 stsp -----------------------------------------------
1495 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1496 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1497 dc424a06 2019-08-07 stsp -----------------------------------------------
1498 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1499 dc424a06 2019-08-07 stsp 13
1500 dc424a06 2019-08-07 stsp 14
1501 dc424a06 2019-08-07 stsp 15
1502 dc424a06 2019-08-07 stsp -16
1503 dc424a06 2019-08-07 stsp +c
1504 dc424a06 2019-08-07 stsp -----------------------------------------------
1505 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1506 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1507 dc424a06 2019-08-07 stsp EOF
1508 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1509 49c543a6 2022-03-31 naddy ret=$?
1510 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1511 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1512 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1513 dc424a06 2019-08-07 stsp return 1
1514 dc424a06 2019-08-07 stsp fi
1515 f0b75401 2019-08-03 stsp
1516 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
1517 7b5dc508 2019-10-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1518 49c543a6 2022-03-31 naddy ret=$?
1519 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1520 7b5dc508 2019-10-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
1521 7b5dc508 2019-10-28 stsp test_done "$testroot" "$ret"
1522 7b5dc508 2019-10-28 stsp return 1
1523 7b5dc508 2019-10-28 stsp fi
1524 7b5dc508 2019-10-28 stsp
1525 7b5dc508 2019-10-28 stsp
1526 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1527 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1528 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1529 49c543a6 2022-03-31 naddy ret=$?
1530 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1531 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1532 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1533 dc424a06 2019-08-07 stsp return 1
1534 dc424a06 2019-08-07 stsp fi
1535 dc424a06 2019-08-07 stsp
1536 dc424a06 2019-08-07 stsp # stage middle hunk
1537 dc424a06 2019-08-07 stsp printf "n\ny\nn\n" > $testroot/patchscript
1538 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1539 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1540 dc424a06 2019-08-07 stsp
1541 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1542 dc424a06 2019-08-07 stsp -----------------------------------------------
1543 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1544 dc424a06 2019-08-07 stsp 1
1545 dc424a06 2019-08-07 stsp -2
1546 dc424a06 2019-08-07 stsp +a
1547 dc424a06 2019-08-07 stsp 3
1548 dc424a06 2019-08-07 stsp 4
1549 dc424a06 2019-08-07 stsp 5
1550 dc424a06 2019-08-07 stsp -----------------------------------------------
1551 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1552 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1553 dc424a06 2019-08-07 stsp -----------------------------------------------
1554 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1555 dc424a06 2019-08-07 stsp 4
1556 dc424a06 2019-08-07 stsp 5
1557 dc424a06 2019-08-07 stsp 6
1558 dc424a06 2019-08-07 stsp -7
1559 dc424a06 2019-08-07 stsp +b
1560 dc424a06 2019-08-07 stsp 8
1561 dc424a06 2019-08-07 stsp 9
1562 dc424a06 2019-08-07 stsp 10
1563 dc424a06 2019-08-07 stsp -----------------------------------------------
1564 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1565 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1566 dc424a06 2019-08-07 stsp -----------------------------------------------
1567 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1568 dc424a06 2019-08-07 stsp 13
1569 dc424a06 2019-08-07 stsp 14
1570 dc424a06 2019-08-07 stsp 15
1571 dc424a06 2019-08-07 stsp -16
1572 dc424a06 2019-08-07 stsp +c
1573 dc424a06 2019-08-07 stsp -----------------------------------------------
1574 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1575 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1576 dc424a06 2019-08-07 stsp EOF
1577 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1578 49c543a6 2022-03-31 naddy ret=$?
1579 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1580 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1581 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1582 dc424a06 2019-08-07 stsp return 1
1583 dc424a06 2019-08-07 stsp fi
1584 dc424a06 2019-08-07 stsp
1585 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1586 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1587 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1588 49c543a6 2022-03-31 naddy ret=$?
1589 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1590 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1591 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1592 dc424a06 2019-08-07 stsp return 1
1593 dc424a06 2019-08-07 stsp fi
1594 dc424a06 2019-08-07 stsp
1595 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1596 dc424a06 2019-08-07 stsp
1597 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1598 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1599 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1600 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1601 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1602 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1603 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1604 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1605 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1606 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1607 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1608 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1609 dc424a06 2019-08-07 stsp echo "@@ -4,7 +4,7 @@" >> $testroot/stdout.expected
1610 dc424a06 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
1611 dc424a06 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
1612 dc424a06 2019-08-07 stsp echo " 6" >> $testroot/stdout.expected
1613 dc424a06 2019-08-07 stsp echo "-7" >> $testroot/stdout.expected
1614 dc424a06 2019-08-07 stsp echo "+b" >> $testroot/stdout.expected
1615 dc424a06 2019-08-07 stsp echo " 8" >> $testroot/stdout.expected
1616 dc424a06 2019-08-07 stsp echo " 9" >> $testroot/stdout.expected
1617 dc424a06 2019-08-07 stsp echo " 10" >> $testroot/stdout.expected
1618 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1619 49c543a6 2022-03-31 naddy ret=$?
1620 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1621 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1622 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1623 dc424a06 2019-08-07 stsp return 1
1624 dc424a06 2019-08-07 stsp fi
1625 dc424a06 2019-08-07 stsp
1626 dc424a06 2019-08-07 stsp (cd $testroot/wt && got unstage >/dev/null)
1627 49c543a6 2022-03-31 naddy ret=$?
1628 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1629 dc424a06 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
1630 dc424a06 2019-08-07 stsp test_done "$testroot" "1"
1631 dc424a06 2019-08-07 stsp return 1
1632 dc424a06 2019-08-07 stsp fi
1633 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1634 dc424a06 2019-08-07 stsp echo "M numbers" > $testroot/stdout.expected
1635 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1636 49c543a6 2022-03-31 naddy ret=$?
1637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1638 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1639 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1640 dc424a06 2019-08-07 stsp return 1
1641 dc424a06 2019-08-07 stsp fi
1642 dc424a06 2019-08-07 stsp
1643 dc424a06 2019-08-07 stsp # stage last hunk
1644 dc424a06 2019-08-07 stsp printf "n\nn\ny\n" > $testroot/patchscript
1645 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1646 dc424a06 2019-08-07 stsp numbers > $testroot/stdout)
1647 dc424a06 2019-08-07 stsp
1648 dc424a06 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
1649 dc424a06 2019-08-07 stsp -----------------------------------------------
1650 dc424a06 2019-08-07 stsp @@ -1,5 +1,5 @@
1651 dc424a06 2019-08-07 stsp 1
1652 dc424a06 2019-08-07 stsp -2
1653 dc424a06 2019-08-07 stsp +a
1654 dc424a06 2019-08-07 stsp 3
1655 dc424a06 2019-08-07 stsp 4
1656 dc424a06 2019-08-07 stsp 5
1657 dc424a06 2019-08-07 stsp -----------------------------------------------
1658 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
1659 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1660 dc424a06 2019-08-07 stsp -----------------------------------------------
1661 dc424a06 2019-08-07 stsp @@ -4,7 +4,7 @@
1662 dc424a06 2019-08-07 stsp 4
1663 dc424a06 2019-08-07 stsp 5
1664 dc424a06 2019-08-07 stsp 6
1665 dc424a06 2019-08-07 stsp -7
1666 dc424a06 2019-08-07 stsp +b
1667 dc424a06 2019-08-07 stsp 8
1668 dc424a06 2019-08-07 stsp 9
1669 dc424a06 2019-08-07 stsp 10
1670 dc424a06 2019-08-07 stsp -----------------------------------------------
1671 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
1672 b353a198 2019-08-07 stsp stage this change? [y/n/q] n
1673 dc424a06 2019-08-07 stsp -----------------------------------------------
1674 dc424a06 2019-08-07 stsp @@ -13,4 +13,4 @@
1675 dc424a06 2019-08-07 stsp 13
1676 dc424a06 2019-08-07 stsp 14
1677 dc424a06 2019-08-07 stsp 15
1678 dc424a06 2019-08-07 stsp -16
1679 dc424a06 2019-08-07 stsp +c
1680 dc424a06 2019-08-07 stsp -----------------------------------------------
1681 a7c9878d 2019-08-08 stsp M numbers (change 3 of 3)
1682 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
1683 dc424a06 2019-08-07 stsp EOF
1684 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1685 49c543a6 2022-03-31 naddy ret=$?
1686 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1687 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1688 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1689 dc424a06 2019-08-07 stsp return 1
1690 dc424a06 2019-08-07 stsp fi
1691 dc424a06 2019-08-07 stsp
1692 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1693 dc424a06 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
1694 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1695 49c543a6 2022-03-31 naddy ret=$?
1696 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1697 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1698 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1699 dc424a06 2019-08-07 stsp return 1
1700 dc424a06 2019-08-07 stsp fi
1701 dc424a06 2019-08-07 stsp
1702 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1703 dc424a06 2019-08-07 stsp
1704 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1705 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1706 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1707 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1708 dc424a06 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
1709 dc424a06 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1710 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1711 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1712 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1713 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1714 dc424a06 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
1715 dc424a06 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
1716 dc424a06 2019-08-07 stsp echo "@@ -13,4 +13,4 @@" >> $testroot/stdout.expected
1717 dc424a06 2019-08-07 stsp echo " 13" >> $testroot/stdout.expected
1718 dc424a06 2019-08-07 stsp echo " 14" >> $testroot/stdout.expected
1719 dc424a06 2019-08-07 stsp echo " 15" >> $testroot/stdout.expected
1720 dc424a06 2019-08-07 stsp echo "-16" >> $testroot/stdout.expected
1721 dc424a06 2019-08-07 stsp echo "+c" >> $testroot/stdout.expected
1722 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1723 49c543a6 2022-03-31 naddy ret=$?
1724 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1725 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1726 af5a81b2 2019-08-08 stsp fi
1727 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1728 af5a81b2 2019-08-08 stsp }
1729 af5a81b2 2019-08-08 stsp
1730 f6cae3ed 2020-09-13 naddy test_stage_patch_twice() {
1731 af5a81b2 2019-08-08 stsp local testroot=`test_init stage_patch_twice`
1732 af5a81b2 2019-08-08 stsp
1733 af5a81b2 2019-08-08 stsp jot 16 > $testroot/repo/numbers
1734 af5a81b2 2019-08-08 stsp (cd $testroot/repo && git add numbers)
1735 af5a81b2 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
1736 af5a81b2 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1737 af5a81b2 2019-08-08 stsp
1738 af5a81b2 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1739 49c543a6 2022-03-31 naddy ret=$?
1740 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1741 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1742 af5a81b2 2019-08-08 stsp return 1
1743 af5a81b2 2019-08-08 stsp fi
1744 af5a81b2 2019-08-08 stsp
1745 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
1746 885e96df 2023-03-06 naddy ,s/^2$/a/
1747 885e96df 2023-03-06 naddy ,s/^7$/b/
1748 885e96df 2023-03-06 naddy ,s/^16$/c/
1749 885e96df 2023-03-06 naddy w
1750 885e96df 2023-03-06 naddy EOF
1751 af5a81b2 2019-08-08 stsp
1752 af5a81b2 2019-08-08 stsp # stage middle hunk
1753 af5a81b2 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
1754 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1755 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1756 af5a81b2 2019-08-08 stsp
1757 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1758 af5a81b2 2019-08-08 stsp -----------------------------------------------
1759 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1760 af5a81b2 2019-08-08 stsp 1
1761 af5a81b2 2019-08-08 stsp -2
1762 af5a81b2 2019-08-08 stsp +a
1763 af5a81b2 2019-08-08 stsp 3
1764 af5a81b2 2019-08-08 stsp 4
1765 af5a81b2 2019-08-08 stsp 5
1766 af5a81b2 2019-08-08 stsp -----------------------------------------------
1767 af5a81b2 2019-08-08 stsp M numbers (change 1 of 3)
1768 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1769 af5a81b2 2019-08-08 stsp -----------------------------------------------
1770 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1771 af5a81b2 2019-08-08 stsp 4
1772 af5a81b2 2019-08-08 stsp 5
1773 af5a81b2 2019-08-08 stsp 6
1774 af5a81b2 2019-08-08 stsp -7
1775 af5a81b2 2019-08-08 stsp +b
1776 af5a81b2 2019-08-08 stsp 8
1777 af5a81b2 2019-08-08 stsp 9
1778 af5a81b2 2019-08-08 stsp 10
1779 af5a81b2 2019-08-08 stsp -----------------------------------------------
1780 af5a81b2 2019-08-08 stsp M numbers (change 2 of 3)
1781 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1782 af5a81b2 2019-08-08 stsp -----------------------------------------------
1783 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1784 af5a81b2 2019-08-08 stsp 13
1785 af5a81b2 2019-08-08 stsp 14
1786 af5a81b2 2019-08-08 stsp 15
1787 af5a81b2 2019-08-08 stsp -16
1788 af5a81b2 2019-08-08 stsp +c
1789 af5a81b2 2019-08-08 stsp -----------------------------------------------
1790 af5a81b2 2019-08-08 stsp M numbers (change 3 of 3)
1791 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1792 af5a81b2 2019-08-08 stsp EOF
1793 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1794 49c543a6 2022-03-31 naddy ret=$?
1795 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1796 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1797 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1798 af5a81b2 2019-08-08 stsp return 1
1799 af5a81b2 2019-08-08 stsp fi
1800 af5a81b2 2019-08-08 stsp
1801 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1802 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1803 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1804 49c543a6 2022-03-31 naddy ret=$?
1805 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1806 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1807 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1808 af5a81b2 2019-08-08 stsp return 1
1809 af5a81b2 2019-08-08 stsp fi
1810 af5a81b2 2019-08-08 stsp
1811 af5a81b2 2019-08-08 stsp # stage last hunk
1812 af5a81b2 2019-08-08 stsp printf "n\ny\n" > $testroot/patchscript
1813 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1814 af5a81b2 2019-08-08 stsp numbers > $testroot/stdout)
1815 af5a81b2 2019-08-08 stsp
1816 af5a81b2 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
1817 af5a81b2 2019-08-08 stsp -----------------------------------------------
1818 fe621944 2020-11-10 stsp @@ -1,5 +1,5 @@
1819 af5a81b2 2019-08-08 stsp 1
1820 af5a81b2 2019-08-08 stsp -2
1821 af5a81b2 2019-08-08 stsp +a
1822 af5a81b2 2019-08-08 stsp 3
1823 af5a81b2 2019-08-08 stsp 4
1824 af5a81b2 2019-08-08 stsp 5
1825 af5a81b2 2019-08-08 stsp -----------------------------------------------
1826 af5a81b2 2019-08-08 stsp M numbers (change 1 of 2)
1827 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] n
1828 af5a81b2 2019-08-08 stsp -----------------------------------------------
1829 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@ b
1830 af5a81b2 2019-08-08 stsp 13
1831 af5a81b2 2019-08-08 stsp 14
1832 af5a81b2 2019-08-08 stsp 15
1833 af5a81b2 2019-08-08 stsp -16
1834 af5a81b2 2019-08-08 stsp +c
1835 af5a81b2 2019-08-08 stsp -----------------------------------------------
1836 af5a81b2 2019-08-08 stsp M numbers (change 2 of 2)
1837 af5a81b2 2019-08-08 stsp stage this change? [y/n/q] y
1838 af5a81b2 2019-08-08 stsp EOF
1839 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1840 49c543a6 2022-03-31 naddy ret=$?
1841 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1842 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1843 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1844 af5a81b2 2019-08-08 stsp return 1
1845 af5a81b2 2019-08-08 stsp fi
1846 af5a81b2 2019-08-08 stsp
1847 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
1848 af5a81b2 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
1849 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1850 49c543a6 2022-03-31 naddy ret=$?
1851 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1852 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1853 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1854 af5a81b2 2019-08-08 stsp return 1
1855 af5a81b2 2019-08-08 stsp fi
1856 af5a81b2 2019-08-08 stsp
1857 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1858 af5a81b2 2019-08-08 stsp
1859 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1860 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1861 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1862 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1863 af5a81b2 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
1864 af5a81b2 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
1865 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1866 af5a81b2 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1867 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
1868 af5a81b2 2019-08-08 stsp >> $testroot/stdout.expected
1869 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1870 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1871 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1872 af5a81b2 2019-08-08 stsp @@ -4,7 +4,7 @@
1873 af5a81b2 2019-08-08 stsp 4
1874 af5a81b2 2019-08-08 stsp 5
1875 af5a81b2 2019-08-08 stsp 6
1876 af5a81b2 2019-08-08 stsp -7
1877 af5a81b2 2019-08-08 stsp +b
1878 af5a81b2 2019-08-08 stsp 8
1879 af5a81b2 2019-08-08 stsp 9
1880 af5a81b2 2019-08-08 stsp 10
1881 af5a81b2 2019-08-08 stsp @@ -13,4 +13,4 @@
1882 af5a81b2 2019-08-08 stsp 13
1883 af5a81b2 2019-08-08 stsp 14
1884 af5a81b2 2019-08-08 stsp 15
1885 af5a81b2 2019-08-08 stsp -16
1886 af5a81b2 2019-08-08 stsp +c
1887 af5a81b2 2019-08-08 stsp EOF
1888 af5a81b2 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1889 49c543a6 2022-03-31 naddy ret=$?
1890 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1891 af5a81b2 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1892 af5a81b2 2019-08-08 stsp test_done "$testroot" "$ret"
1893 af5a81b2 2019-08-08 stsp return 1
1894 af5a81b2 2019-08-08 stsp fi
1895 af5a81b2 2019-08-08 stsp
1896 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1897 af5a81b2 2019-08-08 stsp
1898 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1899 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1900 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1901 af5a81b2 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1902 af5a81b2 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
1903 af5a81b2 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
1904 af5a81b2 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
1905 af5a81b2 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
1906 af5a81b2 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
1907 af5a81b2 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
1908 af5a81b2 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
1909 af5a81b2 2019-08-08 stsp @@ -1,5 +1,5 @@
1910 af5a81b2 2019-08-08 stsp 1
1911 af5a81b2 2019-08-08 stsp -2
1912 af5a81b2 2019-08-08 stsp +a
1913 af5a81b2 2019-08-08 stsp 3
1914 af5a81b2 2019-08-08 stsp 4
1915 af5a81b2 2019-08-08 stsp 5
1916 af5a81b2 2019-08-08 stsp EOF
1917 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1918 49c543a6 2022-03-31 naddy ret=$?
1919 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1920 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1921 dc424a06 2019-08-07 stsp fi
1922 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1923 dc424a06 2019-08-07 stsp }
1924 dc424a06 2019-08-07 stsp
1925 f6cae3ed 2020-09-13 naddy test_stage_patch_added() {
1926 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_added`
1927 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
1928 dc424a06 2019-08-07 stsp
1929 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1930 49c543a6 2022-03-31 naddy ret=$?
1931 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1932 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1933 dc424a06 2019-08-07 stsp return 1
1934 dc424a06 2019-08-07 stsp fi
1935 dc424a06 2019-08-07 stsp
1936 dc424a06 2019-08-07 stsp echo "new" > $testroot/wt/epsilon/new
1937 dc424a06 2019-08-07 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1938 dc424a06 2019-08-07 stsp
1939 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
1940 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
1941 dc424a06 2019-08-07 stsp epsilon/new > $testroot/stdout)
1942 dc424a06 2019-08-07 stsp
1943 dc424a06 2019-08-07 stsp echo "A epsilon/new" > $testroot/stdout.expected
1944 c8ede203 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
1945 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1946 49c543a6 2022-03-31 naddy ret=$?
1947 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1948 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1949 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1950 dc424a06 2019-08-07 stsp return 1
1951 dc424a06 2019-08-07 stsp fi
1952 dc424a06 2019-08-07 stsp
1953 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1954 dc424a06 2019-08-07 stsp echo " A epsilon/new" > $testroot/stdout.expected
1955 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1956 49c543a6 2022-03-31 naddy ret=$?
1957 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1958 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1959 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
1960 dc424a06 2019-08-07 stsp return 1
1961 dc424a06 2019-08-07 stsp fi
1962 dc424a06 2019-08-07 stsp
1963 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
1964 dc424a06 2019-08-07 stsp
1965 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
1966 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
1967 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
1968 dc424a06 2019-08-07 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
1969 dc424a06 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
1970 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \
1971 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
1972 dc424a06 2019-08-07 stsp echo "--- /dev/null" >> $testroot/stdout.expected
1973 dc424a06 2019-08-07 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
1974 dc424a06 2019-08-07 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
1975 dc424a06 2019-08-07 stsp echo "+new" >> $testroot/stdout.expected
1976 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1977 49c543a6 2022-03-31 naddy ret=$?
1978 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1979 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1980 e70a841e 2019-08-08 stsp fi
1981 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1982 e70a841e 2019-08-08 stsp }
1983 e70a841e 2019-08-08 stsp
1984 f6cae3ed 2020-09-13 naddy test_stage_patch_added_twice() {
1985 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_added_twice`
1986 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
1987 e70a841e 2019-08-08 stsp
1988 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1989 49c543a6 2022-03-31 naddy ret=$?
1990 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1991 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
1992 e70a841e 2019-08-08 stsp return 1
1993 e70a841e 2019-08-08 stsp fi
1994 e70a841e 2019-08-08 stsp
1995 e70a841e 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
1996 e70a841e 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
1997 e70a841e 2019-08-08 stsp
1998 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
1999 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2000 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout)
2001 e70a841e 2019-08-08 stsp
2002 e70a841e 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
2003 e70a841e 2019-08-08 stsp echo "stage this addition? [y/n] y" >> $testroot/stdout.expected
2004 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2005 49c543a6 2022-03-31 naddy ret=$?
2006 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2007 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2008 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2009 e70a841e 2019-08-08 stsp return 1
2010 e70a841e 2019-08-08 stsp fi
2011 e70a841e 2019-08-08 stsp
2012 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2013 e70a841e 2019-08-08 stsp echo " A epsilon/new" > $testroot/stdout.expected
2014 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2015 49c543a6 2022-03-31 naddy ret=$?
2016 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2017 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2018 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2019 e70a841e 2019-08-08 stsp return 1
2020 dc424a06 2019-08-07 stsp fi
2021 e70a841e 2019-08-08 stsp
2022 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2023 e70a841e 2019-08-08 stsp epsilon/new > $testroot/stdout 2> $testroot/stderr)
2024 49c543a6 2022-03-31 naddy ret=$?
2025 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2026 e70a841e 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2027 e70a841e 2019-08-08 stsp test_done "$testroot" "1"
2028 e70a841e 2019-08-08 stsp return 1
2029 e70a841e 2019-08-08 stsp fi
2030 e70a841e 2019-08-08 stsp
2031 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2032 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2033 49c543a6 2022-03-31 naddy ret=$?
2034 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2035 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2036 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2037 e70a841e 2019-08-08 stsp return 1
2038 e70a841e 2019-08-08 stsp fi
2039 e70a841e 2019-08-08 stsp
2040 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2041 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2042 49c543a6 2022-03-31 naddy ret=$?
2043 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2044 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2045 e70a841e 2019-08-08 stsp fi
2046 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2047 dc424a06 2019-08-07 stsp }
2048 dc424a06 2019-08-07 stsp
2049 f6cae3ed 2020-09-13 naddy test_stage_patch_removed() {
2050 dc424a06 2019-08-07 stsp local testroot=`test_init stage_patch_removed`
2051 dc424a06 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2052 dc424a06 2019-08-07 stsp
2053 dc424a06 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2054 49c543a6 2022-03-31 naddy ret=$?
2055 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2056 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2057 dc424a06 2019-08-07 stsp return 1
2058 dc424a06 2019-08-07 stsp fi
2059 dc424a06 2019-08-07 stsp
2060 dc424a06 2019-08-07 stsp (cd $testroot/wt && got rm beta > /dev/null)
2061 dc424a06 2019-08-07 stsp
2062 dc424a06 2019-08-07 stsp printf "y\n" > $testroot/patchscript
2063 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2064 dc424a06 2019-08-07 stsp beta > $testroot/stdout)
2065 dc424a06 2019-08-07 stsp
2066 dc424a06 2019-08-07 stsp echo -n > $testroot/stdout.expected
2067 dc424a06 2019-08-07 stsp
2068 dc424a06 2019-08-07 stsp echo "D beta" > $testroot/stdout.expected
2069 f5a17245 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2070 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2071 49c543a6 2022-03-31 naddy ret=$?
2072 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2073 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2074 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2075 dc424a06 2019-08-07 stsp return 1
2076 dc424a06 2019-08-07 stsp fi
2077 dc424a06 2019-08-07 stsp
2078 dc424a06 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2079 dc424a06 2019-08-07 stsp echo " D beta" > $testroot/stdout.expected
2080 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2081 49c543a6 2022-03-31 naddy ret=$?
2082 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2083 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2084 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2085 dc424a06 2019-08-07 stsp return 1
2086 dc424a06 2019-08-07 stsp fi
2087 dc424a06 2019-08-07 stsp
2088 dc424a06 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2089 dc424a06 2019-08-07 stsp
2090 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2091 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2092 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2093 dc424a06 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2094 dc424a06 2019-08-07 stsp (cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \
2095 dc424a06 2019-08-07 stsp >> $testroot/stdout.expected
2096 dc424a06 2019-08-07 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2097 dc424a06 2019-08-07 stsp echo "--- beta" >> $testroot/stdout.expected
2098 dc424a06 2019-08-07 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
2099 dc424a06 2019-08-07 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
2100 dc424a06 2019-08-07 stsp echo "-beta" >> $testroot/stdout.expected
2101 dc424a06 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2102 49c543a6 2022-03-31 naddy ret=$?
2103 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2104 dc424a06 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2105 dc424a06 2019-08-07 stsp fi
2106 dc424a06 2019-08-07 stsp test_done "$testroot" "$ret"
2107 dc424a06 2019-08-07 stsp }
2108 b353a198 2019-08-07 stsp
2109 f6cae3ed 2020-09-13 naddy test_stage_patch_removed_twice() {
2110 e70a841e 2019-08-08 stsp local testroot=`test_init stage_patch_removed_twice`
2111 e70a841e 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2112 e70a841e 2019-08-08 stsp
2113 e70a841e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2114 49c543a6 2022-03-31 naddy ret=$?
2115 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2116 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2117 e70a841e 2019-08-08 stsp return 1
2118 e70a841e 2019-08-08 stsp fi
2119 e70a841e 2019-08-08 stsp
2120 e70a841e 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
2121 e70a841e 2019-08-08 stsp
2122 e70a841e 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2123 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2124 e70a841e 2019-08-08 stsp beta > $testroot/stdout)
2125 e70a841e 2019-08-08 stsp
2126 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2127 e70a841e 2019-08-08 stsp
2128 e70a841e 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
2129 e70a841e 2019-08-08 stsp echo "stage this deletion? [y/n] y" >> $testroot/stdout.expected
2130 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2131 49c543a6 2022-03-31 naddy ret=$?
2132 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2133 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2134 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2135 e70a841e 2019-08-08 stsp return 1
2136 e70a841e 2019-08-08 stsp fi
2137 e70a841e 2019-08-08 stsp
2138 e70a841e 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2139 e70a841e 2019-08-08 stsp echo " D beta" > $testroot/stdout.expected
2140 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2141 49c543a6 2022-03-31 naddy ret=$?
2142 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2143 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2144 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2145 e70a841e 2019-08-08 stsp return 1
2146 e70a841e 2019-08-08 stsp fi
2147 e70a841e 2019-08-08 stsp
2148 e70a841e 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p beta \
2149 e70a841e 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2150 49c543a6 2022-03-31 naddy ret=$?
2151 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2152 7b5dc508 2019-10-28 stsp echo "got stage command succeeded unexpectedly" >&2
2153 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2154 e70a841e 2019-08-08 stsp return 1
2155 e70a841e 2019-08-08 stsp fi
2156 e70a841e 2019-08-08 stsp
2157 7b5dc508 2019-10-28 stsp echo "got: no changes to stage" > $testroot/stderr.expected
2158 e70a841e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2159 49c543a6 2022-03-31 naddy ret=$?
2160 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2161 e70a841e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2162 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2163 e70a841e 2019-08-08 stsp return 1
2164 e70a841e 2019-08-08 stsp fi
2165 e70a841e 2019-08-08 stsp
2166 e70a841e 2019-08-08 stsp echo -n > $testroot/stdout.expected
2167 9fdde394 2022-06-04 op cmp -s $testroot/stdout.expected $testroot/stdout
2168 9fdde394 2022-06-04 op ret=$?
2169 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2170 9fdde394 2022-06-04 op diff -u $testroot/stdout.expected $testroot/stdout
2171 9fdde394 2022-06-04 op fi
2172 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2173 9fdde394 2022-06-04 op }
2174 9fdde394 2022-06-04 op
2175 9fdde394 2022-06-04 op test_stage_patch_reversed() {
2176 9fdde394 2022-06-04 op local testroot=`test_init stage_patch_reversed`
2177 9fdde394 2022-06-04 op
2178 9fdde394 2022-06-04 op got checkout $testroot/repo $testroot/wt > /dev/null
2179 9fdde394 2022-06-04 op ret=$?
2180 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2181 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2182 9fdde394 2022-06-04 op return 1
2183 9fdde394 2022-06-04 op fi
2184 9fdde394 2022-06-04 op
2185 9fdde394 2022-06-04 op echo 'ALPHA' > $testroot/wt/alpha
2186 9fdde394 2022-06-04 op (cd $testroot/wt && got stage alpha > $testroot/stdout)
2187 9fdde394 2022-06-04 op ret=$?
2188 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2189 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2190 9fdde394 2022-06-04 op return 1
2191 9fdde394 2022-06-04 op fi
2192 9fdde394 2022-06-04 op
2193 9fdde394 2022-06-04 op echo ' M alpha' > $testroot/stdout.expected
2194 9fdde394 2022-06-04 op cmp -s $testroot/stdout.expected $testroot/stdout
2195 9fdde394 2022-06-04 op ret=$?
2196 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2197 9fdde394 2022-06-04 op diff -u $testroot/stdout.expected $testroot/stdout
2198 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2199 9fdde394 2022-06-04 op return 1
2200 9fdde394 2022-06-04 op fi
2201 9fdde394 2022-06-04 op
2202 9fdde394 2022-06-04 op echo 'alpha' > $testroot/wt/alpha
2203 9fdde394 2022-06-04 op (cd $testroot/wt && got stage alpha > $testroot/stdout)
2204 9fdde394 2022-06-04 op ret=$?
2205 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2206 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2207 9fdde394 2022-06-04 op return 1
2208 9fdde394 2022-06-04 op fi
2209 9fdde394 2022-06-04 op
2210 9fdde394 2022-06-04 op echo ' M alpha' > $testroot/stdout.expected
2211 e70a841e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2212 49c543a6 2022-03-31 naddy ret=$?
2213 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2214 e70a841e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2215 9fdde394 2022-06-04 op test_done "$testroot" "$ret"
2216 9fdde394 2022-06-04 op return 1
2217 9fdde394 2022-06-04 op fi
2218 9fdde394 2022-06-04 op
2219 9fdde394 2022-06-04 op (cd $testroot/wt && got status > $testroot/stdout)
2220 9fdde394 2022-06-04 op cmp -s /dev/null $testroot/stdout
2221 9fdde394 2022-06-04 op ret=$?
2222 9fdde394 2022-06-04 op if [ $ret -ne 0 ]; then
2223 9fdde394 2022-06-04 op diff -u /dev/null $testroot/stdout
2224 e70a841e 2019-08-08 stsp fi
2225 e70a841e 2019-08-08 stsp test_done "$testroot" "$ret"
2226 e70a841e 2019-08-08 stsp }
2227 e70a841e 2019-08-08 stsp
2228 f6cae3ed 2020-09-13 naddy test_stage_patch_quit() {
2229 b353a198 2019-08-07 stsp local testroot=`test_init stage_patch_quit`
2230 b353a198 2019-08-07 stsp
2231 b353a198 2019-08-07 stsp jot 16 > $testroot/repo/numbers
2232 88f33a19 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2233 88f33a19 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2234 88f33a19 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2235 b353a198 2019-08-07 stsp local commit_id=`git_show_head $testroot/repo`
2236 b353a198 2019-08-07 stsp
2237 b353a198 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2238 49c543a6 2022-03-31 naddy ret=$?
2239 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2240 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2241 b353a198 2019-08-07 stsp return 1
2242 b353a198 2019-08-07 stsp fi
2243 dc424a06 2019-08-07 stsp
2244 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
2245 885e96df 2023-03-06 naddy ,s/^2$/a/
2246 885e96df 2023-03-06 naddy ,s/^7$/b/
2247 885e96df 2023-03-06 naddy ,s/^16$/c/
2248 885e96df 2023-03-06 naddy w
2249 885e96df 2023-03-06 naddy EOF
2250 88f33a19 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
2251 b353a198 2019-08-07 stsp
2252 88f33a19 2019-08-08 stsp # stage first hunk and quit; and don't pass a path argument to
2253 88f33a19 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
2254 88f33a19 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
2255 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2256 2db2652d 2019-08-07 stsp > $testroot/stdout)
2257 49c543a6 2022-03-31 naddy ret=$?
2258 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2259 b353a198 2019-08-07 stsp echo "got stage command failed unexpectedly" >&2
2260 b353a198 2019-08-07 stsp test_done "$testroot" "1"
2261 b353a198 2019-08-07 stsp return 1
2262 b353a198 2019-08-07 stsp fi
2263 b353a198 2019-08-07 stsp cat > $testroot/stdout.expected <<EOF
2264 b353a198 2019-08-07 stsp -----------------------------------------------
2265 b353a198 2019-08-07 stsp @@ -1,5 +1,5 @@
2266 b353a198 2019-08-07 stsp 1
2267 b353a198 2019-08-07 stsp -2
2268 b353a198 2019-08-07 stsp +a
2269 b353a198 2019-08-07 stsp 3
2270 b353a198 2019-08-07 stsp 4
2271 b353a198 2019-08-07 stsp 5
2272 b353a198 2019-08-07 stsp -----------------------------------------------
2273 a7c9878d 2019-08-08 stsp M numbers (change 1 of 3)
2274 b353a198 2019-08-07 stsp stage this change? [y/n/q] y
2275 b353a198 2019-08-07 stsp -----------------------------------------------
2276 b353a198 2019-08-07 stsp @@ -4,7 +4,7 @@
2277 b353a198 2019-08-07 stsp 4
2278 b353a198 2019-08-07 stsp 5
2279 b353a198 2019-08-07 stsp 6
2280 b353a198 2019-08-07 stsp -7
2281 b353a198 2019-08-07 stsp +b
2282 b353a198 2019-08-07 stsp 8
2283 b353a198 2019-08-07 stsp 9
2284 b353a198 2019-08-07 stsp 10
2285 b353a198 2019-08-07 stsp -----------------------------------------------
2286 a7c9878d 2019-08-08 stsp M numbers (change 2 of 3)
2287 b353a198 2019-08-07 stsp stage this change? [y/n/q] q
2288 88f33a19 2019-08-08 stsp D zzz
2289 f5a17245 2019-08-08 stsp stage this deletion? [y/n] n
2290 b353a198 2019-08-07 stsp EOF
2291 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2292 49c543a6 2022-03-31 naddy ret=$?
2293 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2294 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2295 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2296 b353a198 2019-08-07 stsp return 1
2297 b353a198 2019-08-07 stsp fi
2298 b353a198 2019-08-07 stsp
2299 b353a198 2019-08-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
2300 b353a198 2019-08-07 stsp echo "MM numbers" > $testroot/stdout.expected
2301 88f33a19 2019-08-08 stsp echo "D zzz" >> $testroot/stdout.expected
2302 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2303 49c543a6 2022-03-31 naddy ret=$?
2304 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2305 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2306 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2307 b353a198 2019-08-07 stsp return 1
2308 b353a198 2019-08-07 stsp fi
2309 b353a198 2019-08-07 stsp
2310 b353a198 2019-08-07 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2311 b353a198 2019-08-07 stsp
2312 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2313 8469d821 2022-06-25 stsp echo "commit - $commit_id" >> $testroot/stdout.expected
2314 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2315 b353a198 2019-08-07 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2316 b353a198 2019-08-07 stsp got tree -r $testroot/repo -i -c $commit_id \
2317 b353a198 2019-08-07 stsp | grep 'numbers$' | cut -d' ' -f 1 \
2318 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2319 b353a198 2019-08-07 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2320 b353a198 2019-08-07 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
2321 b353a198 2019-08-07 stsp >> $testroot/stdout.expected
2322 b353a198 2019-08-07 stsp echo "--- numbers" >> $testroot/stdout.expected
2323 b353a198 2019-08-07 stsp echo "+++ numbers" >> $testroot/stdout.expected
2324 b353a198 2019-08-07 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
2325 b353a198 2019-08-07 stsp echo " 1" >> $testroot/stdout.expected
2326 b353a198 2019-08-07 stsp echo "-2" >> $testroot/stdout.expected
2327 b353a198 2019-08-07 stsp echo "+a" >> $testroot/stdout.expected
2328 b353a198 2019-08-07 stsp echo " 3" >> $testroot/stdout.expected
2329 b353a198 2019-08-07 stsp echo " 4" >> $testroot/stdout.expected
2330 b353a198 2019-08-07 stsp echo " 5" >> $testroot/stdout.expected
2331 b353a198 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2332 49c543a6 2022-03-31 naddy ret=$?
2333 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2334 b353a198 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
2335 b353a198 2019-08-07 stsp fi
2336 b353a198 2019-08-07 stsp test_done "$testroot" "$ret"
2337 b353a198 2019-08-07 stsp
2338 b353a198 2019-08-07 stsp }
2339 b353a198 2019-08-07 stsp
2340 f6cae3ed 2020-09-13 naddy test_stage_patch_incomplete_script() {
2341 eba70f38 2019-08-08 stsp local testroot=`test_init stage_incomplete_script`
2342 eba70f38 2019-08-08 stsp
2343 eba70f38 2019-08-08 stsp jot 16 > $testroot/repo/numbers
2344 eba70f38 2019-08-08 stsp echo zzz > $testroot/repo/zzz
2345 eba70f38 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
2346 eba70f38 2019-08-08 stsp git_commit $testroot/repo -m "added files"
2347 eba70f38 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
2348 eba70f38 2019-08-08 stsp
2349 eba70f38 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2350 49c543a6 2022-03-31 naddy ret=$?
2351 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2352 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2353 eba70f38 2019-08-08 stsp return 1
2354 eba70f38 2019-08-08 stsp fi
2355 eba70f38 2019-08-08 stsp
2356 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
2357 885e96df 2023-03-06 naddy ,s/^2$/a/
2358 885e96df 2023-03-06 naddy ,s/^7$/b/
2359 885e96df 2023-03-06 naddy ,s/^16$/c/
2360 885e96df 2023-03-06 naddy w
2361 885e96df 2023-03-06 naddy EOF
2362 eba70f38 2019-08-08 stsp
2363 eba70f38 2019-08-08 stsp # stage first hunk and then stop responding; got should error out
2364 eba70f38 2019-08-08 stsp printf "y\n" > $testroot/patchscript
2365 eba70f38 2019-08-08 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2366 eba70f38 2019-08-08 stsp > $testroot/stdout 2> $testroot/stderr)
2367 49c543a6 2022-03-31 naddy ret=$?
2368 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2369 eba70f38 2019-08-08 stsp echo "got stage command succeeded unexpectedly" >&2
2370 eba70f38 2019-08-08 stsp test_done "$testroot" "1"
2371 eba70f38 2019-08-08 stsp return 1
2372 eba70f38 2019-08-08 stsp fi
2373 eba70f38 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
2374 eba70f38 2019-08-08 stsp -----------------------------------------------
2375 eba70f38 2019-08-08 stsp @@ -1,5 +1,5 @@
2376 eba70f38 2019-08-08 stsp 1
2377 eba70f38 2019-08-08 stsp -2
2378 eba70f38 2019-08-08 stsp +a
2379 eba70f38 2019-08-08 stsp 3
2380 eba70f38 2019-08-08 stsp 4
2381 eba70f38 2019-08-08 stsp 5
2382 eba70f38 2019-08-08 stsp -----------------------------------------------
2383 eba70f38 2019-08-08 stsp M numbers (change 1 of 3)
2384 eba70f38 2019-08-08 stsp stage this change? [y/n/q] y
2385 eba70f38 2019-08-08 stsp -----------------------------------------------
2386 eba70f38 2019-08-08 stsp @@ -4,7 +4,7 @@
2387 eba70f38 2019-08-08 stsp 4
2388 eba70f38 2019-08-08 stsp 5
2389 eba70f38 2019-08-08 stsp 6
2390 eba70f38 2019-08-08 stsp -7
2391 eba70f38 2019-08-08 stsp +b
2392 eba70f38 2019-08-08 stsp 8
2393 eba70f38 2019-08-08 stsp 9
2394 eba70f38 2019-08-08 stsp 10
2395 eba70f38 2019-08-08 stsp -----------------------------------------------
2396 eba70f38 2019-08-08 stsp M numbers (change 2 of 3)
2397 eba70f38 2019-08-08 stsp EOF
2398 eba70f38 2019-08-08 stsp echo -n "stage this change? [y/n/q] " >> $testroot/stdout.expected
2399 eba70f38 2019-08-08 stsp echo "got: invalid patch choice" > $testroot/stderr.expected
2400 eba70f38 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2401 49c543a6 2022-03-31 naddy ret=$?
2402 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2403 eba70f38 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
2404 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2405 eba70f38 2019-08-08 stsp return 1
2406 eba70f38 2019-08-08 stsp fi
2407 eba70f38 2019-08-08 stsp
2408 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2409 49c543a6 2022-03-31 naddy ret=$?
2410 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2411 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2412 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2413 eba70f38 2019-08-08 stsp return 1
2414 eba70f38 2019-08-08 stsp fi
2415 eba70f38 2019-08-08 stsp
2416 eba70f38 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
2417 eba70f38 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
2418 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2419 49c543a6 2022-03-31 naddy ret=$?
2420 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2421 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2422 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2423 eba70f38 2019-08-08 stsp return 1
2424 eba70f38 2019-08-08 stsp fi
2425 eba70f38 2019-08-08 stsp
2426 eba70f38 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2427 eba70f38 2019-08-08 stsp echo -n > $testroot/stdout.expected
2428 eba70f38 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2429 49c543a6 2022-03-31 naddy ret=$?
2430 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2431 eba70f38 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
2432 eba70f38 2019-08-08 stsp fi
2433 eba70f38 2019-08-08 stsp test_done "$testroot" "$ret"
2434 c631b115 2020-07-23 stsp
2435 c631b115 2020-07-23 stsp }
2436 c631b115 2020-07-23 stsp
2437 f6cae3ed 2020-09-13 naddy test_stage_symlink() {
2438 c631b115 2020-07-23 stsp local testroot=`test_init stage_symlink`
2439 c631b115 2020-07-23 stsp
2440 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2441 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2442 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2443 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2444 c631b115 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2445 c631b115 2020-07-23 stsp (cd $testroot/repo && git add .)
2446 c631b115 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2447 c631b115 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2448 c631b115 2020-07-23 stsp
2449 c631b115 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2450 49c543a6 2022-03-31 naddy ret=$?
2451 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2452 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2453 c631b115 2020-07-23 stsp return 1
2454 c631b115 2020-07-23 stsp fi
2455 c631b115 2020-07-23 stsp
2456 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2457 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
2458 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2459 c631b115 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2460 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2461 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2462 c631b115 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2463 c631b115 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2464 c631b115 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2465 c631b115 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2466 c631b115 2020-07-23 stsp
2467 35213c7c 2020-07-23 stsp (cd $testroot/wt && got stage > $testroot/stdout 2> $testroot/stderr)
2468 49c543a6 2022-03-31 naddy ret=$?
2469 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
2470 35213c7c 2020-07-23 stsp echo "got stage succeeded unexpectedly" >&2
2471 a19f439c 2022-06-03 op test_done "$testroot" 1
2472 35213c7c 2020-07-23 stsp return 1
2473 35213c7c 2020-07-23 stsp fi
2474 35213c7c 2020-07-23 stsp echo -n "got: $testroot/wt/dotgotbar.link: " > $testroot/stderr.expected
2475 35213c7c 2020-07-23 stsp echo "symbolic link points outside of paths under version control" \
2476 35213c7c 2020-07-23 stsp >> $testroot/stderr.expected
2477 35213c7c 2020-07-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2478 49c543a6 2022-03-31 naddy ret=$?
2479 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2480 35213c7c 2020-07-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
2481 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
2482 35213c7c 2020-07-23 stsp return 1
2483 35213c7c 2020-07-23 stsp fi
2484 35213c7c 2020-07-23 stsp
2485 35213c7c 2020-07-23 stsp (cd $testroot/wt && got stage -S > $testroot/stdout)
2486 c631b115 2020-07-23 stsp
2487 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2488 c631b115 2020-07-23 stsp M alpha.link
2489 c631b115 2020-07-23 stsp A dotgotbar.link
2490 c631b115 2020-07-23 stsp A dotgotfoo.link
2491 c631b115 2020-07-23 stsp M epsilon/beta.link
2492 c631b115 2020-07-23 stsp M epsilon.link
2493 c631b115 2020-07-23 stsp D nonexistent.link
2494 c631b115 2020-07-23 stsp A zeta.link
2495 c631b115 2020-07-23 stsp EOF
2496 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2497 49c543a6 2022-03-31 naddy ret=$?
2498 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2499 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2500 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2501 c631b115 2020-07-23 stsp return 1
2502 c631b115 2020-07-23 stsp fi
2503 0aeb8099 2020-07-23 stsp
2504 0aeb8099 2020-07-23 stsp rm $testroot/wt/alpha.link
2505 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2506 c631b115 2020-07-23 stsp
2507 c631b115 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2508 c631b115 2020-07-23 stsp
2509 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2510 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
2511 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2512 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2513 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2514 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2515 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2516 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2517 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2518 c631b115 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2519 c631b115 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2520 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2521 c631b115 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2522 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2523 c631b115 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2524 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2525 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2526 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2527 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotbar.link) | cut -d' ' -f 1 \
2528 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2529 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2530 c631b115 2020-07-23 stsp echo '+++ dotgotbar.link' >> $testroot/stdout.expected
2531 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2532 c631b115 2020-07-23 stsp echo '+.got/bar' >> $testroot/stdout.expected
2533 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2534 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2535 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2536 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2537 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2538 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2539 c631b115 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2540 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2541 c631b115 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2542 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2543 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i epsilon | grep 'beta.link@ -> ../beta$' | \
2544 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2545 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2546 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon/beta.link) | cut -d' ' -f 1 \
2547 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2548 c631b115 2020-07-23 stsp echo '--- epsilon/beta.link' >> $testroot/stdout.expected
2549 c631b115 2020-07-23 stsp echo '+++ epsilon/beta.link' >> $testroot/stdout.expected
2550 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2551 c631b115 2020-07-23 stsp echo '-../beta' >> $testroot/stdout.expected
2552 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2553 c631b115 2020-07-23 stsp echo '+../gamma/delta' >> $testroot/stdout.expected
2554 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2555 c631b115 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2556 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2557 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2558 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2559 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2560 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2561 c631b115 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2562 c631b115 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2563 c631b115 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2564 c631b115 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2565 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2566 c631b115 2020-07-23 stsp echo '+gamma' >> $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 -n 'blob - ' >> $testroot/stdout.expected
2569 c631b115 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
2570 c631b115 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2571 c631b115 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2572 c631b115 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2573 c631b115 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2574 c631b115 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2575 c631b115 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2576 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2577 c631b115 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2578 c631b115 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2579 c631b115 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2580 c631b115 2020-07-23 stsp >> $testroot/stdout.expected
2581 c631b115 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2582 c631b115 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2583 c631b115 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2584 c631b115 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2585 c631b115 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2586 c631b115 2020-07-23 stsp
2587 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2588 49c543a6 2022-03-31 naddy ret=$?
2589 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2590 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2591 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2592 c631b115 2020-07-23 stsp return 1
2593 c631b115 2020-07-23 stsp fi
2594 c631b115 2020-07-23 stsp
2595 c631b115 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2596 c631b115 2020-07-23 stsp > $testroot/stdout)
2597 49c543a6 2022-03-31 naddy ret=$?
2598 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2599 c631b115 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2600 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2601 c631b115 2020-07-23 stsp return 1
2602 c631b115 2020-07-23 stsp fi
2603 eba70f38 2019-08-08 stsp
2604 c631b115 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2605 c631b115 2020-07-23 stsp echo "A dotgotbar.link" > $testroot/stdout.expected
2606 c631b115 2020-07-23 stsp echo "A dotgotfoo.link" >> $testroot/stdout.expected
2607 c631b115 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2608 c631b115 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2609 c631b115 2020-07-23 stsp echo "M epsilon/beta.link" >> $testroot/stdout.expected
2610 c631b115 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2611 c631b115 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2612 c631b115 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2613 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2614 49c543a6 2022-03-31 naddy ret=$?
2615 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2616 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2617 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2618 c631b115 2020-07-23 stsp return 1
2619 c631b115 2020-07-23 stsp fi
2620 c631b115 2020-07-23 stsp
2621 c631b115 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2622 49c543a6 2022-03-31 naddy ret=$?
2623 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2624 c631b115 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2625 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2626 c631b115 2020-07-23 stsp return 1
2627 c631b115 2020-07-23 stsp fi
2628 c631b115 2020-07-23 stsp
2629 c631b115 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2630 c631b115 2020-07-23 stsp alpha
2631 c631b115 2020-07-23 stsp alpha.link@ -> beta
2632 c631b115 2020-07-23 stsp beta
2633 c631b115 2020-07-23 stsp dotgotbar.link@ -> .got/bar
2634 c631b115 2020-07-23 stsp dotgotfoo.link
2635 c631b115 2020-07-23 stsp epsilon/
2636 c631b115 2020-07-23 stsp epsilon.link@ -> gamma
2637 c631b115 2020-07-23 stsp gamma/
2638 c631b115 2020-07-23 stsp passwd.link@ -> /etc/passwd
2639 c631b115 2020-07-23 stsp zeta.link@ -> gamma/delta
2640 c631b115 2020-07-23 stsp EOF
2641 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2642 49c543a6 2022-03-31 naddy ret=$?
2643 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2644 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2645 c631b115 2020-07-23 stsp return 1
2646 c631b115 2020-07-23 stsp fi
2647 c631b115 2020-07-23 stsp
2648 0aeb8099 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2649 0aeb8099 2020-07-23 stsp echo "alpha.link is a symlink"
2650 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2651 c631b115 2020-07-23 stsp return 1
2652 c631b115 2020-07-23 stsp fi
2653 c631b115 2020-07-23 stsp
2654 0aeb8099 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2655 0aeb8099 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2656 0aeb8099 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2657 49c543a6 2022-03-31 naddy ret=$?
2658 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2659 0aeb8099 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2660 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2661 c631b115 2020-07-23 stsp return 1
2662 c631b115 2020-07-23 stsp fi
2663 c631b115 2020-07-23 stsp
2664 75f0a0fb 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2665 75f0a0fb 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2666 75f0a0fb 2020-07-23 stsp test_done "$testroot" "1"
2667 75f0a0fb 2020-07-23 stsp return 1
2668 75f0a0fb 2020-07-23 stsp fi
2669 75f0a0fb 2020-07-23 stsp (cd $testroot/wt && got update > /dev/null)
2670 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2671 c631b115 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2672 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2673 c631b115 2020-07-23 stsp return 1
2674 c631b115 2020-07-23 stsp fi
2675 0aeb8099 2020-07-23 stsp echo -n ".got/bar" > $testroot/content.expected
2676 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2677 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2678 49c543a6 2022-03-31 naddy ret=$?
2679 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2680 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2681 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2682 fa3cef63 2020-07-23 stsp return 1
2683 fa3cef63 2020-07-23 stsp fi
2684 fa3cef63 2020-07-23 stsp
2685 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2686 fa3cef63 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2687 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2688 fa3cef63 2020-07-23 stsp return 1
2689 fa3cef63 2020-07-23 stsp fi
2690 fa3cef63 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2691 fa3cef63 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2692 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2693 49c543a6 2022-03-31 naddy ret=$?
2694 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2695 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2696 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2697 fa3cef63 2020-07-23 stsp return 1
2698 fa3cef63 2020-07-23 stsp fi
2699 fa3cef63 2020-07-23 stsp
2700 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2701 fa3cef63 2020-07-23 stsp echo "epsilon.link is not a symlink"
2702 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2703 fa3cef63 2020-07-23 stsp return 1
2704 fa3cef63 2020-07-23 stsp fi
2705 fa3cef63 2020-07-23 stsp
2706 fa3cef63 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2707 fa3cef63 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
2708 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2709 49c543a6 2022-03-31 naddy ret=$?
2710 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2711 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2712 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2713 fa3cef63 2020-07-23 stsp return 1
2714 fa3cef63 2020-07-23 stsp fi
2715 fa3cef63 2020-07-23 stsp
2716 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2717 fa3cef63 2020-07-23 stsp echo "passwd.link is a symlink"
2718 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2719 fa3cef63 2020-07-23 stsp return 1
2720 fa3cef63 2020-07-23 stsp fi
2721 fa3cef63 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2722 fa3cef63 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2723 fa3cef63 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2724 49c543a6 2022-03-31 naddy ret=$?
2725 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2726 fa3cef63 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2727 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2728 fa3cef63 2020-07-23 stsp return 1
2729 fa3cef63 2020-07-23 stsp fi
2730 fa3cef63 2020-07-23 stsp
2731 fa3cef63 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
2732 fa3cef63 2020-07-23 stsp echo "zeta.link is not a symlink"
2733 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2734 fa3cef63 2020-07-23 stsp return 1
2735 fa3cef63 2020-07-23 stsp fi
2736 fa3cef63 2020-07-23 stsp
2737 fa3cef63 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
2738 fa3cef63 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
2739 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2740 49c543a6 2022-03-31 naddy ret=$?
2741 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2742 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2743 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2744 fa3cef63 2020-07-23 stsp return 1
2745 fa3cef63 2020-07-23 stsp fi
2746 fa3cef63 2020-07-23 stsp
2747 fa3cef63 2020-07-23 stsp test_done "$testroot" "0"
2748 fa3cef63 2020-07-23 stsp }
2749 fa3cef63 2020-07-23 stsp
2750 f6cae3ed 2020-09-13 naddy test_stage_patch_symlink() {
2751 fa3cef63 2020-07-23 stsp local testroot=`test_init stage_patch_symlink`
2752 fa3cef63 2020-07-23 stsp
2753 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2754 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2755 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2756 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2757 fa3cef63 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2758 fa3cef63 2020-07-23 stsp (cd $testroot/repo && git add .)
2759 fa3cef63 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2760 fa3cef63 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
2761 fa3cef63 2020-07-23 stsp
2762 fa3cef63 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2763 49c543a6 2022-03-31 naddy ret=$?
2764 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2765 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2766 fa3cef63 2020-07-23 stsp return 1
2767 fa3cef63 2020-07-23 stsp fi
2768 fa3cef63 2020-07-23 stsp
2769 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
2770 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
2771 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
2772 fa3cef63 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
2773 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2774 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
2775 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2776 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
2777 fa3cef63 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
2778 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
2779 fa3cef63 2020-07-23 stsp
2780 fa3cef63 2020-07-23 stsp printf "y\nn\ny\nn\ny\ny\ny" > $testroot/patchscript
2781 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -F $testroot/patchscript -p \
2782 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2783 fa3cef63 2020-07-23 stsp
2784 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2785 fa3cef63 2020-07-23 stsp -----------------------------------------------
2786 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2787 fa3cef63 2020-07-23 stsp -alpha
2788 fa3cef63 2020-07-23 stsp \ No newline at end of file
2789 fa3cef63 2020-07-23 stsp +beta
2790 fa3cef63 2020-07-23 stsp \ No newline at end of file
2791 fa3cef63 2020-07-23 stsp -----------------------------------------------
2792 fa3cef63 2020-07-23 stsp M alpha.link (change 1 of 1)
2793 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2794 fa3cef63 2020-07-23 stsp A dotgotbar.link
2795 fa3cef63 2020-07-23 stsp stage this addition? [y/n] n
2796 fa3cef63 2020-07-23 stsp A dotgotfoo.link
2797 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2798 fa3cef63 2020-07-23 stsp -----------------------------------------------
2799 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2800 fa3cef63 2020-07-23 stsp -../beta
2801 fa3cef63 2020-07-23 stsp \ No newline at end of file
2802 fa3cef63 2020-07-23 stsp +../gamma/delta
2803 fa3cef63 2020-07-23 stsp \ No newline at end of file
2804 fa3cef63 2020-07-23 stsp -----------------------------------------------
2805 fa3cef63 2020-07-23 stsp M epsilon/beta.link (change 1 of 1)
2806 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] n
2807 fa3cef63 2020-07-23 stsp -----------------------------------------------
2808 fa3cef63 2020-07-23 stsp @@ -1 +1 @@
2809 fa3cef63 2020-07-23 stsp -epsilon
2810 fa3cef63 2020-07-23 stsp \ No newline at end of file
2811 fa3cef63 2020-07-23 stsp +gamma
2812 fa3cef63 2020-07-23 stsp \ No newline at end of file
2813 fa3cef63 2020-07-23 stsp -----------------------------------------------
2814 fa3cef63 2020-07-23 stsp M epsilon.link (change 1 of 1)
2815 fa3cef63 2020-07-23 stsp stage this change? [y/n/q] y
2816 fa3cef63 2020-07-23 stsp D nonexistent.link
2817 fa3cef63 2020-07-23 stsp stage this deletion? [y/n] y
2818 fa3cef63 2020-07-23 stsp A zeta.link
2819 fa3cef63 2020-07-23 stsp stage this addition? [y/n] y
2820 fa3cef63 2020-07-23 stsp EOF
2821 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2822 49c543a6 2022-03-31 naddy ret=$?
2823 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2824 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2825 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2826 fa3cef63 2020-07-23 stsp return 1
2827 fa3cef63 2020-07-23 stsp fi
2828 fa3cef63 2020-07-23 stsp
2829 fa3cef63 2020-07-23 stsp rm $testroot/wt/alpha.link
2830 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/wt/alpha.link
2831 fa3cef63 2020-07-23 stsp
2832 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
2833 fa3cef63 2020-07-23 stsp
2834 8469d821 2022-06-25 stsp echo "diff -s $testroot/wt" > $testroot/stdout.expected
2835 8469d821 2022-06-25 stsp echo "commit - $head_commit" >> $testroot/stdout.expected
2836 8469d821 2022-06-25 stsp echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
2837 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2838 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
2839 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2840 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2841 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \
2842 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2843 fa3cef63 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
2844 fa3cef63 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
2845 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2846 fa3cef63 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
2847 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2848 fa3cef63 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
2849 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2850 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2851 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2852 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
2853 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2854 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2855 fa3cef63 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
2856 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2857 fa3cef63 2020-07-23 stsp echo '+this is regular file foo' >> $testroot/stdout.expected
2858 fa3cef63 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
2859 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
2860 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2861 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2862 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \
2863 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2864 fa3cef63 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
2865 fa3cef63 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
2866 fa3cef63 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2867 fa3cef63 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
2868 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2869 fa3cef63 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
2870 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $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 'nonexistent.link@ -> nonexistent$' | \
2873 fa3cef63 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
2874 fa3cef63 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
2875 fa3cef63 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
2876 fa3cef63 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
2877 fa3cef63 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
2878 fa3cef63 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
2879 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2880 fa3cef63 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
2881 fa3cef63 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
2882 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
2883 fa3cef63 2020-07-23 stsp >> $testroot/stdout.expected
2884 fa3cef63 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
2885 fa3cef63 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
2886 fa3cef63 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
2887 fa3cef63 2020-07-23 stsp echo '+gamma/delta' >> $testroot/stdout.expected
2888 fa3cef63 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
2889 fa3cef63 2020-07-23 stsp
2890 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2891 49c543a6 2022-03-31 naddy ret=$?
2892 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2893 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2894 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2895 fa3cef63 2020-07-23 stsp return 1
2896 fa3cef63 2020-07-23 stsp fi
2897 fa3cef63 2020-07-23 stsp
2898 fa3cef63 2020-07-23 stsp (cd $testroot/wt && got commit -m "staged symlink" \
2899 fa3cef63 2020-07-23 stsp > $testroot/stdout)
2900 49c543a6 2022-03-31 naddy ret=$?
2901 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2902 fa3cef63 2020-07-23 stsp echo "got commit command failed unexpectedly" >&2
2903 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2904 fa3cef63 2020-07-23 stsp return 1
2905 fa3cef63 2020-07-23 stsp fi
2906 fa3cef63 2020-07-23 stsp
2907 fa3cef63 2020-07-23 stsp local commit_id=`git_show_head $testroot/repo`
2908 fa3cef63 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2909 fa3cef63 2020-07-23 stsp echo "A zeta.link" >> $testroot/stdout.expected
2910 fa3cef63 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
2911 fa3cef63 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
2912 fa3cef63 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2913 fa3cef63 2020-07-23 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
2914 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2915 49c543a6 2022-03-31 naddy ret=$?
2916 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2917 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2918 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2919 fa3cef63 2020-07-23 stsp return 1
2920 fa3cef63 2020-07-23 stsp fi
2921 fa3cef63 2020-07-23 stsp
2922 fa3cef63 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id > $testroot/stdout
2923 49c543a6 2022-03-31 naddy ret=$?
2924 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2925 fa3cef63 2020-07-23 stsp echo "got tree command failed unexpectedly" >&2
2926 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2927 fa3cef63 2020-07-23 stsp return 1
2928 fa3cef63 2020-07-23 stsp fi
2929 fa3cef63 2020-07-23 stsp
2930 fa3cef63 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
2931 fa3cef63 2020-07-23 stsp alpha
2932 fa3cef63 2020-07-23 stsp alpha.link@ -> beta
2933 fa3cef63 2020-07-23 stsp beta
2934 fa3cef63 2020-07-23 stsp dotgotfoo.link
2935 fa3cef63 2020-07-23 stsp epsilon/
2936 fa3cef63 2020-07-23 stsp epsilon.link@ -> gamma
2937 fa3cef63 2020-07-23 stsp gamma/
2938 fa3cef63 2020-07-23 stsp passwd.link@ -> /etc/passwd
2939 fa3cef63 2020-07-23 stsp zeta.link@ -> gamma/delta
2940 fa3cef63 2020-07-23 stsp EOF
2941 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2942 49c543a6 2022-03-31 naddy ret=$?
2943 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2944 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2945 fa3cef63 2020-07-23 stsp return 1
2946 fa3cef63 2020-07-23 stsp fi
2947 fa3cef63 2020-07-23 stsp
2948 fa3cef63 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2949 fa3cef63 2020-07-23 stsp echo "alpha.link is a symlink"
2950 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2951 fa3cef63 2020-07-23 stsp return 1
2952 fa3cef63 2020-07-23 stsp fi
2953 fa3cef63 2020-07-23 stsp
2954 fa3cef63 2020-07-23 stsp echo 'this is regular file alpha.link' > $testroot/content.expected
2955 fa3cef63 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2956 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2957 49c543a6 2022-03-31 naddy ret=$?
2958 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2959 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2960 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2961 c631b115 2020-07-23 stsp return 1
2962 c631b115 2020-07-23 stsp fi
2963 c631b115 2020-07-23 stsp
2964 fa3cef63 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
2965 fa3cef63 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
2966 fa3cef63 2020-07-23 stsp test_done "$testroot" "1"
2967 fa3cef63 2020-07-23 stsp return 1
2968 fa3cef63 2020-07-23 stsp fi
2969 fa3cef63 2020-07-23 stsp readlink $testroot/wt/dotgotbar.link > $testroot/stdout
2970 fa3cef63 2020-07-23 stsp echo ".got/bar" > $testroot/stdout.expected
2971 fa3cef63 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2972 49c543a6 2022-03-31 naddy ret=$?
2973 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2974 fa3cef63 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2975 fa3cef63 2020-07-23 stsp test_done "$testroot" "$ret"
2976 fa3cef63 2020-07-23 stsp return 1
2977 fa3cef63 2020-07-23 stsp fi
2978 fa3cef63 2020-07-23 stsp
2979 c631b115 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2980 c631b115 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2981 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2982 c631b115 2020-07-23 stsp return 1
2983 c631b115 2020-07-23 stsp fi
2984 c631b115 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
2985 c631b115 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2986 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2987 49c543a6 2022-03-31 naddy ret=$?
2988 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2989 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2990 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
2991 c631b115 2020-07-23 stsp return 1
2992 c631b115 2020-07-23 stsp fi
2993 c631b115 2020-07-23 stsp
2994 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2995 c631b115 2020-07-23 stsp echo "epsilon.link is not a symlink"
2996 c631b115 2020-07-23 stsp test_done "$testroot" "1"
2997 c631b115 2020-07-23 stsp return 1
2998 c631b115 2020-07-23 stsp fi
2999 c631b115 2020-07-23 stsp
3000 c631b115 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
3001 c631b115 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
3002 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3003 49c543a6 2022-03-31 naddy ret=$?
3004 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3005 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3006 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3007 c631b115 2020-07-23 stsp return 1
3008 c631b115 2020-07-23 stsp fi
3009 c631b115 2020-07-23 stsp
3010 c631b115 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
3011 c631b115 2020-07-23 stsp echo "passwd.link is a symlink"
3012 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3013 c631b115 2020-07-23 stsp return 1
3014 c631b115 2020-07-23 stsp fi
3015 c631b115 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
3016 c631b115 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
3017 c631b115 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
3018 49c543a6 2022-03-31 naddy ret=$?
3019 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3020 c631b115 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
3021 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3022 c631b115 2020-07-23 stsp return 1
3023 c631b115 2020-07-23 stsp fi
3024 c631b115 2020-07-23 stsp
3025 c631b115 2020-07-23 stsp if ! [ -h $testroot/wt/zeta.link ]; then
3026 c631b115 2020-07-23 stsp echo "zeta.link is not a symlink"
3027 c631b115 2020-07-23 stsp test_done "$testroot" "1"
3028 c631b115 2020-07-23 stsp return 1
3029 c631b115 2020-07-23 stsp fi
3030 c631b115 2020-07-23 stsp
3031 c631b115 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
3032 c631b115 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
3033 c631b115 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3034 49c543a6 2022-03-31 naddy ret=$?
3035 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3036 c631b115 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
3037 c631b115 2020-07-23 stsp test_done "$testroot" "$ret"
3038 c631b115 2020-07-23 stsp return 1
3039 c631b115 2020-07-23 stsp fi
3040 c631b115 2020-07-23 stsp
3041 c631b115 2020-07-23 stsp test_done "$testroot" "0"
3042 eba70f38 2019-08-08 stsp }
3043 eba70f38 2019-08-08 stsp
3044 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3045 fccbfb98 2019-08-03 stsp run_test test_stage_basic
3046 31b20a6e 2019-08-06 stsp run_test test_stage_no_changes
3047 8b13ce36 2019-08-08 stsp run_test test_stage_unversioned
3048 8564cb21 2019-08-08 stsp run_test test_stage_nonexistent
3049 a4f692bb 2019-08-04 stsp run_test test_stage_list
3050 ebf48fd5 2019-08-03 stsp run_test test_stage_conflict
3051 735ef5ac 2019-08-03 stsp run_test test_stage_out_of_date
3052 d3e7c587 2019-08-03 stsp run_test test_double_stage
3053 c363b2c1 2019-08-03 stsp run_test test_stage_status
3054 1e1446d3 2019-08-03 stsp run_test test_stage_add_already_staged_file
3055 9acbc4fa 2019-08-03 stsp run_test test_stage_rm_already_staged_file
3056 24278f30 2019-08-03 stsp run_test test_stage_revert
3057 408b4ebc 2019-08-03 stsp run_test test_stage_diff
3058 b9622844 2019-08-03 stsp run_test test_stage_histedit
3059 243d7cf1 2019-08-03 stsp run_test test_stage_rebase
3060 a76c42e6 2019-08-03 stsp run_test test_stage_update
3061 f0b75401 2019-08-03 stsp run_test test_stage_commit_non_staged
3062 0f1cfa7f 2019-08-08 stsp run_test test_stage_commit_out_of_date
3063 5f8a88c6 2019-08-03 stsp run_test test_stage_commit
3064 dc424a06 2019-08-07 stsp run_test test_stage_patch
3065 af5a81b2 2019-08-08 stsp run_test test_stage_patch_twice
3066 dc424a06 2019-08-07 stsp run_test test_stage_patch_added
3067 e70a841e 2019-08-08 stsp run_test test_stage_patch_added_twice
3068 dc424a06 2019-08-07 stsp run_test test_stage_patch_removed
3069 e70a841e 2019-08-08 stsp run_test test_stage_patch_removed_twice
3070 9fdde394 2022-06-04 op run_test test_stage_patch_reversed
3071 b353a198 2019-08-07 stsp run_test test_stage_patch_quit
3072 eba70f38 2019-08-08 stsp run_test test_stage_patch_incomplete_script
3073 c631b115 2020-07-23 stsp run_test test_stage_symlink
3074 fa3cef63 2020-07-23 stsp run_test test_stage_patch_symlink