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 f6cae3ed 2020-09-13 naddy 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 fc414659 2022-04-16 thomas if [ $ret -ne 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 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R > $testroot/stdout)
41 fc414659 2022-04-16 thomas if [ $ret -ne 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 fc414659 2022-04-16 thomas if [ $ret -ne 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 fc414659 2022-04-16 thomas if [ $ret -ne 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 a6dfa7b2 2024-04-25 thomas.ad test_unstage_directory() {
71 a6dfa7b2 2024-04-25 thomas.ad local testroot=`test_init unstage_directory`
73 a6dfa7b2 2024-04-25 thomas.ad got checkout $testroot/repo $testroot/wt > /dev/null
75 a6dfa7b2 2024-04-25 thomas.ad if [ $ret -ne 0 ]; then
76 a6dfa7b2 2024-04-25 thomas.ad test_done "$testroot" "$ret"
77 a6dfa7b2 2024-04-25 thomas.ad return 1
80 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && echo -n > test && got add test > /dev/null \
81 a6dfa7b2 2024-04-25 thomas.ad && got stage test > /dev/null)
83 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage . > $testroot/stdout 2> $testroot/stderr)
85 a6dfa7b2 2024-04-25 thomas.ad echo "got: unstaging directories requires -R option" \
86 a6dfa7b2 2024-04-25 thomas.ad > $testroot/stderr.expected
87 a6dfa7b2 2024-04-25 thomas.ad cmp -s $testroot/stderr.expected $testroot/stderr
89 a6dfa7b2 2024-04-25 thomas.ad if [ $ret -ne 0 ]; then
90 a6dfa7b2 2024-04-25 thomas.ad diff -u $testroot/stderr.expected $testroot/stderr
91 a6dfa7b2 2024-04-25 thomas.ad test_done "$testroot" "$ret"
92 a6dfa7b2 2024-04-25 thomas.ad return 1
95 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R . > $testroot/stdout)
97 a6dfa7b2 2024-04-25 thomas.ad echo 'G test' >> $testroot/stdout.expected
99 a6dfa7b2 2024-04-25 thomas.ad cmp -s $testroot/stdout.expected $testroot/stdout
100 a6dfa7b2 2024-04-25 thomas.ad ret=$?
101 a6dfa7b2 2024-04-25 thomas.ad if [ $ret -ne 0 ]; then
102 a6dfa7b2 2024-04-25 thomas.ad diff -u $testroot/stdout.expected $testroot/stdout
104 d9dd1b28 2024-04-25 thomas.ad test_done "$testroot" "$ret"
107 f6cae3ed 2020-09-13 naddy test_unstage_unversioned() {
108 8b13ce36 2019-08-08 stsp local testroot=`test_init unstage_unversioned`
110 8b13ce36 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
112 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
113 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
117 8b13ce36 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
118 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
119 8b13ce36 2019-08-08 stsp echo "new file" > $testroot/wt/foo
120 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
122 8b13ce36 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
123 8b13ce36 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
124 8b13ce36 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
125 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
127 8b13ce36 2019-08-08 stsp touch $testroot/wt/unversioned-file
129 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
130 8b13ce36 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
131 8b13ce36 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
132 8b13ce36 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
133 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
134 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
136 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
137 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
138 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
142 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R > $testroot/stdout)
144 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
145 8b13ce36 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
146 8b13ce36 2019-08-08 stsp test_done "$testroot" "1"
150 8b13ce36 2019-08-08 stsp echo 'G alpha' > $testroot/stdout.expected
151 8b13ce36 2019-08-08 stsp echo 'D beta' >> $testroot/stdout.expected
152 8b13ce36 2019-08-08 stsp echo 'G foo' >> $testroot/stdout.expected
153 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
155 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
156 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
157 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
161 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
163 8b13ce36 2019-08-08 stsp # unstaging an unversioned path is a no-op
164 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got unstage unversioned > $testroot/stdout)
166 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
167 8b13ce36 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
168 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
172 8b13ce36 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
173 8b13ce36 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
174 8b13ce36 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
175 8b13ce36 2019-08-08 stsp echo "? unversioned-file" >> $testroot/stdout.expected
176 8b13ce36 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
177 8b13ce36 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
179 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
180 8b13ce36 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
182 8b13ce36 2019-08-08 stsp test_done "$testroot" "$ret"
185 f6cae3ed 2020-09-13 naddy test_unstage_nonexistent() {
186 8564cb21 2019-08-08 stsp local testroot=`test_init unstage_nonexistent`
188 8564cb21 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
190 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
191 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
195 8564cb21 2019-08-08 stsp echo "modified file" > $testroot/wt/alpha
196 8564cb21 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
197 8564cb21 2019-08-08 stsp echo "new file" > $testroot/wt/foo
198 8564cb21 2019-08-08 stsp (cd $testroot/wt && got add foo > /dev/null)
200 8564cb21 2019-08-08 stsp echo ' M alpha' > $testroot/stdout.expected
201 8564cb21 2019-08-08 stsp echo ' D beta' >> $testroot/stdout.expected
202 8564cb21 2019-08-08 stsp echo ' A foo' >> $testroot/stdout.expected
203 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
205 8564cb21 2019-08-08 stsp # unstaging a non-existent file is a no-op
206 8564cb21 2019-08-08 stsp (cd $testroot/wt && got unstage nonexistent-file > $testroot/stdout)
208 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
209 8564cb21 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
210 8564cb21 2019-08-08 stsp test_done "$testroot" "1"
214 8564cb21 2019-08-08 stsp echo -n > $testroot/stdout.expected
215 8564cb21 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
217 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
218 8564cb21 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
220 8564cb21 2019-08-08 stsp test_done "$testroot" "$ret"
223 f6cae3ed 2020-09-13 naddy test_unstage_patch() {
224 2e1f37b0 2019-08-08 stsp local testroot=`test_init unstage_patch`
226 cf85a643 2024-04-09 thomas seq 16 > $testroot/repo/numbers
227 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add numbers
228 2e1f37b0 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
229 2e1f37b0 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
231 2e1f37b0 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
233 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
234 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
238 ac3cdf31 2023-03-06 thomas ed -s $testroot/wt/numbers <<-\EOF
239 ac3cdf31 2023-03-06 thomas ,s/^2$/a/
240 ac3cdf31 2023-03-06 thomas ,s/^7$/b/
241 ac3cdf31 2023-03-06 thomas ,s/^16$/c/
245 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
247 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
248 2e1f37b0 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
249 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
253 2e1f37b0 2019-08-08 stsp # don't unstage any hunks
254 2e1f37b0 2019-08-08 stsp printf "n\nn\nn\n" > $testroot/patchscript
255 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
256 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
258 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
259 57ba6a8b 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
260 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
263 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
264 2e1f37b0 2019-08-08 stsp -----------------------------------------------
265 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
272 2e1f37b0 2019-08-08 stsp -----------------------------------------------
273 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
274 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
275 2e1f37b0 2019-08-08 stsp -----------------------------------------------
276 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
285 2e1f37b0 2019-08-08 stsp -----------------------------------------------
286 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
287 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
288 2e1f37b0 2019-08-08 stsp -----------------------------------------------
289 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
295 2e1f37b0 2019-08-08 stsp -----------------------------------------------
296 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
297 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
299 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
301 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
302 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
303 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
307 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
308 2e1f37b0 2019-08-08 stsp echo " M numbers" > $testroot/stdout.expected
309 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
311 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
312 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
313 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
317 2e1f37b0 2019-08-08 stsp # unstage middle hunk
318 2e1f37b0 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
319 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
320 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
322 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
323 2e1f37b0 2019-08-08 stsp -----------------------------------------------
324 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
331 2e1f37b0 2019-08-08 stsp -----------------------------------------------
332 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
333 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
334 2e1f37b0 2019-08-08 stsp -----------------------------------------------
335 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
344 2e1f37b0 2019-08-08 stsp -----------------------------------------------
345 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
346 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
347 2e1f37b0 2019-08-08 stsp -----------------------------------------------
348 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
354 2e1f37b0 2019-08-08 stsp -----------------------------------------------
355 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
356 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
359 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
361 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
362 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
363 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
367 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
368 2e1f37b0 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
369 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
371 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
372 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
373 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
377 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
379 9b4458b4 2022-06-26 thomas echo "diff -s $testroot/wt" > $testroot/stdout.expected
380 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
381 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
382 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
383 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
384 2e1f37b0 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
385 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
386 2e1f37b0 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
387 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
388 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
389 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
390 2e1f37b0 2019-08-08 stsp --- numbers
391 2e1f37b0 2019-08-08 stsp +++ numbers
392 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
399 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
406 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
408 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
409 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
410 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
414 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
415 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
416 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
417 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
418 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
419 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
420 4ce46740 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
421 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
422 2e1f37b0 2019-08-08 stsp echo "file + numbers" >> $testroot/stdout.expected
423 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
424 2e1f37b0 2019-08-08 stsp --- numbers
425 2e1f37b0 2019-08-08 stsp +++ numbers
426 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@ a
436 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
438 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
439 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
440 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
444 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R >/dev/null)
446 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
447 2e1f37b0 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
448 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
452 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
453 2e1f37b0 2019-08-08 stsp echo " M numbers" > $testroot/stdout.expected
454 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
456 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
457 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
458 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
462 2e1f37b0 2019-08-08 stsp # unstage last hunk
463 2e1f37b0 2019-08-08 stsp printf "n\nn\ny\n" > $testroot/patchscript
464 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
465 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
467 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
468 2e1f37b0 2019-08-08 stsp -----------------------------------------------
469 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
476 2e1f37b0 2019-08-08 stsp -----------------------------------------------
477 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
478 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
479 2e1f37b0 2019-08-08 stsp -----------------------------------------------
480 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
489 2e1f37b0 2019-08-08 stsp -----------------------------------------------
490 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
491 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] n
492 2e1f37b0 2019-08-08 stsp -----------------------------------------------
493 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
499 2e1f37b0 2019-08-08 stsp -----------------------------------------------
500 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
501 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
504 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
506 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
507 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
508 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
512 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
513 2e1f37b0 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
514 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
516 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
517 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
518 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
522 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
524 9b4458b4 2022-06-26 thomas echo "diff -s $testroot/wt" > $testroot/stdout.expected
525 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
526 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
527 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
528 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
529 2e1f37b0 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
530 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
531 2e1f37b0 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
532 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
533 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
534 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
535 2e1f37b0 2019-08-08 stsp --- numbers
536 2e1f37b0 2019-08-08 stsp +++ numbers
537 2e1f37b0 2019-08-08 stsp @@ -1,10 +1,10 @@
551 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
553 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
554 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
555 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
559 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
560 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
561 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
562 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
563 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
564 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
565 4ce46740 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
566 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
567 2e1f37b0 2019-08-08 stsp echo "file + numbers" >> $testroot/stdout.expected
568 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
569 2e1f37b0 2019-08-08 stsp --- numbers
570 2e1f37b0 2019-08-08 stsp +++ numbers
571 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@ b
578 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
580 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
581 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
582 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
586 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R >/dev/null)
588 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
589 2e1f37b0 2019-08-08 stsp echo "got stage command failed unexpectedly" >&2
590 2e1f37b0 2019-08-08 stsp test_done "$testroot" "1"
594 ad493afc 2019-08-03 stsp (cd $testroot/wt && got status > $testroot/stdout)
595 2e1f37b0 2019-08-08 stsp echo " M numbers" > $testroot/stdout.expected
596 ad493afc 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
598 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
599 ad493afc 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
600 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
604 2e1f37b0 2019-08-08 stsp # unstage all hunks
605 2e1f37b0 2019-08-08 stsp printf "y\ny\ny\n" > $testroot/patchscript
606 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
607 2e1f37b0 2019-08-08 stsp numbers > $testroot/stdout)
609 2e1f37b0 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
610 2e1f37b0 2019-08-08 stsp -----------------------------------------------
611 2e1f37b0 2019-08-08 stsp @@ -1,5 +1,5 @@
618 2e1f37b0 2019-08-08 stsp -----------------------------------------------
619 2e1f37b0 2019-08-08 stsp M numbers (change 1 of 3)
620 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
621 2e1f37b0 2019-08-08 stsp -----------------------------------------------
622 2e1f37b0 2019-08-08 stsp @@ -4,7 +4,7 @@
631 2e1f37b0 2019-08-08 stsp -----------------------------------------------
632 2e1f37b0 2019-08-08 stsp M numbers (change 2 of 3)
633 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
634 2e1f37b0 2019-08-08 stsp -----------------------------------------------
635 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
641 2e1f37b0 2019-08-08 stsp -----------------------------------------------
642 2e1f37b0 2019-08-08 stsp M numbers (change 3 of 3)
643 2e1f37b0 2019-08-08 stsp unstage this change? [y/n/q] y
646 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
648 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
649 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
650 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
654 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
655 2e1f37b0 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
656 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
658 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
659 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
660 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
664 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
665 2e1f37b0 2019-08-08 stsp echo -n > $testroot/stdout.expected
666 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
668 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
669 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
670 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
674 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
676 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
677 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
678 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
679 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
680 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
681 2e1f37b0 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
682 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
683 2e1f37b0 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
684 2e1f37b0 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
685 2e1f37b0 2019-08-08 stsp --- numbers
686 2e1f37b0 2019-08-08 stsp +++ numbers
687 2e1f37b0 2019-08-08 stsp @@ -1,10 +1,10 @@
700 2e1f37b0 2019-08-08 stsp @@ -13,4 +13,4 @@
707 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
709 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
710 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
712 ad493afc 2019-08-03 stsp test_done "$testroot" "$ret"
716 f6cae3ed 2020-09-13 naddy test_unstage_patch_added() {
717 2e1f37b0 2019-08-08 stsp local testroot=`test_init unstage_patch_added`
718 2e1f37b0 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
720 2e1f37b0 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
722 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
723 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
727 2e1f37b0 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
728 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
730 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
732 2e1f37b0 2019-08-08 stsp printf "y\n" > $testroot/patchscript
733 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
734 2e1f37b0 2019-08-08 stsp epsilon/new > $testroot/stdout)
736 2e1f37b0 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
737 2e1f37b0 2019-08-08 stsp echo "unstage this addition? [y/n] y" >> $testroot/stdout.expected
738 2e1f37b0 2019-08-08 stsp echo "G epsilon/new" >> $testroot/stdout.expected
739 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
741 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
742 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
743 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
747 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
748 2e1f37b0 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
749 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
751 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
752 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
753 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
757 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
758 2e1f37b0 2019-08-08 stsp echo -n > $testroot/stdout.expected
759 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
761 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
762 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
763 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
767 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
769 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
770 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
771 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
772 2e1f37b0 2019-08-08 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
773 68aef3f0 2022-09-23 thomas echo 'file + epsilon/new (mode 644)' >> $testroot/stdout.expected
774 1cb46f00 2020-11-21 stsp echo "--- /dev/null" >> $testroot/stdout.expected
775 2e1f37b0 2019-08-08 stsp echo "+++ epsilon/new" >> $testroot/stdout.expected
776 2e1f37b0 2019-08-08 stsp echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected
777 2e1f37b0 2019-08-08 stsp echo "+new" >> $testroot/stdout.expected
778 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
780 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
781 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
783 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
786 f6cae3ed 2020-09-13 naddy test_unstage_patch_removed() {
787 2e1f37b0 2019-08-08 stsp local testroot=`test_init unstage_patch_removed`
788 2e1f37b0 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
790 2e1f37b0 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
792 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
793 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
797 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
798 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
800 2e1f37b0 2019-08-08 stsp printf "y\n" > $testroot/patchscript
801 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
802 2e1f37b0 2019-08-08 stsp beta > $testroot/stdout)
804 2e1f37b0 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
805 2e1f37b0 2019-08-08 stsp echo "unstage this deletion? [y/n] y" >> $testroot/stdout.expected
806 2e1f37b0 2019-08-08 stsp echo "D beta" >> $testroot/stdout.expected
807 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
809 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
810 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
811 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
815 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
816 2e1f37b0 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
817 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
819 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
820 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
821 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
825 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
826 2e1f37b0 2019-08-08 stsp echo -n > $testroot/stdout.expected
827 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
829 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
830 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
831 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
835 2e1f37b0 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
837 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
838 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
839 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
840 2e1f37b0 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
841 2e1f37b0 2019-08-08 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
842 2e1f37b0 2019-08-08 stsp >> $testroot/stdout.expected
843 2e1f37b0 2019-08-08 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
844 2e1f37b0 2019-08-08 stsp echo "--- beta" >> $testroot/stdout.expected
845 1cb46f00 2020-11-21 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
846 2e1f37b0 2019-08-08 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
847 2e1f37b0 2019-08-08 stsp echo "-beta" >> $testroot/stdout.expected
848 2e1f37b0 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
850 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
851 2e1f37b0 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
853 2e1f37b0 2019-08-08 stsp test_done "$testroot" "$ret"
856 f6cae3ed 2020-09-13 naddy test_unstage_patch_quit() {
857 19e4b907 2019-08-08 stsp local testroot=`test_init unstage_patch_quit`
859 cf85a643 2024-04-09 thomas seq 16 > $testroot/repo/numbers
860 19e4b907 2019-08-08 stsp echo zzz > $testroot/repo/zzz
861 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add numbers zzz
862 19e4b907 2019-08-08 stsp git_commit $testroot/repo -m "added files"
863 19e4b907 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
865 19e4b907 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
867 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
868 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
872 ac3cdf31 2023-03-06 thomas ed -s $testroot/wt/numbers <<-\EOF
873 ac3cdf31 2023-03-06 thomas ,s/^2$/a/
874 ac3cdf31 2023-03-06 thomas ,s/^7$/b/
875 ac3cdf31 2023-03-06 thomas ,s/^16$/c/
878 19e4b907 2019-08-08 stsp (cd $testroot/wt && got rm zzz > /dev/null)
879 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -R > /dev/null)
881 19e4b907 2019-08-08 stsp # unstage first hunk and quit; and don't pass a path argument to
882 19e4b907 2019-08-08 stsp # ensure that we don't skip asking about the 'zzz' file after 'quit'
883 19e4b907 2019-08-08 stsp printf "y\nq\nn\n" > $testroot/patchscript
884 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
885 19e4b907 2019-08-08 stsp > $testroot/stdout)
887 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
888 57ba6a8b 2019-08-08 stsp echo "got unstage command failed unexpectedly" >&2
889 19e4b907 2019-08-08 stsp test_done "$testroot" "1"
892 19e4b907 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
893 19e4b907 2019-08-08 stsp -----------------------------------------------
894 19e4b907 2019-08-08 stsp @@ -1,5 +1,5 @@
901 19e4b907 2019-08-08 stsp -----------------------------------------------
902 19e4b907 2019-08-08 stsp M numbers (change 1 of 3)
903 19e4b907 2019-08-08 stsp unstage this change? [y/n/q] y
904 19e4b907 2019-08-08 stsp -----------------------------------------------
905 19e4b907 2019-08-08 stsp @@ -4,7 +4,7 @@
914 19e4b907 2019-08-08 stsp -----------------------------------------------
915 19e4b907 2019-08-08 stsp M numbers (change 2 of 3)
916 19e4b907 2019-08-08 stsp unstage this change? [y/n/q] q
919 19e4b907 2019-08-08 stsp unstage this deletion? [y/n] n
921 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
923 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
924 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
925 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
929 19e4b907 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
930 19e4b907 2019-08-08 stsp echo "MM numbers" > $testroot/stdout.expected
931 19e4b907 2019-08-08 stsp echo " D zzz" >> $testroot/stdout.expected
932 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
934 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
935 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
936 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
940 19e4b907 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
942 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
943 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
944 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
945 19e4b907 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
946 4ce46740 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
947 4ce46740 2019-08-08 stsp tr -d '\n' >> $testroot/stdout.expected
948 4ce46740 2019-08-08 stsp echo " (staged)" >> $testroot/stdout.expected
949 19e4b907 2019-08-08 stsp echo "file + numbers" >> $testroot/stdout.expected
950 19e4b907 2019-08-08 stsp echo "--- numbers" >> $testroot/stdout.expected
951 19e4b907 2019-08-08 stsp echo "+++ numbers" >> $testroot/stdout.expected
952 19e4b907 2019-08-08 stsp echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected
953 19e4b907 2019-08-08 stsp echo " 1" >> $testroot/stdout.expected
954 19e4b907 2019-08-08 stsp echo "-2" >> $testroot/stdout.expected
955 19e4b907 2019-08-08 stsp echo "+a" >> $testroot/stdout.expected
956 19e4b907 2019-08-08 stsp echo " 3" >> $testroot/stdout.expected
957 19e4b907 2019-08-08 stsp echo " 4" >> $testroot/stdout.expected
958 19e4b907 2019-08-08 stsp echo " 5" >> $testroot/stdout.expected
959 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
961 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
962 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
963 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
967 19e4b907 2019-08-08 stsp (cd $testroot/wt && got diff -s > $testroot/stdout)
968 9b4458b4 2022-06-26 thomas echo "diff -s $testroot/wt" > $testroot/stdout.expected
969 9b4458b4 2022-06-26 thomas echo "commit - $commit_id" >> $testroot/stdout.expected
970 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
971 19e4b907 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
972 19e4b907 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
973 19e4b907 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
974 19e4b907 2019-08-08 stsp >> $testroot/stdout.expected
975 19e4b907 2019-08-08 stsp echo -n 'blob + ' >> $testroot/stdout.expected
976 19e4b907 2019-08-08 stsp (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \
977 19e4b907 2019-08-08 stsp >> $testroot/stdout.expected
978 19e4b907 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
979 19e4b907 2019-08-08 stsp --- numbers
980 19e4b907 2019-08-08 stsp +++ numbers
981 19e4b907 2019-08-08 stsp @@ -4,7 +4,7 @@
990 19e4b907 2019-08-08 stsp @@ -13,4 +13,4 @@
997 19e4b907 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
998 19e4b907 2019-08-08 stsp got tree -r $testroot/repo -i | grep 'zzz$' | cut -d' ' -f 1 \
999 19e4b907 2019-08-08 stsp >> $testroot/stdout.expected
1000 19e4b907 2019-08-08 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
1001 19e4b907 2019-08-08 stsp echo "--- zzz" >> $testroot/stdout.expected
1002 19e4b907 2019-08-08 stsp echo "+++ /dev/null" >> $testroot/stdout.expected
1003 19e4b907 2019-08-08 stsp echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected
1004 19e4b907 2019-08-08 stsp echo "-zzz" >> $testroot/stdout.expected
1005 19e4b907 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1007 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1008 19e4b907 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
1010 19e4b907 2019-08-08 stsp test_done "$testroot" "$ret"
1013 f6cae3ed 2020-09-13 naddy test_unstage_symlink() {
1014 ea7786be 2020-07-23 stsp local testroot=`test_init unstage_symlink`
1016 ea7786be 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1017 ea7786be 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1018 ea7786be 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1019 ea7786be 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1020 ea7786be 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1021 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add .
1022 ea7786be 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1023 ea7786be 2020-07-23 stsp local head_commit=`git_show_head $testroot/repo`
1025 ea7786be 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1027 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1028 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1032 ea7786be 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
1033 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
1034 ea7786be 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
1035 ea7786be 2020-07-23 stsp echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link
1036 ea7786be 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
1037 ea7786be 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
1038 ea7786be 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
1039 ea7786be 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
1040 ea7786be 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
1041 ea7786be 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
1043 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -RS > /dev/null)
1045 ea7786be 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
1046 ea7786be 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1047 ea7786be 2020-07-23 stsp M alpha.link
1048 ea7786be 2020-07-23 stsp A dotgotbar.link
1049 ea7786be 2020-07-23 stsp A dotgotfoo.link
1050 ea7786be 2020-07-23 stsp M epsilon/beta.link
1051 ea7786be 2020-07-23 stsp M epsilon.link
1052 ea7786be 2020-07-23 stsp D nonexistent.link
1053 ea7786be 2020-07-23 stsp A zeta.link
1055 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1057 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1058 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1059 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1063 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R > $testroot/stdout)
1065 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1066 ea7786be 2020-07-23 stsp echo "got unstage command failed unexpectedly" >&2
1067 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1071 ea7786be 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1072 ea7786be 2020-07-23 stsp G alpha.link
1073 ea7786be 2020-07-23 stsp G dotgotbar.link
1074 ea7786be 2020-07-23 stsp G dotgotfoo.link
1075 ea7786be 2020-07-23 stsp G epsilon/beta.link
1076 ea7786be 2020-07-23 stsp G epsilon.link
1077 ea7786be 2020-07-23 stsp D nonexistent.link
1078 ea7786be 2020-07-23 stsp G zeta.link
1081 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1083 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1084 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1085 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1089 ea7786be 2020-07-23 stsp if [ ! -h $testroot/wt/alpha.link ]; then
1090 ea7786be 2020-07-23 stsp echo "alpha.link is not a symlink"
1091 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1095 ea7786be 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1096 ea7786be 2020-07-23 stsp echo "beta" > $testroot/stdout.expected
1097 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1099 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1100 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1101 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1105 ea7786be 2020-07-23 stsp if [ ! -h $testroot/wt/epsilon.link ]; then
1106 ea7786be 2020-07-23 stsp echo "epsilon.link is not a symlink"
1107 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1111 ea7786be 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1112 ea7786be 2020-07-23 stsp echo "gamma" > $testroot/stdout.expected
1113 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1115 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1116 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1117 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1121 ea7786be 2020-07-23 stsp if [ ! -h $testroot/wt/epsilon/beta.link ]; then
1122 ea7786be 2020-07-23 stsp echo "epsilon/beta.link is not a symlink"
1123 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1127 ea7786be 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1128 ea7786be 2020-07-23 stsp echo "../gamma/delta" > $testroot/stdout.expected
1129 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1131 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1132 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1133 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1137 ea7786be 2020-07-23 stsp if [ ! -f $testroot/wt/dotgotfoo.link ]; then
1138 ea7786be 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
1139 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1143 ea7786be 2020-07-23 stsp echo "this is regular file foo" > $testroot/content.expected
1144 ea7786be 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
1145 ea7786be 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1147 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1148 ea7786be 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1149 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1153 ea7786be 2020-07-23 stsp # bad symlinks are allowed as-is for commit and stage/unstage
1154 ea7786be 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotbar.link ]; then
1155 ea7786be 2020-07-23 stsp echo "dotgotbar.link is not a symlink"
1156 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1160 ea7786be 2020-07-23 stsp readlink $testroot/wt/dotgotbar.link > $testroot/stdout
1161 ea7786be 2020-07-23 stsp echo ".got/bar" > $testroot/stdout.expected
1162 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1164 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1165 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1166 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1170 ea7786be 2020-07-23 stsp if [ -e $testroot/wt/nonexistent.link ]; then
1171 ea7786be 2020-07-23 stsp echo "nonexistent.link exists on disk"
1172 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1176 ea7786be 2020-07-23 stsp if [ ! -h $testroot/wt/zeta.link ]; then
1177 ea7786be 2020-07-23 stsp echo "zeta.link is not a symlink"
1178 ea7786be 2020-07-23 stsp test_done "$testroot" "1"
1182 ea7786be 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
1183 ea7786be 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
1184 ea7786be 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1186 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1187 ea7786be 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1188 ea7786be 2020-07-23 stsp test_done "$testroot" "$ret"
1192 ea7786be 2020-07-23 stsp test_done "$testroot" "0"
1195 f6cae3ed 2020-09-13 naddy test_unstage_patch_symlink() {
1196 36bf999c 2020-07-23 stsp local testroot=`test_init unstage_patch_symlink`
1198 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1199 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1200 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1201 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1202 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1203 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
1204 36bf999c 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta2.link)
1205 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add .
1206 36bf999c 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1207 36bf999c 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
1209 36bf999c 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1211 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1212 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1216 36bf999c 2020-07-23 stsp # symlink to file A now points to file B
1217 36bf999c 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
1218 36bf999c 2020-07-23 stsp # symlink to a directory A now points to file B
1219 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon.link && ln -s beta epsilon.link)
1220 36bf999c 2020-07-23 stsp # "bad" symlink now contains a different target path
1221 36bf999c 2020-07-23 stsp echo "foo" > $testroot/wt/passwd.link
1222 36bf999c 2020-07-23 stsp # relative symlink to directory A now points to relative directory B
1223 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon/beta.link && ln -s ../gamma \
1224 e6f45b72 2023-03-03 thomas epsilon/beta.link)
1225 36bf999c 2020-07-23 stsp # an unversioned symlink
1226 36bf999c 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/foo dotgotfoo.link)
1227 36bf999c 2020-07-23 stsp # symlink to file A now points to non-existent file B
1228 36bf999c 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
1229 36bf999c 2020-07-23 stsp # removed symlink
1230 36bf999c 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
1231 36bf999c 2020-07-23 stsp (cd $testroot/wt && got rm zeta2.link > /dev/null)
1232 36bf999c 2020-07-23 stsp # added symlink
1233 36bf999c 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
1234 36bf999c 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
1235 36bf999c 2020-07-23 stsp (cd $testroot/wt && ln -sf beta zeta3.link)
1236 36bf999c 2020-07-23 stsp (cd $testroot/wt && got add zeta3.link > /dev/null)
1238 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got stage -RS > /dev/null)
1240 36bf999c 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
1241 36bf999c 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1242 36bf999c 2020-07-23 stsp M alpha.link
1243 36bf999c 2020-07-23 stsp ? dotgotfoo.link
1244 36bf999c 2020-07-23 stsp M epsilon/beta.link
1245 36bf999c 2020-07-23 stsp M epsilon.link
1246 36bf999c 2020-07-23 stsp A new.link
1247 36bf999c 2020-07-23 stsp M nonexistent.link
1248 36bf999c 2020-07-23 stsp M passwd.link
1249 36bf999c 2020-07-23 stsp D zeta.link
1250 36bf999c 2020-07-23 stsp D zeta2.link
1251 36bf999c 2020-07-23 stsp A zeta3.link
1253 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1255 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1256 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1257 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1261 36bf999c 2020-07-23 stsp printf "y\nn\ny\nn\ny\ny\nn\ny\ny\n" > $testroot/patchscript
1262 a6dfa7b2 2024-04-25 thomas.ad (cd $testroot/wt && got unstage -R -F $testroot/patchscript -p \
1263 36bf999c 2020-07-23 stsp > $testroot/stdout)
1265 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1266 36bf999c 2020-07-23 stsp echo "got unstage command failed unexpectedly" >&2
1267 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1271 36bf999c 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1272 36bf999c 2020-07-23 stsp -----------------------------------------------
1273 36bf999c 2020-07-23 stsp @@ -1 +1 @@
1275 36bf999c 2020-07-23 stsp \ No newline at end of file
1276 36bf999c 2020-07-23 stsp +gamma/delta
1277 36bf999c 2020-07-23 stsp \ No newline at end of file
1278 36bf999c 2020-07-23 stsp -----------------------------------------------
1279 36bf999c 2020-07-23 stsp M alpha.link (change 1 of 1)
1280 36bf999c 2020-07-23 stsp unstage this change? [y/n/q] y
1281 36bf999c 2020-07-23 stsp G alpha.link
1282 36bf999c 2020-07-23 stsp -----------------------------------------------
1283 36bf999c 2020-07-23 stsp @@ -1 +1 @@
1285 36bf999c 2020-07-23 stsp \ No newline at end of file
1287 36bf999c 2020-07-23 stsp \ No newline at end of file
1288 36bf999c 2020-07-23 stsp -----------------------------------------------
1289 36bf999c 2020-07-23 stsp M epsilon/beta.link (change 1 of 1)
1290 36bf999c 2020-07-23 stsp unstage this change? [y/n/q] n
1291 36bf999c 2020-07-23 stsp -----------------------------------------------
1292 36bf999c 2020-07-23 stsp @@ -1 +1 @@
1294 36bf999c 2020-07-23 stsp \ No newline at end of file
1296 36bf999c 2020-07-23 stsp \ No newline at end of file
1297 36bf999c 2020-07-23 stsp -----------------------------------------------
1298 36bf999c 2020-07-23 stsp M epsilon.link (change 1 of 1)
1299 36bf999c 2020-07-23 stsp unstage this change? [y/n/q] y
1300 36bf999c 2020-07-23 stsp G epsilon.link
1301 36bf999c 2020-07-23 stsp A new.link
1302 36bf999c 2020-07-23 stsp unstage this addition? [y/n] n
1303 36bf999c 2020-07-23 stsp -----------------------------------------------
1304 36bf999c 2020-07-23 stsp @@ -1 +1 @@
1305 36bf999c 2020-07-23 stsp -nonexistent
1306 36bf999c 2020-07-23 stsp \ No newline at end of file
1307 36bf999c 2020-07-23 stsp +nonexistent2
1308 36bf999c 2020-07-23 stsp \ No newline at end of file
1309 36bf999c 2020-07-23 stsp -----------------------------------------------
1310 36bf999c 2020-07-23 stsp M nonexistent.link (change 1 of 1)
1311 36bf999c 2020-07-23 stsp unstage this change? [y/n/q] y
1312 36bf999c 2020-07-23 stsp G nonexistent.link
1313 36bf999c 2020-07-23 stsp -----------------------------------------------
1314 36bf999c 2020-07-23 stsp @@ -1 +1 @@
1315 36bf999c 2020-07-23 stsp -/etc/passwd
1316 36bf999c 2020-07-23 stsp \ No newline at end of file
1318 36bf999c 2020-07-23 stsp -----------------------------------------------
1319 36bf999c 2020-07-23 stsp M passwd.link (change 1 of 1)
1320 36bf999c 2020-07-23 stsp unstage this change? [y/n/q] y
1321 36bf999c 2020-07-23 stsp G passwd.link
1322 36bf999c 2020-07-23 stsp D zeta.link
1323 36bf999c 2020-07-23 stsp unstage this deletion? [y/n] n
1324 36bf999c 2020-07-23 stsp D zeta2.link
1325 36bf999c 2020-07-23 stsp unstage this deletion? [y/n] y
1326 36bf999c 2020-07-23 stsp D zeta2.link
1327 36bf999c 2020-07-23 stsp A zeta3.link
1328 36bf999c 2020-07-23 stsp unstage this addition? [y/n] y
1329 36bf999c 2020-07-23 stsp G zeta3.link
1331 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1333 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1334 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1335 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1339 36bf999c 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1340 36bf999c 2020-07-23 stsp echo "alpha.link is not a symlink"
1341 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1345 36bf999c 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1346 36bf999c 2020-07-23 stsp echo "gamma/delta" > $testroot/stdout.expected
1347 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1349 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1350 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1351 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1355 36bf999c 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1356 36bf999c 2020-07-23 stsp echo "epsilon.link is not a symlink"
1357 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1361 36bf999c 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1362 36bf999c 2020-07-23 stsp echo "beta" > $testroot/stdout.expected
1363 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1365 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1366 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1367 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1371 36bf999c 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1372 36bf999c 2020-07-23 stsp echo "passwd.link should not be a symlink" >&2
1373 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1377 36bf999c 2020-07-23 stsp echo "foo" > $testroot/content.expected
1378 36bf999c 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1380 36bf999c 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1382 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1383 36bf999c 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1384 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1388 36bf999c 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1389 36bf999c 2020-07-23 stsp echo "../gamma" > $testroot/stdout.expected
1390 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1392 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1393 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1394 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1398 36bf999c 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1399 36bf999c 2020-07-23 stsp echo "nonexistent2" > $testroot/stdout.expected
1400 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1402 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1403 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1404 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1408 36bf999c 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotfoo.link ]; then
1409 36bf999c 2020-07-23 stsp echo "dotgotfoo.link is not a symlink " >&2
1410 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1413 36bf999c 2020-07-23 stsp readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
1414 36bf999c 2020-07-23 stsp echo ".got/foo" > $testroot/stdout.expected
1415 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1417 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1418 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1419 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1424 36bf999c 2020-07-23 stsp if [ -e $testroot/wt/zeta.link ]; then
1425 36bf999c 2020-07-23 stsp echo -n "zeta.link should not exist on disk" >&2
1426 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1430 36bf999c 2020-07-23 stsp if [ -e $testroot/wt/zeta2.link ]; then
1431 36bf999c 2020-07-23 stsp echo -n "zeta2.link exists on disk" >&2
1432 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1436 36bf999c 2020-07-23 stsp if [ ! -h $testroot/wt/zeta3.link ]; then
1437 36bf999c 2020-07-23 stsp echo -n "zeta3.link is not a symlink" >&2
1438 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1442 36bf999c 2020-07-23 stsp readlink $testroot/wt/zeta3.link > $testroot/stdout
1443 36bf999c 2020-07-23 stsp echo "beta" > $testroot/stdout.expected
1444 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1446 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1447 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1448 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1452 36bf999c 2020-07-23 stsp if [ ! -h $testroot/wt/new.link ]; then
1453 36bf999c 2020-07-23 stsp echo -n "new.link is not a symlink" >&2
1454 36bf999c 2020-07-23 stsp test_done "$testroot" "1"
1458 36bf999c 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
1459 36bf999c 2020-07-23 stsp echo "M alpha.link" > $testroot/stdout.expected
1460 36bf999c 2020-07-23 stsp echo "? dotgotfoo.link" >> $testroot/stdout.expected
1461 36bf999c 2020-07-23 stsp echo " M epsilon/beta.link" >> $testroot/stdout.expected
1462 36bf999c 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
1463 36bf999c 2020-07-23 stsp echo " A new.link" >> $testroot/stdout.expected
1464 36bf999c 2020-07-23 stsp echo "M nonexistent.link" >> $testroot/stdout.expected
1465 36bf999c 2020-07-23 stsp echo "M passwd.link" >> $testroot/stdout.expected
1466 36bf999c 2020-07-23 stsp echo " D zeta.link" >> $testroot/stdout.expected
1467 36bf999c 2020-07-23 stsp echo "D zeta2.link" >> $testroot/stdout.expected
1468 36bf999c 2020-07-23 stsp echo "A zeta3.link" >> $testroot/stdout.expected
1469 36bf999c 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1471 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1472 36bf999c 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1475 36bf999c 2020-07-23 stsp test_done "$testroot" "$ret"
1478 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1479 ad493afc 2019-08-03 stsp run_test test_unstage_basic
1480 a6dfa7b2 2024-04-25 thomas.ad run_test test_unstage_directory
1481 8b13ce36 2019-08-08 stsp run_test test_unstage_unversioned
1482 8564cb21 2019-08-08 stsp run_test test_unstage_nonexistent
1483 2e1f37b0 2019-08-08 stsp run_test test_unstage_patch
1484 2e1f37b0 2019-08-08 stsp run_test test_unstage_patch_added
1485 2e1f37b0 2019-08-08 stsp run_test test_unstage_patch_removed
1486 19e4b907 2019-08-08 stsp run_test test_unstage_patch_quit
1487 ea7786be 2020-07-23 stsp run_test test_unstage_symlink
1488 36bf999c 2020-07-23 stsp run_test test_unstage_patch_symlink