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