3 ad493afc 2019-08-03 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 ad493afc 2019-08-03 stsp # Permission to use, copy, modify, and distribute this software for any
6 ad493afc 2019-08-03 stsp # purpose with or without fee is hereby granted, provided that the above
7 ad493afc 2019-08-03 stsp # copyright notice and this permission notice appear in all copies.
9 ad493afc 2019-08-03 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 ad493afc 2019-08-03 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 ad493afc 2019-08-03 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 ad493afc 2019-08-03 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 ad493afc 2019-08-03 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 ad493afc 2019-08-03 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 ad493afc 2019-08-03 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 ad493afc 2019-08-03 stsp . ./common.sh
19 ad493afc 2019-08-03 stsp function test_unstage_basic {
20 ad493afc 2019-08-03 stsp local testroot=`test_init unstage_basic`
22 ad493afc 2019-08-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 ad493afc 2019-08-03 stsp if [ "$ret" != "0" ]; then
25 ad493afc 2019-08-03 stsp test_done "$testroot" "$ret"
29 ad493afc 2019-08-03 stsp echo "modified file" > $testroot/wt/alpha
30 ad493afc 2019-08-03 stsp (cd $testroot/wt && got rm beta > /dev/null)
31 ad493afc 2019-08-03 stsp echo "new file" > $testroot/wt/foo
32 ad493afc 2019-08-03 stsp (cd $testroot/wt && got add foo > /dev/null)
34 ad493afc 2019-08-03 stsp echo ' M alpha' > $testroot/stdout.expected
35 ad493afc 2019-08-03 stsp echo ' D beta' >> $testroot/stdout.expected
36 ad493afc 2019-08-03 stsp echo ' A foo' >> $testroot/stdout.expected
37 ad493afc 2019-08-03 stsp (cd $testroot/wt && got stage alpha beta foo > /dev/null)
39 ad493afc 2019-08-03 stsp (cd $testroot/wt && got unstage > $testroot/stdout)
41 ad493afc 2019-08-03 stsp if [ "$ret" != "0" ]; then
42 57ba6a8b 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
43 ad493afc 2019-08-03 stsp test_done "$testroot" "1"
47 ad493afc 2019-08-03 stsp echo 'G alpha' > $testroot/stdout.expected
48 ad493afc 2019-08-03 stsp echo 'D beta' >> $testroot/stdout.expected
49 ad493afc 2019-08-03 stsp echo 'G foo' >> $testroot/stdout.expected
50 ad493afc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
52 ad493afc 2019-08-03 stsp if [ "$ret" != "0" ]; then
53 ad493afc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
54 ad493afc 2019-08-03 stsp test_done "$testroot" "$ret"
58 ad493afc 2019-08-03 stsp echo 'M alpha' > $testroot/stdout.expected
59 ad493afc 2019-08-03 stsp echo 'D beta' >> $testroot/stdout.expected
60 ad493afc 2019-08-03 stsp echo 'A foo' >> $testroot/stdout.expected
61 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
62 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
64 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
65 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
67 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
70 8b13ce36 2019-08-08 stsp function test_unstage_unversioned {
71 8b13ce36 2019-08-08 stsp local testroot=`test_init unstage_unversioned`
73 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
75 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
76 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
80 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
81 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
82 8b13ce36 2019-08-08 stsp echo "new file" > $testroot/wt/foo
83 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
85 8b13ce36 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
86 8b13ce36 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
87 8b13ce36 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
88 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
90 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
92 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
93 8b13ce36 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
94 8b13ce36 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
95 8b13ce36 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
96 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
97 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
99 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
100 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
101 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
105 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got unstage > $testroot/stdout)
107 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
108 8b13ce36 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
109 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
113 8b13ce36 2019-08-08 stsp echo 'G alpha' > $testroot/stdout.expected
114 8b13ce36 2019-08-08 stsp echo 'D beta' >> $testroot/stdout.expected
115 8b13ce36 2019-08-08 stsp echo 'G foo' >> $testroot/stdout.expected
116 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
118 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
119 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
120 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
124 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
126 8b13ce36 2019-08-08 stsp # unstaging an unversioned path is a no-op
127 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got unstage unversioned > $testroot/stdout)
129 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
130 8b13ce36 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
131 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
135 8b13ce36 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
136 8b13ce36 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
137 8b13ce36 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
138 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
139 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
140 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
142 8b13ce36 2019-08-08 stsp if [ "$ret" != "0" ]; then
143 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
145 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
148 8564cb21 2019-08-08 stsp function test_unstage_nonexistent {
149 8564cb21 2019-08-08 stsp local testroot=`test_init unstage_nonexistent`
151 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
153 8564cb21 2019-08-08 stsp if [ "$ret" != "0" ]; then
154 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
158 8564cb21 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
159 8564cb21 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
160 8564cb21 2019-08-08 stsp echo "new file" > $testroot/wt/foo
161 8564cb21 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
163 8564cb21 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
164 8564cb21 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
165 8564cb21 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
166 8564cb21 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
168 8564cb21 2019-08-08 stsp # unstaging a non-existent file is a no-op
169 8564cb21 2019-08-08 stsp (cd $testroot/wt && got unstage nonexistent-file > $testroot/stdout)
171 8564cb21 2019-08-08 stsp if [ "$ret" != "0" ]; then
172 8564cb21 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
173 8564cb21 2019-08-08 stsp test_done "$testroot" "1"
177 8564cb21 2019-08-08 stsp echo -n > $testroot/stdout.expected
178 8564cb21 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
180 8564cb21 2019-08-08 stsp if [ "$ret" != "0" ]; then
181 8564cb21 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
183 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
186 2e1f37b0 2019-08-08 stsp function test_unstage_patch {
187 2e1f37b0 2019-08-08 stsp local testroot=`test_init unstage_patch`
189 2e1f37b0 2019-08-08 stsp jot 16 > $testroot/repo/numbers
190 2e1f37b0 2019-08-08 stsp (cd $testroot/repo && git add numbers)
191 2e1f37b0 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
192 2e1f37b0 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
194 2e1f37b0 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
196 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
197 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
201 2e1f37b0 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
202 2e1f37b0 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
203 2e1f37b0 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
205 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
207 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
208 2e1f37b0 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
209 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
213 2e1f37b0 2019-08-08 stsp # don't unstage any hunks
214 2e1f37b0 2019-08-08 stsp printf "n\nn\nn\n" > $testroot/patchscript
215 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
216 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
218 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
219 57ba6a8b 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
220 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
223 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
224 2e1f37b0 2019-08-08 stsp -----------------------------------------------
225 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
232 2e1f37b0 2019-08-08 stsp -----------------------------------------------
233 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
234 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
235 2e1f37b0 2019-08-08 stsp -----------------------------------------------
236 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
245 2e1f37b0 2019-08-08 stsp -----------------------------------------------
246 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
247 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
248 2e1f37b0 2019-08-08 stsp -----------------------------------------------
249 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
255 2e1f37b0 2019-08-08 stsp -----------------------------------------------
256 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
257 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
259 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
261 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
262 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
263 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
267 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
268 2e1f37b0 2019-08-08 stsp echo " M numbers" > $testroot/stdout.expected
269 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
271 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
272 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
273 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
277 2e1f37b0 2019-08-08 stsp # unstage middle hunk
278 2e1f37b0 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
279 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
280 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
282 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
283 2e1f37b0 2019-08-08 stsp -----------------------------------------------
284 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
291 2e1f37b0 2019-08-08 stsp -----------------------------------------------
292 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
293 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
294 2e1f37b0 2019-08-08 stsp -----------------------------------------------
295 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
304 2e1f37b0 2019-08-08 stsp -----------------------------------------------
305 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
306 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
307 2e1f37b0 2019-08-08 stsp -----------------------------------------------
308 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
314 2e1f37b0 2019-08-08 stsp -----------------------------------------------
315 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
316 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
319 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
321 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
322 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
323 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
327 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
328 2e1f37b0 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
329 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
331 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
332 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
333 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
337 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
339 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
340 2e1f37b0 2019-08-08 stsp > $testroot/stdout.expected
341 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
342 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
343 2e1f37b0 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
344 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
345 2e1f37b0 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
346 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
347 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
348 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
349 2e1f37b0 2019-08-08 stsp --- numbers
350 2e1f37b0 2019-08-08 stsp +++ numbers
351 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
358 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
365 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
367 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
368 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
369 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
373 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
374 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
375 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
376 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
377 4ce46740 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
378 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
379 2e1f37b0 2019-08-08 stsp echo "file + numbers" >> $testroot/stdout.expected
380 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
381 2e1f37b0 2019-08-08 stsp --- numbers
382 2e1f37b0 2019-08-08 stsp +++ numbers
383 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@ a
393 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
395 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
396 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
397 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
401 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage >/dev/null)
403 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
404 2e1f37b0 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
405 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
409 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
410 2e1f37b0 2019-08-08 stsp echo " M numbers" > $testroot/stdout.expected
411 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
413 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
414 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
415 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
419 2e1f37b0 2019-08-08 stsp # unstage last hunk
420 2e1f37b0 2019-08-08 stsp printf "n\nn\ny\n" > $testroot/patchscript
421 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
422 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
424 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
425 2e1f37b0 2019-08-08 stsp -----------------------------------------------
426 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
433 2e1f37b0 2019-08-08 stsp -----------------------------------------------
434 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
435 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
436 2e1f37b0 2019-08-08 stsp -----------------------------------------------
437 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
446 2e1f37b0 2019-08-08 stsp -----------------------------------------------
447 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
448 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
449 2e1f37b0 2019-08-08 stsp -----------------------------------------------
450 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
456 2e1f37b0 2019-08-08 stsp -----------------------------------------------
457 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
458 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
461 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
463 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
464 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
465 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
469 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
470 2e1f37b0 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
471 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
473 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
474 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
475 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
479 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
481 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
482 2e1f37b0 2019-08-08 stsp > $testroot/stdout.expected
483 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
484 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
485 2e1f37b0 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
486 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
487 2e1f37b0 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
488 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
489 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
490 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
491 2e1f37b0 2019-08-08 stsp --- numbers
492 2e1f37b0 2019-08-08 stsp +++ numbers
493 2e1f37b0 2019-08-08 stsp @@ -1,10 +1,10 @@
507 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
509 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
510 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
511 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
515 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
516 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
517 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
518 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
519 4ce46740 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
520 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
521 2e1f37b0 2019-08-08 stsp echo "file + numbers" >> $testroot/stdout.expected
522 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
523 2e1f37b0 2019-08-08 stsp --- numbers
524 2e1f37b0 2019-08-08 stsp +++ numbers
525 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@ b
532 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
534 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
535 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
536 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
540 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage >/dev/null)
542 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
543 2e1f37b0 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
544 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
548 ad493afc 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
549 2e1f37b0 2019-08-08 stsp echo " M numbers" > $testroot/stdout.expected
550 ad493afc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
552 ad493afc 2019-08-03 stsp if [ "$ret" != "0" ]; then
553 ad493afc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
554 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
558 2e1f37b0 2019-08-08 stsp # unstage all hunks
559 2e1f37b0 2019-08-08 stsp printf "y\ny\ny\n" > $testroot/patchscript
560 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
561 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
563 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
564 2e1f37b0 2019-08-08 stsp -----------------------------------------------
565 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
572 2e1f37b0 2019-08-08 stsp -----------------------------------------------
573 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
574 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
575 2e1f37b0 2019-08-08 stsp -----------------------------------------------
576 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
585 2e1f37b0 2019-08-08 stsp -----------------------------------------------
586 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
587 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
588 2e1f37b0 2019-08-08 stsp -----------------------------------------------
589 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
595 2e1f37b0 2019-08-08 stsp -----------------------------------------------
596 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
597 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
600 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
602 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
603 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
604 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
608 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
609 2e1f37b0 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
610 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
612 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
613 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
614 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
618 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
619 2e1f37b0 2019-08-08 stsp echo -n > $testroot/stdout.expected
620 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
622 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
623 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
624 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
628 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
630 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
631 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
632 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
633 2e1f37b0 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
634 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
635 2e1f37b0 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
636 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
637 2e1f37b0 2019-08-08 stsp --- numbers
638 2e1f37b0 2019-08-08 stsp +++ numbers
639 2e1f37b0 2019-08-08 stsp @@ -1,10 +1,10 @@
652 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
659 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
661 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
662 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
664 ad493afc 2019-08-03 stsp test_done "$testroot" "$ret"
668 2e1f37b0 2019-08-08 stsp function test_unstage_patch_added {
669 2e1f37b0 2019-08-08 stsp local testroot=`test_init unstage_patch_added`
670 2e1f37b0 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
672 2e1f37b0 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
674 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
675 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
679 2e1f37b0 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
680 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
682 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
684 2e1f37b0 2019-08-08 stsp printf "y\n" > $testroot/patchscript
685 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
686 2e1f37b0 2019-08-08 stsp epsilon/new > $testroot/stdout)
688 2e1f37b0 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
689 2e1f37b0 2019-08-08 stsp echo "unstage this addition? [y/n] y" >> $testroot/stdout.expected
690 2e1f37b0 2019-08-08 stsp echo "G epsilon/new" >> $testroot/stdout.expected
691 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
693 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
694 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
695 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
699 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
700 2e1f37b0 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
701 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
703 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
704 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
705 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
709 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
710 2e1f37b0 2019-08-08 stsp echo -n > $testroot/stdout.expected
711 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
713 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
714 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
715 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
719 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
721 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
722 2e1f37b0 2019-08-08 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
723 2e1f37b0 2019-08-08 stsp echo 'file + epsilon/new' >> $testroot/stdout.expected
724 2e1f37b0 2019-08-08 stsp echo "--- epsilon/new" >> $testroot/stdout.expected
725 2e1f37b0 2019-08-08 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
726 2e1f37b0 2019-08-08 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
727 2e1f37b0 2019-08-08 stsp echo "+new" >> $testroot/stdout.expected
728 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
730 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
731 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
733 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
736 2e1f37b0 2019-08-08 stsp function test_unstage_patch_removed {
737 2e1f37b0 2019-08-08 stsp local testroot=`test_init unstage_patch_removed`
738 2e1f37b0 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
740 2e1f37b0 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
742 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
743 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
747 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
748 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
750 2e1f37b0 2019-08-08 stsp printf "y\n" > $testroot/patchscript
751 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
752 2e1f37b0 2019-08-08 stsp beta > $testroot/stdout)
754 2e1f37b0 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
755 2e1f37b0 2019-08-08 stsp echo "unstage this deletion? [y/n] y" >> $testroot/stdout.expected
756 2e1f37b0 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
757 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
759 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
760 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
761 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
765 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
766 2e1f37b0 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
767 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
769 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
770 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
771 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
775 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
776 2e1f37b0 2019-08-08 stsp echo -n > $testroot/stdout.expected
777 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
779 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
780 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
781 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
785 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
787 2e1f37b0 2019-08-08 stsp echo "diff $commit_id $testroot/wt" \
788 2e1f37b0 2019-08-08 stsp > $testroot/stdout.expected
789 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
790 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
791 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
792 2e1f37b0 2019-08-08 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
793 2e1f37b0 2019-08-08 stsp echo "--- beta" >> $testroot/stdout.expected
794 2e1f37b0 2019-08-08 stsp echo "+++ beta" >> $testroot/stdout.expected
795 2e1f37b0 2019-08-08 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
796 2e1f37b0 2019-08-08 stsp echo "-beta" >> $testroot/stdout.expected
797 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
799 2e1f37b0 2019-08-08 stsp if [ "$ret" != "0" ]; then
800 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
802 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
805 19e4b907 2019-08-08 stsp function test_unstage_patch_quit {
806 19e4b907 2019-08-08 stsp local testroot=`test_init unstage_patch_quit`
808 19e4b907 2019-08-08 stsp jot 16 > $testroot/repo/numbers
809 19e4b907 2019-08-08 stsp echo zzz > $testroot/repo/zzz
810 19e4b907 2019-08-08 stsp (cd $testroot/repo && git add numbers zzz)
811 19e4b907 2019-08-08 stsp git_commit $testroot/repo -m "added files"
812 19e4b907 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
814 19e4b907 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
816 19e4b907 2019-08-08 stsp if [ "$ret" != "0" ]; then
817 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
821 19e4b907 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
822 19e4b907 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
823 19e4b907 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
824 19e4b907 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
825 19e4b907 2019-08-08 stsp (cd $testroot/wt && got stage > /dev/null)
827 19e4b907 2019-08-08 stsp # unstage first hunk and quit; and don't pass a path argument to
828 19e4b907 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
829 19e4b907 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
830 19e4b907 2019-08-08 stsp (cd $testroot/wt && got unstage -F $testroot/patchscript -p \
831 19e4b907 2019-08-08 stsp > $testroot/stdout)
833 19e4b907 2019-08-08 stsp if [ "$ret" != "0" ]; then
834 57ba6a8b 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
835 19e4b907 2019-08-08 stsp test_done "$testroot" "1"
838 19e4b907 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
839 19e4b907 2019-08-08 stsp -----------------------------------------------
840 19e4b907 2019-08-08 stsp @@ -1,5 +1,5 @@
847 19e4b907 2019-08-08 stsp -----------------------------------------------
848 19e4b907 2019-08-08 stsp M numbers (change 1 of 3)
849 19e4b907 2019-08-08 stsp unstage this change? [y/n/q] y
850 19e4b907 2019-08-08 stsp -----------------------------------------------
851 19e4b907 2019-08-08 stsp @@ -4,7 +4,7 @@
860 19e4b907 2019-08-08 stsp -----------------------------------------------
861 19e4b907 2019-08-08 stsp M numbers (change 2 of 3)
862 19e4b907 2019-08-08 stsp unstage this change? [y/n/q] q
865 19e4b907 2019-08-08 stsp unstage this deletion? [y/n] n
867 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
869 19e4b907 2019-08-08 stsp if [ "$ret" != "0" ]; then
870 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
871 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
875 19e4b907 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
876 19e4b907 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
877 19e4b907 2019-08-08 stsp echo " D zzz" >> $testroot/stdout.expected
878 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
880 19e4b907 2019-08-08 stsp if [ "$ret" != "0" ]; then
881 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
882 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
886 19e4b907 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
888 19e4b907 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
889 19e4b907 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
890 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
891 4ce46740 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
892 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
893 19e4b907 2019-08-08 stsp echo "file + numbers" >> $testroot/stdout.expected
894 19e4b907 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
895 19e4b907 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
896 19e4b907 2019-08-08 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
897 19e4b907 2019-08-08 stsp echo " 1" >> $testroot/stdout.expected
898 19e4b907 2019-08-08 stsp echo "-2" >> $testroot/stdout.expected
899 19e4b907 2019-08-08 stsp echo "+a" >> $testroot/stdout.expected
900 19e4b907 2019-08-08 stsp echo " 3" >> $testroot/stdout.expected
901 19e4b907 2019-08-08 stsp echo " 4" >> $testroot/stdout.expected
902 19e4b907 2019-08-08 stsp echo " 5" >> $testroot/stdout.expected
903 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
905 19e4b907 2019-08-08 stsp if [ "$ret" != "0" ]; then
906 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
907 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
911 19e4b907 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
912 19e4b907 2019-08-08 stsp echo "diff $commit_id $testroot/wt (staged changes)" \
913 19e4b907 2019-08-08 stsp > $testroot/stdout.expected
914 19e4b907 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
915 19e4b907 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
916 19e4b907 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
917 19e4b907 2019-08-08 stsp >> $testroot/stdout.expected
918 19e4b907 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
919 19e4b907 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
920 19e4b907 2019-08-08 stsp >> $testroot/stdout.expected
921 19e4b907 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
922 19e4b907 2019-08-08 stsp --- numbers
923 19e4b907 2019-08-08 stsp +++ numbers
924 19e4b907 2019-08-08 stsp @@ -4,7 +4,7 @@
933 19e4b907 2019-08-08 stsp @@ -13,4 +13,4 @@
940 19e4b907 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
941 19e4b907 2019-08-08 stsp got tree -r $testroot/repo -i | grep 'zzz$' | cut -d' ' -f 1 \
942 19e4b907 2019-08-08 stsp >> $testroot/stdout.expected
943 19e4b907 2019-08-08 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
944 19e4b907 2019-08-08 stsp echo "--- zzz" >> $testroot/stdout.expected
945 19e4b907 2019-08-08 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
946 19e4b907 2019-08-08 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
947 19e4b907 2019-08-08 stsp echo "-zzz" >> $testroot/stdout.expected
948 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
950 19e4b907 2019-08-08 stsp if [ "$ret" != "0" ]; then
951 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
953 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
956 ad493afc 2019-08-03 stsp run_test test_unstage_basic
957 8b13ce36 2019-08-08 stsp run_test test_unstage_unversioned
958 8564cb21 2019-08-08 stsp run_test test_unstage_nonexistent
959 2e1f37b0 2019-08-08 stsp run_test test_unstage_patch
960 2e1f37b0 2019-08-08 stsp run_test test_unstage_patch_added
961 2e1f37b0 2019-08-08 stsp run_test test_unstage_patch_removed
962 19e4b907 2019-08-08 stsp run_test test_unstage_patch_quit