3 c84d8c75 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 c84d8c75 2019-01-02 stsp # Permission to use, copy, modify, and distribute this software for any
6 c84d8c75 2019-01-02 stsp # purpose with or without fee is hereby granted, provided that the above
7 c84d8c75 2019-01-02 stsp # copyright notice and this permission notice appear in all copies.
9 c84d8c75 2019-01-02 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c84d8c75 2019-01-02 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c84d8c75 2019-01-02 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c84d8c75 2019-01-02 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c84d8c75 2019-01-02 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c84d8c75 2019-01-02 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c84d8c75 2019-01-02 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c84d8c75 2019-01-02 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_update_basic() {
20 0fbd721f 2019-01-02 stsp local testroot=`test_init update_basic`
22 3c90ba67 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
25 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
29 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/repo/alpha
30 c84d8c75 2019-01-02 stsp git_commit $testroot/repo -m "modified alpha"
32 c84d8c75 2019-01-02 stsp echo "U alpha" > $testroot/stdout.expected
33 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
34 9c4b8182 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
35 9c4b8182 2019-01-02 stsp echo >> $testroot/stdout.expected
37 c84d8c75 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
39 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
41 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
42 c84d8c75 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
43 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
47 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/content.expected
48 52a3df9b 2019-01-06 stsp cat $testroot/wt/alpha > $testroot/content
50 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
52 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
53 c84d8c75 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
55 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
58 f6cae3ed 2020-09-13 naddy test_update_adds_file() {
59 3b4d3732 2019-01-02 stsp local testroot=`test_init update_adds_file`
61 3b4d3732 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
63 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
64 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
68 3b4d3732 2019-01-02 stsp echo "new" > $testroot/repo/gamma/new
69 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
70 3b4d3732 2019-01-02 stsp git_commit $testroot/repo -m "adding a new file"
72 3b4d3732 2019-01-02 stsp echo "A gamma/new" > $testroot/stdout.expected
73 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
74 3b4d3732 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
75 3b4d3732 2019-01-02 stsp echo >> $testroot/stdout.expected
77 3b4d3732 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
79 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
81 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
82 3b4d3732 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
87 3b4d3732 2019-01-02 stsp echo "new" >> $testroot/content.expected
88 52a3df9b 2019-01-06 stsp cat $testroot/wt/gamma/new > $testroot/content
90 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
92 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
93 3b4d3732 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
95 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
98 f6cae3ed 2020-09-13 naddy test_update_deletes_file() {
99 512f0d0e 2019-01-02 stsp local testroot=`test_init update_deletes_file`
101 1c4cdd89 2021-06-20 stsp mkdir $testroot/wtparent
102 1c4cdd89 2021-06-20 stsp got checkout $testroot/repo $testroot/wtparent/wt > /dev/null
104 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
105 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
109 1eb5d2a0 2023-02-24 naddy git_rm $testroot/repo beta
110 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
112 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
113 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
114 512f0d0e 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
115 512f0d0e 2019-01-02 stsp echo >> $testroot/stdout.expected
117 1c4cdd89 2021-06-20 stsp # verify that no error occurs if the work tree's parent
118 1c4cdd89 2021-06-20 stsp # directory is not writable
119 1c4cdd89 2021-06-20 stsp chmod u-w $testroot/wtparent
120 1c4cdd89 2021-06-20 stsp (cd $testroot/wtparent/wt && got update > $testroot/stdout)
121 1c4cdd89 2021-06-20 stsp chmod u+w $testroot/wtparent
123 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
125 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
126 512f0d0e 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
127 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
131 1c4cdd89 2021-06-20 stsp if [ -e $testroot/wtparent/wt/beta ]; then
132 512f0d0e 2019-01-02 stsp echo "removed file beta still exists on disk" >&2
133 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
137 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
140 f6cae3ed 2020-09-13 naddy test_update_deletes_dir() {
141 f5c49f82 2019-01-06 stsp local testroot=`test_init update_deletes_dir`
143 f5c49f82 2019-01-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
145 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
146 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
150 1eb5d2a0 2023-02-24 naddy git_rm $testroot/repo -r epsilon
151 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
153 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
154 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
155 f5c49f82 2019-01-06 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
156 f5c49f82 2019-01-06 stsp echo >> $testroot/stdout.expected
158 f5c49f82 2019-01-06 stsp (cd $testroot/wt && got update > $testroot/stdout)
160 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
162 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
163 f5c49f82 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
164 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
168 f5c49f82 2019-01-06 stsp if [ -e $testroot/wt/epsilon ]; then
169 f5c49f82 2019-01-06 stsp echo "removed dir epsilon still exists on disk" >&2
170 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
174 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
177 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_with_path_prefix() {
178 5cc266ba 2019-01-06 stsp local testroot=`test_init update_deletes_dir_with_path_prefix`
179 5cc266ba 2019-01-06 stsp local first_rev=`git_show_head $testroot/repo`
181 5cc266ba 2019-01-06 stsp mkdir $testroot/repo/epsilon/psi
182 5cc266ba 2019-01-06 stsp echo mu > $testroot/repo/epsilon/psi/mu
183 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
184 5cc266ba 2019-01-06 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
186 5cc266ba 2019-01-06 stsp # check out the epsilon/ sub-tree
187 5cc266ba 2019-01-06 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
189 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
190 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
194 5cc266ba 2019-01-06 stsp # update back to first commit and expect psi/mu to be deleted
195 5cc266ba 2019-01-06 stsp echo "D psi/mu" > $testroot/stdout.expected
196 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
197 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
199 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
201 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
203 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
204 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
205 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
209 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
210 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
211 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
215 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
218 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_recursively() {
219 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
220 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
222 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
223 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
224 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
225 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
226 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
227 90285c3b 2019-01-08 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
229 90285c3b 2019-01-08 stsp # check out the epsilon/ sub-tree
230 90285c3b 2019-01-08 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
232 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
233 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
237 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
238 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
239 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
240 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
241 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
243 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
245 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
247 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
248 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
249 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
253 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
254 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
255 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
259 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
262 f6cae3ed 2020-09-13 naddy test_update_sibling_dirs_with_common_prefix() {
263 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
265 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
267 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
268 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
272 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
273 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
274 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon2/mu
275 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
276 81a30460 2019-01-08 stsp echo change > $testroot/repo/epsilon/zeta
277 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
279 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
280 81a30460 2019-01-08 stsp echo "A epsilon2/mu" >> $testroot/stdout.expected
281 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
282 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
283 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
285 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
287 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
289 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
290 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
291 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
295 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
296 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
298 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
299 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
300 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
301 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
303 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
304 81a30460 2019-01-08 stsp # U epsilon/zeta
305 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
306 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
307 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
309 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
311 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
312 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
313 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
317 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
319 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
320 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
322 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
325 f6cae3ed 2020-09-13 naddy test_update_dir_with_dot_sibling() {
326 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
328 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
330 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
331 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
335 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
336 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon.txt
337 50952927 2019-01-12 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
338 50952927 2019-01-12 stsp echo change > $testroot/repo/epsilon/zeta
339 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
341 f5d3d7af 2019-02-05 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
342 f5d3d7af 2019-02-05 stsp echo "A epsilon.txt" >> $testroot/stdout.expected
343 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
344 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
345 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
347 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
349 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
351 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
352 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
353 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
357 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
358 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
360 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
361 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
362 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
363 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
365 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
367 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
369 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
370 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
371 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
375 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
377 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
378 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
380 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
383 f6cae3ed 2020-09-13 naddy test_update_moves_files_upwards() {
384 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
386 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
387 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
388 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
389 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
390 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
391 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
393 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
395 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
396 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
400 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv epsilon/psi/mu epsilon/mu
401 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv epsilon/psi/chi/tau epsilon/psi/tau
402 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
404 21908da4 2019-01-13 stsp echo "A epsilon/mu" > $testroot/stdout.expected
405 21908da4 2019-01-13 stsp echo "D epsilon/psi/chi/tau" >> $testroot/stdout.expected
406 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
407 bd4792ec 2019-01-13 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
408 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
409 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
410 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
412 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
414 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
416 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
417 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
418 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
422 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
423 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
424 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
428 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
429 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
430 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
434 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
437 f6cae3ed 2020-09-13 naddy test_update_moves_files_to_new_dir() {
438 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
440 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
441 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
442 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
443 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
444 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
445 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
447 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
449 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
450 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
454 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
455 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv epsilon/psi/mu epsilon-new/mu
456 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv epsilon/psi/chi/tau epsilon-new/psi/tau
457 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
459 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected
460 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
461 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
462 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
463 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
464 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
465 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
467 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
469 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
471 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
472 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
473 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
477 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
478 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
479 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
483 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
484 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
485 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
489 4a1ddfc2 2019-01-12 stsp test_done "$testroot" "0"
492 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent() {
493 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent 1`
495 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/Makefile
496 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.6
497 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.c
498 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
499 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "adding initial snake tree"
501 4a1ddfc2 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
503 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
504 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
508 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
509 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv Makefile snake.6 snake.c snake
510 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/move.c
511 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/pathnames.h
512 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/snake.h
513 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snscore
514 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/Makefile
515 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/snscore.c
516 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
517 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "restructuring snake tree"
519 4a1ddfc2 2019-01-12 stsp echo "D Makefile" > $testroot/stdout.expected
520 4a1ddfc2 2019-01-12 stsp echo "A snake/Makefile" >> $testroot/stdout.expected
521 4a1ddfc2 2019-01-12 stsp echo "A snake/move.c" >> $testroot/stdout.expected
522 4a1ddfc2 2019-01-12 stsp echo "A snake/pathnames.h" >> $testroot/stdout.expected
523 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.6" >> $testroot/stdout.expected
524 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.c" >> $testroot/stdout.expected
525 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.h" >> $testroot/stdout.expected
526 18831e78 2019-02-10 stsp echo "D snake.6" >> $testroot/stdout.expected
527 18831e78 2019-02-10 stsp echo "D snake.c" >> $testroot/stdout.expected
528 bd4792ec 2019-01-13 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
529 bd4792ec 2019-01-13 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
530 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
531 bd4792ec 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
532 bd4792ec 2019-01-13 stsp echo >> $testroot/stdout.expected
534 bd4792ec 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
536 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
538 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
539 e60e7f5b 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
541 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
544 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent_with_subdir() {
545 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent_with_subdir 1`
547 bd4792ec 2019-01-13 stsp touch $testroot/repo/Makefile
548 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.6
549 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.c
550 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
551 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "adding initial snake tree"
553 bd4792ec 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
555 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
556 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
560 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
561 f73bf5bd 2023-10-01 naddy git -C $testroot/repo mv Makefile snake.6 snake.c sss/snake
562 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/move.c
563 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/pathnames.h
564 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/snake.h
565 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/snscore
566 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/Makefile
567 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/snscore.c
568 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
569 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "restructuring snake tree"
571 bd4792ec 2019-01-13 stsp echo "D Makefile" > $testroot/stdout.expected
572 4a1ddfc2 2019-01-12 stsp echo "D snake.6" >> $testroot/stdout.expected
573 4a1ddfc2 2019-01-12 stsp echo "D snake.c" >> $testroot/stdout.expected
574 4a1ddfc2 2019-01-12 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
575 4a1ddfc2 2019-01-12 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
576 bd4792ec 2019-01-13 stsp echo "A sss/snake/Makefile" >> $testroot/stdout.expected
577 bd4792ec 2019-01-13 stsp echo "A sss/snake/move.c" >> $testroot/stdout.expected
578 bd4792ec 2019-01-13 stsp echo "A sss/snake/pathnames.h" >> $testroot/stdout.expected
579 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.6" >> $testroot/stdout.expected
580 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.c" >> $testroot/stdout.expected
581 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.h" >> $testroot/stdout.expected
582 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
583 4a1ddfc2 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
584 4a1ddfc2 2019-01-12 stsp echo >> $testroot/stdout.expected
586 4a1ddfc2 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
588 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
590 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
591 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
592 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
596 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
599 f6cae3ed 2020-09-13 naddy test_update_file_in_subsubdir() {
600 1aad446a 2019-01-13 stsp local testroot=`test_init update_fle_in_subsubdir 1`
602 21908da4 2019-01-13 stsp touch $testroot/repo/Makefile
603 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/altq
604 21908da4 2019-01-13 stsp touch $testroot/repo/altq/if_altq.h
605 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/arch/alpha
606 21908da4 2019-01-13 stsp touch $testroot/repo/arch/alpha/Makefile
607 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
608 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "adding initial tree"
610 21908da4 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
612 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
613 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
617 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
618 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
619 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "changed a file"
621 21908da4 2019-01-13 stsp echo "U arch/alpha/Makefile" > $testroot/stdout.expected
622 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
623 21908da4 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
624 21908da4 2019-01-13 stsp echo >> $testroot/stdout.expected
626 21908da4 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
628 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
630 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
631 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
632 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
636 21908da4 2019-01-13 stsp test_done "$testroot" "0"
639 c3b9af18 2023-02-26 naddy test_update_changes_file_to_dir() {
640 c3b9af18 2023-02-26 naddy local testroot=`test_init update_changes_file_to_dir`
642 c3b9af18 2023-02-26 naddy got checkout $testroot/repo $testroot/wt > /dev/null
644 c3b9af18 2023-02-26 naddy if [ $ret -ne 0 ]; then
645 c3b9af18 2023-02-26 naddy test_done "$testroot" "$ret"
649 c3b9af18 2023-02-26 naddy git_rm $testroot/repo alpha
650 c3b9af18 2023-02-26 naddy mkdir $testroot/repo/alpha
651 c3b9af18 2023-02-26 naddy echo eta > $testroot/repo/alpha/eta
652 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add alpha/eta
653 c3b9af18 2023-02-26 naddy git_commit $testroot/repo -m "changed alpha into directory"
655 c3b9af18 2023-02-26 naddy (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
657 c3b9af18 2023-02-26 naddy if [ $ret -ne 0 ]; then
658 07fa9365 2023-03-10 stsp echo "update failed unexpectedly" >&2
659 07fa9365 2023-03-10 stsp test_done "$testroot" "1"
663 07fa9365 2023-03-10 stsp echo "D alpha" > $testroot/stdout.expected
664 07fa9365 2023-03-10 stsp echo "A alpha/eta" >> $testroot/stdout.expected
665 07fa9365 2023-03-10 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
666 07fa9365 2023-03-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
667 07fa9365 2023-03-10 stsp echo >> $testroot/stdout.expected
669 07fa9365 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
671 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
672 07fa9365 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
674 c3b9af18 2023-02-26 naddy test_done "$testroot" "$ret"
677 d48a8086 2023-03-10 stsp test_update_changes_dir_to_file() {
678 d48a8086 2023-03-10 stsp local testroot=`test_init update_changes_dir_to_file`
680 d48a8086 2023-03-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
682 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
683 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
687 d48a8086 2023-03-10 stsp git_rmdir $testroot/repo epsilon
688 d48a8086 2023-03-10 stsp echo epsilon > $testroot/repo/epsilon
689 d48a8086 2023-03-10 stsp cp $testroot/repo/epsilon $testroot/content.expected
690 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add epsilon
691 d48a8086 2023-03-10 stsp git_commit $testroot/repo -m "changed epsilon into file"
693 d48a8086 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
695 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
696 d48a8086 2023-03-10 stsp echo "update failed unexpectedly" >&2
697 d48a8086 2023-03-10 stsp test_done "$testroot" "1"
701 d48a8086 2023-03-10 stsp # The current behaviour is not perfect, but we accept it for now.
702 d48a8086 2023-03-10 stsp echo "~ epsilon" > $testroot/stdout.expected
703 d48a8086 2023-03-10 stsp echo "D epsilon/zeta" >> $testroot/stdout.expected
704 d48a8086 2023-03-10 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
705 d48a8086 2023-03-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
706 d48a8086 2023-03-10 stsp echo >> $testroot/stdout.expected
707 d48a8086 2023-03-10 stsp echo "File paths obstructed by a non-regular file: 1" \
708 d48a8086 2023-03-10 stsp >> $testroot/stdout.expected
710 d48a8086 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
712 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
713 d48a8086 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
714 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
718 d48a8086 2023-03-10 stsp # Updating again now restores the file which was obstructed by a
719 d48a8086 2023-03-10 stsp # directory in the previous update operation. Ideally, a single
720 d48a8086 2023-03-10 stsp # update operation would suffice.
721 d48a8086 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
723 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
724 d48a8086 2023-03-10 stsp echo "update failed unexpectedly" >&2
725 d48a8086 2023-03-10 stsp test_done "$testroot" "1"
728 d48a8086 2023-03-10 stsp echo "A epsilon" > $testroot/stdout.expected
729 d48a8086 2023-03-10 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
730 d48a8086 2023-03-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
731 d48a8086 2023-03-10 stsp echo >> $testroot/stdout.expected
733 d48a8086 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
735 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
736 d48a8086 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
737 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
741 d48a8086 2023-03-10 stsp cmp -s $testroot/content.expected $testroot/wt/epsilon
743 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
744 d48a8086 2023-03-10 stsp diff -u $testroot/content.expected $testroot/wt/epsilon
746 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
749 07fa9365 2023-03-10 stsp test_update_changes_modified_file_to_dir() {
750 07fa9365 2023-03-10 stsp local testroot=`test_init update_changes_modified_file_to_dir`
752 07fa9365 2023-03-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
754 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
755 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
759 07fa9365 2023-03-10 stsp git_rm $testroot/repo alpha
760 07fa9365 2023-03-10 stsp mkdir $testroot/repo/alpha
761 07fa9365 2023-03-10 stsp echo eta > $testroot/repo/alpha/eta
762 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add alpha/eta
763 07fa9365 2023-03-10 stsp git_commit $testroot/repo -m "changed alpha into directory"
765 07fa9365 2023-03-10 stsp echo "modified alpha" >> $testroot/wt/alpha
766 07fa9365 2023-03-10 stsp cp $testroot/wt/alpha $testroot/wt/content.expected
767 07fa9365 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
769 07fa9365 2023-03-10 stsp if [ $ret -eq 0 ]; then
770 07fa9365 2023-03-10 stsp echo "update succeeded unexpectedly" >&2
771 07fa9365 2023-03-10 stsp test_done "$testroot" "1"
775 07fa9365 2023-03-10 stsp echo "d alpha" > $testroot/stdout.expected
776 07fa9365 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
778 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
779 07fa9365 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
780 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
784 07fa9365 2023-03-10 stsp echo "got: alpha/eta: file is obstructed" > $testroot/stderr.expected
785 07fa9365 2023-03-10 stsp cmp -s $testroot/stderr.expected $testroot/stderr
787 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
788 07fa9365 2023-03-10 stsp diff -u $testroot/stderr.expected $testroot/stderr
790 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
793 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
794 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
796 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
797 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
798 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
799 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
800 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
801 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
802 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
803 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
804 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers
805 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
806 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
808 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
810 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
811 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
815 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
816 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
817 885e96df 2023-03-06 naddy ed -s $testroot/repo/numbers <<-\EOF
821 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
823 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
824 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
825 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
830 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
831 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
832 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
833 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
834 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
835 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
836 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
838 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
840 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
842 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
843 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
844 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
848 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
849 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
850 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
851 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
852 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
853 f69721c3 2019-10-21 stsp >> $testroot/content.expected
854 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
855 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
856 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
857 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
858 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
859 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
860 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
861 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
862 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
863 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
864 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
865 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
866 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
868 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
869 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
870 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
872 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
874 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
875 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
877 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
880 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
881 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
883 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
884 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
885 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
886 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
888 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
890 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
891 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
895 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
896 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
898 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
899 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
900 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
901 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
903 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
905 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
906 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
910 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
912 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
913 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
914 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
918 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
920 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
921 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
922 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
924 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
927 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
928 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
930 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
931 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
932 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
933 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
935 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
937 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
938 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
942 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
944 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
945 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
946 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
947 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
951 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
952 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
953 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
954 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
956 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
957 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
958 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
959 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
961 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
963 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
964 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
968 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
970 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
971 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
972 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
976 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
978 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
979 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
980 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
982 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
985 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
986 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
988 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
990 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
991 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
995 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
997 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
998 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
999 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1000 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
1001 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
1003 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1005 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1006 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1007 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
1011 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
1013 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
1015 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1017 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1018 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
1020 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
1023 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
1024 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
1026 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1028 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1029 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
1033 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
1034 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
1035 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
1037 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
1038 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
1040 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1042 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
1043 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1044 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1045 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
1046 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1048 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1050 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1051 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1052 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
1056 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1057 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
1058 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
1059 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
1060 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
1061 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
1062 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1064 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
1066 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1068 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1069 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
1070 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
1074 3165301c 2019-03-27 stsp # resolve the conflict
1075 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
1076 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
1077 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1078 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1080 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1081 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1083 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
1086 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
1087 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
1089 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1091 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1092 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1096 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
1097 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1099 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
1101 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1103 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1104 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1105 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1106 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
1107 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1109 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1110 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1111 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1115 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
1117 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
1119 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1121 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1122 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
1123 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1127 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
1128 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
1129 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1130 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1132 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1133 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1135 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1138 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
1139 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
1141 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1143 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1144 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1148 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
1149 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
1151 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1153 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1155 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1156 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1157 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1158 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
1159 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1161 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1162 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1163 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1167 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1168 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1169 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1170 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1173 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1174 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1178 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1179 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1180 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1181 8469d821 2022-06-25 stsp echo "commit - $head_rev" >> $testroot/stdout.expected
1182 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1183 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1184 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1185 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1186 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1187 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1188 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1189 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1190 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1192 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1193 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1195 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1196 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1198 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1201 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1202 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1204 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1206 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1207 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1211 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q beta
1212 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1214 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1216 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1218 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1219 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1220 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1221 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1222 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1224 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1225 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1226 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1230 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1231 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1232 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1233 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1234 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1235 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1237 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1238 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1239 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1242 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1244 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1245 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1246 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1250 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1251 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1252 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1256 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1259 f6cae3ed 2020-09-13 naddy test_update_partial() {
1260 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1262 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1264 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1265 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1269 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1270 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1271 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1272 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1274 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1275 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1276 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1277 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1278 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1280 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1282 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1284 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1285 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1286 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1290 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1291 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1293 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1294 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1296 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1297 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1298 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1302 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1303 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1304 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1305 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1307 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1309 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1311 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1312 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1313 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1317 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1318 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1320 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1322 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1323 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1324 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1328 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1331 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1332 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1334 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1336 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1337 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1341 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1342 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1343 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
1344 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1346 10a623df 2021-10-11 stsp echo "A epsilon/new2" > $testroot/stdout.expected
1347 10a623df 2021-10-11 stsp echo "A new" >> $testroot/stdout.expected
1348 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1349 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1350 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1352 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1354 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1356 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1357 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1358 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1362 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1363 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1365 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1367 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1369 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1370 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1372 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1375 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1376 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1378 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1380 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1381 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1385 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q alpha epsilon/zeta
1386 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1388 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1389 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1391 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1393 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1394 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1395 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1399 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1401 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1402 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1403 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1406 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1409 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1410 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1412 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1414 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1415 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1419 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1420 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1421 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1422 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1424 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1425 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1426 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1427 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1429 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1431 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1433 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1434 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1435 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1439 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1440 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1442 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1444 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1445 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1446 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1449 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1453 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1454 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1456 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1458 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1459 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1461 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1463 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1464 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1468 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1469 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1471 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1472 f73bf5bd 2023-10-01 naddy git -C $testroot/repo2 fetch -q --all
1474 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1475 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1476 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1477 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1478 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1480 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1482 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1484 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1485 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1486 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1490 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1492 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1493 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1495 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1498 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1499 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1500 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1502 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1504 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1505 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1509 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1510 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1512 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1513 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1514 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1518 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1519 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1520 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1522 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1524 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1525 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1526 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/newbranch: " >> $testroot/stdout.expected
1527 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1528 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1529 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1531 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1533 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1535 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1536 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1537 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1541 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1542 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1543 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1544 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1545 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1546 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1547 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1548 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1549 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1550 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1552 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1554 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1556 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1557 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1558 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1562 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1563 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1565 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1566 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1567 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1571 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1574 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1575 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1577 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1579 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1580 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1584 f73bf5bd 2023-10-01 naddy git -C $testroot/repo checkout -q -b newbranch
1585 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1586 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1588 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1589 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1590 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1592 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1593 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1594 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1596 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1598 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1599 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1600 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1604 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1606 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1607 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1608 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1612 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1615 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1616 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1618 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1619 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
1620 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1622 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1624 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1625 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1629 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1630 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1632 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1633 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1634 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1635 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1638 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1639 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1643 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1644 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
1645 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1647 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1648 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1649 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1651 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1652 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1653 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1655 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1656 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1657 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1661 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1663 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1664 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1665 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1666 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1667 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1668 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1670 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1672 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1673 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1674 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1678 9bead371 2019-07-28 stsp # resolve conflict
1679 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1681 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1683 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1684 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1685 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1686 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1688 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1689 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1690 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1694 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1697 f6cae3ed 2020-09-13 naddy test_update_tag() {
1698 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1699 303e2782 2019-08-09 stsp local tag="1.0.0"
1701 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1703 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1704 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1708 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1709 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1710 f73bf5bd 2023-10-01 naddy git -C $testroot/repo tag -m "test" -a $tag
1712 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1713 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1714 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1715 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1717 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1719 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1721 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1722 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1723 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1727 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1728 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1730 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1732 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1733 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1735 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1738 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1739 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1741 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1742 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1743 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
1744 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1745 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1747 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1749 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1750 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1754 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1756 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1757 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1758 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1759 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1763 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1764 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1765 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1767 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1768 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1769 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1770 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1772 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1774 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1775 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1779 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1780 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
1781 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1783 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1784 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1785 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1790 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1792 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1793 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1794 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1795 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1799 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1801 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1802 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1806 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1807 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
1808 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
1809 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1811 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1812 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1813 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1817 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1819 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1820 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1821 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1823 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1826 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1827 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1828 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1830 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1831 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1832 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1834 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1836 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1837 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1841 5036ab18 2020-04-18 stsp # fake a merge conflict
1842 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1843 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1844 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1845 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1846 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1847 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1849 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1850 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1851 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1853 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1854 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1855 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1859 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1860 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1861 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1862 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1863 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1864 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1865 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1867 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1869 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1870 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1871 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1875 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1877 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1878 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1880 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1883 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1884 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1886 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1888 f73bf5bd 2023-10-01 naddy git -C $testroot/repo -c protocol.file.allow=always \
1889 f73bf5bd 2023-10-01 naddy submodule -q add ../repo2
1890 f73bf5bd 2023-10-01 naddy git -C $testroot/repo commit -q -m 'adding submodule'
1892 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1894 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1895 f73bf5bd 2023-10-01 naddy git -C $testroot/repo2 commit -q -a -m 'modified a submodule'
1897 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1898 f73bf5bd 2023-10-01 naddy git -C $testroot/repo/repo2 pull -q
1899 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add repo2
1900 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1902 fd785a9a 2023-04-12 stsp echo "Already up-to-date" > $testroot/stdout.expected
1903 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1905 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1907 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1908 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1910 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1913 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1914 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1916 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1918 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1920 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1921 f73bf5bd 2023-10-01 naddy git -C $testroot/repo2 commit -q -a -m 'modified a submodule'
1923 f73bf5bd 2023-10-01 naddy git -C $testroot/repo -c protocol.file.allow=always \
1924 f73bf5bd 2023-10-01 naddy submodule -q add ../repo2
1925 f73bf5bd 2023-10-01 naddy git -C $testroot/repo commit -q -m 'adding submodule'
1927 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1928 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1929 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1930 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1932 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1934 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1936 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1937 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1939 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1942 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1943 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1945 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1947 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1949 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1950 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1951 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1952 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1954 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1955 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1956 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1960 f73bf5bd 2023-10-01 naddy git -C $testroot/repo -c protocol.file.allow=always \
1961 f73bf5bd 2023-10-01 naddy submodule -q add ../repo2
1962 f73bf5bd 2023-10-01 naddy git -C $testroot/repo commit -q -m 'adding submodule'
1964 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1965 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1966 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1968 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1969 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1970 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1971 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1972 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1973 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1975 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1977 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1979 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1980 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1981 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1985 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1987 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1988 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1990 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1991 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1993 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1996 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1997 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1999 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2001 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2002 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2003 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2007 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2008 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2009 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2010 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2011 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2012 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2013 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2015 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
2016 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
2017 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
2018 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
2019 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
2020 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2021 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2022 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
2024 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2026 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2028 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2029 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2030 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2034 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
2035 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
2036 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2040 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
2041 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
2042 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2044 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2045 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2046 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2050 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2051 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
2052 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2056 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2057 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
2058 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2060 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2061 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2062 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2066 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2067 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2068 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2069 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2073 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2074 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2076 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2078 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2079 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2080 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2084 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
2085 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
2086 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2088 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2089 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2090 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2094 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
2095 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
2096 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2098 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2099 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2100 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
2104 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
2105 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
2106 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
2107 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2109 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2110 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
2112 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2115 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
2116 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
2118 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2119 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2120 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
2122 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2124 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2125 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2126 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2130 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q alpha.link
2131 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
2133 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
2134 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2135 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2136 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2138 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2140 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2142 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2143 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2144 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2148 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
2149 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
2150 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2154 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2157 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
2158 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
2160 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2161 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2162 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2163 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2164 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2165 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2166 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2167 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2168 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2170 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2173 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2174 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2178 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2179 f55db25a 2023-03-03 naddy (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link)
2180 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2181 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2182 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2183 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -q nonexistent.link
2184 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2185 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2186 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2187 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2188 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2190 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2191 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2192 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2193 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s beta epsilon.link)
2194 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2195 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon/beta.link && ln -s ../gamma \
2196 f55db25a 2023-03-03 naddy epsilon/beta.link)
2197 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2198 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2199 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2200 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2201 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2202 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2203 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2204 993e2a1b 2020-07-23 stsp # to nonexistent file B
2205 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2206 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2207 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2208 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2209 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2210 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2212 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2214 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2215 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2216 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2217 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2218 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2219 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2220 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2221 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2222 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2223 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2224 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2225 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2227 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2229 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2230 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2231 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2235 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2236 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2237 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2241 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2242 283102fc 2020-07-23 stsp > $testroot/content.expected
2243 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2244 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2245 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2246 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2247 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2248 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2249 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2250 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2252 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2253 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2255 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2256 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2257 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2261 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2262 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2263 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2267 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2268 283102fc 2020-07-23 stsp > $testroot/content.expected
2269 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2270 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2271 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2272 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2273 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2274 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2275 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2276 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2278 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2279 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2281 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2282 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2283 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2287 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2288 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2289 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2290 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2294 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2295 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2297 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2299 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2300 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2301 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2305 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2306 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2307 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2311 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2312 283102fc 2020-07-23 stsp > $testroot/content.expected
2313 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2314 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2315 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2316 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2317 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2318 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2319 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2320 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2322 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2323 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2325 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2326 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2327 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2331 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2332 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2333 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2334 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2338 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2339 283102fc 2020-07-23 stsp > $testroot/content.expected
2340 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2341 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2342 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2343 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2344 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2346 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2347 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2349 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2350 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2351 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2355 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2356 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2357 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2361 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2362 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2363 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2364 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2365 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2366 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2367 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2369 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2370 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2372 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2373 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2374 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2378 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2379 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2380 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2383 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2384 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2385 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2386 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2387 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2388 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2389 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2391 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2392 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2394 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2395 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2396 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2400 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2401 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2402 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2406 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2407 283102fc 2020-07-23 stsp > $testroot/content.expected
2408 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2409 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2410 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2411 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2412 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2414 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2415 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2417 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2418 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2419 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2423 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2424 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2425 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2426 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2428 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2429 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2430 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2434 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2438 194cb7cb 2021-01-19 stsp test_update_single_file() {
2439 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2441 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2442 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2443 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2444 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2446 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2447 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2448 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2449 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add .
2450 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2451 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2453 f73bf5bd 2023-10-01 naddy git -C $testroot/repo rm -qf c
2454 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2455 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2457 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2459 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2460 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2464 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2465 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2466 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2468 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2469 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2471 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2473 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2474 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2475 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2479 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2480 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2482 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2484 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2485 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2486 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2490 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2491 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
2492 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2494 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2496 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2498 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2499 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2500 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2504 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2505 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2507 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2509 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2510 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2511 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2515 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2516 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2517 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2519 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2520 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2522 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2523 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2525 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2526 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2527 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2531 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2532 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2534 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2535 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2536 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2540 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2541 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2542 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2544 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2545 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2547 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2548 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2549 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2553 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2554 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2555 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2559 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2563 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2564 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2565 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2566 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2568 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2569 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2570 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2571 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2573 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2575 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2576 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2580 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2581 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2582 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2583 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2584 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2588 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2589 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2590 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2591 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2592 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2596 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2598 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2600 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2601 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id0" \
2602 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2603 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2604 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2606 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2607 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2608 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2612 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2613 a769b60b 2021-06-27 stsp > $testroot/content.expected
2614 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2615 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2616 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2617 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2618 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2619 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2620 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2622 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2624 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2626 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2627 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2628 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2632 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2633 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2634 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2635 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2636 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2640 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2641 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2642 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2643 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2644 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2648 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2649 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2650 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2651 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2652 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2653 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2654 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2655 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2657 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2658 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2659 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2663 a769b60b 2021-06-27 stsp # blob ID of beta should not have changed
2664 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2665 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2666 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2667 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2668 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2672 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2673 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2674 a769b60b 2021-06-27 stsp # file was not updated.
2675 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2676 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2677 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2678 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2679 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2683 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2684 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2685 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2686 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2688 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2689 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2690 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2694 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2695 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2697 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2698 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2699 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2700 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2702 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2703 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2704 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2708 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2709 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2710 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2711 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2712 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2713 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2715 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2716 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2717 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2721 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2722 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2723 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2724 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2725 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2729 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2730 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2731 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2732 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2733 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2737 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2738 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2739 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2741 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2742 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2744 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2747 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2748 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2749 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2750 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2752 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2753 f6764181 2021-09-24 stsp echo "new file" > $testroot/repo/new
2754 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add new
2755 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2756 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2757 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2759 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2761 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2762 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2766 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2767 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2768 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2769 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2770 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2774 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2775 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2776 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2777 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2778 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2782 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2783 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2784 f6764181 2021-09-24 stsp mkdir -p $testroot/wt/new
2786 f6764181 2021-09-24 stsp # update to the latest commit; this skips beta and the new file
2787 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2789 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2790 f6764181 2021-09-24 stsp echo "update failed unexpectedly" >&2
2791 f6764181 2021-09-24 stsp test_done "$testroot" "1"
2795 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2796 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2797 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2798 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2799 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 2" \
2800 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2801 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2803 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2804 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2805 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2809 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2810 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2811 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2812 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2813 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2817 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2818 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2819 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2820 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2821 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2825 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2826 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2828 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2829 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2830 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2831 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2832 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2833 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2834 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 1" \
2835 f6764181 2021-09-24 stsp >> $testroot/stdout.expected
2836 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2838 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2839 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2840 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2844 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2845 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2846 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2847 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2848 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2852 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2853 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2854 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2855 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2856 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2860 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2861 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2862 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2864 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2865 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2867 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2870 67c65ed7 2021-09-14 tracey test_update_quiet() {
2871 67c65ed7 2021-09-14 tracey local testroot=`test_init update_quiet`
2873 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
2875 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2876 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2877 67c65ed7 2021-09-14 tracey return 1
2880 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/repo/alpha
2881 67c65ed7 2021-09-14 tracey git_commit $testroot/repo -m "modified alpha"
2883 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2884 67c65ed7 2021-09-14 tracey git_show_head $testroot/repo >> $testroot/stdout.expected
2885 67c65ed7 2021-09-14 tracey echo >> $testroot/stdout.expected
2887 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got update -q > $testroot/stdout)
2889 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
2891 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2892 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
2893 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2894 67c65ed7 2021-09-14 tracey return 1
2897 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/content.expected
2898 67c65ed7 2021-09-14 tracey cat $testroot/wt/alpha > $testroot/content
2900 67c65ed7 2021-09-14 tracey cmp -s $testroot/content.expected $testroot/content
2902 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2903 67c65ed7 2021-09-14 tracey diff -u $testroot/content.expected $testroot/content
2905 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2908 0e039681 2021-11-15 stsp test_update_binary_file() {
2909 0e039681 2021-11-15 stsp local testroot=`test_init update_binary_file`
2910 0e039681 2021-11-15 stsp local commit_id0=`git_show_head $testroot/repo`
2912 0e039681 2021-11-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2914 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2915 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2919 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
2920 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2921 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo >/dev/null)
2922 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
2923 0e039681 2021-11-15 stsp local commit_id1=`git_show_head $testroot/repo`
2925 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2926 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2927 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2928 0e039681 2021-11-15 stsp local commit_id2=`git_show_head $testroot/repo`
2930 0e039681 2021-11-15 stsp cp /bin/cp $testroot/wt/foo
2931 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2932 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2933 0e039681 2021-11-15 stsp local commit_id3=`git_show_head $testroot/repo`
2935 0e039681 2021-11-15 stsp (cd $testroot/wt && got rm foo >/dev/null)
2936 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'remove binary file' > /dev/null)
2937 0e039681 2021-11-15 stsp local commit_id4=`git_show_head $testroot/repo`
2939 0e039681 2021-11-15 stsp # backdate the work tree to make it usable for updating
2940 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2942 0e039681 2021-11-15 stsp # update which adds a binary file
2943 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2945 0e039681 2021-11-15 stsp echo "A foo" > $testroot/stdout.expected
2946 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id1" \
2947 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2948 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2949 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2951 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2952 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2953 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2957 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2958 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2959 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2961 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2963 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2964 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2965 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2969 0e039681 2021-11-15 stsp # update which adds a conflicting binary file
2970 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2971 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2972 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2973 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo > /dev/null)
2974 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2976 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
2977 0e039681 2021-11-15 stsp echo "Updated to refs/heads/master: $commit_id1" \
2978 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2979 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2980 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2982 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2983 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2984 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2988 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
2989 0e039681 2021-11-15 stsp > $testroot/content.expected
2990 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id1" \
2991 0e039681 2021-11-15 stsp >> $testroot/content.expected
2992 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2993 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
2994 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
2995 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2996 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
2997 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
2998 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
3000 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3002 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3003 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3004 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3008 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
3009 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3010 0e039681 2021-11-15 stsp cat $testroot/wt/foo-1-* > $testroot/content
3012 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3014 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3015 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3016 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3020 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
3021 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3022 0e039681 2021-11-15 stsp cat $testroot/wt/foo-2-* > $testroot/content
3024 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3026 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3027 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3028 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3033 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . >/dev/null)
3034 0e039681 2021-11-15 stsp rm $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3035 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > /dev/null)
3037 0e039681 2021-11-15 stsp # update which changes a binary file
3038 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id2 > $testroot/stdout)
3040 0e039681 2021-11-15 stsp echo "U foo" > $testroot/stdout.expected
3041 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id2" \
3042 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3043 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3044 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3046 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3047 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3048 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3052 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
3053 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3054 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
3056 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3058 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3059 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3060 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3064 0e039681 2021-11-15 stsp # update which changes a locally modified binary file
3065 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
3066 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
3067 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id3 > $testroot/stdout)
3069 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
3070 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id3" \
3071 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3072 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3073 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
3074 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3076 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3077 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3078 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3082 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
3083 0e039681 2021-11-15 stsp > $testroot/content.expected
3084 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id3" \
3085 0e039681 2021-11-15 stsp >> $testroot/content.expected
3086 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3087 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
3088 0e039681 2021-11-15 stsp echo "||||||| 3-way merge base: commit $commit_id2" \
3089 0e039681 2021-11-15 stsp >> $testroot/content.expected
3090 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3091 0e039681 2021-11-15 stsp ls $testroot/wt/foo-orig-* >> $testroot/content.expected
3092 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
3093 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3094 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
3095 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
3096 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
3098 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3100 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3101 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3102 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3106 0e039681 2021-11-15 stsp cp /bin/cp $testroot/content.expected
3107 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3108 0e039681 2021-11-15 stsp cp $testroot/wt/foo-1-* $testroot/content
3109 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3111 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3112 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3113 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3117 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
3118 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3119 0e039681 2021-11-15 stsp cp $testroot/wt/foo-2-* $testroot/content
3120 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3122 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3123 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3124 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3128 0e039681 2021-11-15 stsp (cd $testroot/wt && got status > $testroot/stdout)
3129 d952957d 2023-02-19 mark echo 'C foo' > $testroot/stdout.expected
3130 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3131 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-1-* >> $testroot/stdout.expected)
3132 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3133 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
3134 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3135 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
3136 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3138 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3139 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3140 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3145 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . > /dev/null)
3146 0e039681 2021-11-15 stsp rm $testroot/wt/foo-orig-* $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3148 0e039681 2021-11-15 stsp # update which deletes a binary file
3149 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id4 > $testroot/stdout)
3150 0e039681 2021-11-15 stsp echo "D foo" > $testroot/stdout.expected
3151 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id4" \
3152 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3153 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3154 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3156 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3157 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3158 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3161 0e039681 2021-11-15 stsp if [ -e $testroot/wt/foo ]; then
3162 0e039681 2021-11-15 stsp echo "removed file foo still exists on disk" >&2
3163 0e039681 2021-11-15 stsp test_done "$testroot" "1"
3166 0e039681 2021-11-15 stsp test_done "$testroot" "0"
3169 b2b3fce1 2022-10-29 op test_update_umask() {
3170 b2b3fce1 2022-10-29 op local testroot=`test_init update_binary_file`
3172 b2b3fce1 2022-10-29 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
3174 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3175 b2b3fce1 2022-10-29 op test_done "$testroot" "$ret"
3179 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3181 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3182 b2b3fce1 2022-10-29 op (umask 022 && cd "$testroot/wt" && got update alpha) \
3183 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3185 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3186 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3190 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-r--r--; then
3191 b2b3fce1 2022-10-29 op echo "alpha is not 0644" >&2
3192 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3196 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3198 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3199 b2b3fce1 2022-10-29 op (umask 044 && cd "$testroot/wt" && got update alpha) \
3200 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3202 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3203 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3207 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
3208 b2b3fce1 2022-10-29 op echo "alpha is not 0600" >&2
3209 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3213 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3215 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3216 b2b3fce1 2022-10-29 op (umask 222 && cd "$testroot/wt" && got update alpha) \
3217 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3219 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3220 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3224 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-r--r--r--; then
3225 b2b3fce1 2022-10-29 op echo "alpha is not 0444" >&2
3226 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3230 b2b3fce1 2022-10-29 op test_done "$testroot" 0
3233 fd7552d2 2023-07-17 mark test_update_commit_keywords() {
3234 fd7552d2 2023-07-17 mark local testroot=`test_init update_commit_keywords`
3236 79c49d84 2023-07-24 mark set -- "$(git_show_head $testroot/repo)"
3238 fd7552d2 2023-07-17 mark got checkout $testroot/repo $testroot/wt > /dev/null
3240 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3241 fd7552d2 2023-07-17 mark echo "checkout failed unexpectedly" >&2
3242 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3246 fd7552d2 2023-07-17 mark for i in `seq 8`; do
3247 fd7552d2 2023-07-17 mark if [ $(( i % 2 )) -eq 0 ]; then
3248 fd7552d2 2023-07-17 mark echo "alpha change $i" > "$testroot/wt/alpha"
3250 fd7552d2 2023-07-17 mark echo "beta change $i" > "$testroot/wt/beta"
3253 fd7552d2 2023-07-17 mark (cd "$testroot/wt" && got ci -m "commit number $i" > /dev/null)
3255 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3256 fd7552d2 2023-07-17 mark echo "commit failed unexpectedly" >&2
3257 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3260 79c49d84 2023-07-24 mark set -- "$@" "$(git_show_head $testroot/repo)"
3263 fd7552d2 2023-07-17 mark echo "got: reference base not found" > $testroot/stderr.expected
3265 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -cbase:-2 2> $testroot/stderr)
3267 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3268 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3269 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3273 fd7552d2 2023-07-17 mark echo "got: 'basefoo': invalid commit keyword" > \
3274 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3276 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:basefoo:-2 2> $testroot/stderr)
3278 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3279 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3280 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3284 fd7552d2 2023-07-17 mark echo "got: ':base::': invalid commit keyword" > \
3285 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3287 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:base:: 2> $testroot/stderr)
3289 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3290 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3291 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3295 fd7552d2 2023-07-17 mark echo "got: ':head:++': invalid commit keyword" > \
3296 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3298 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:head:++ 2> $testroot/stderr)
3300 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3301 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3302 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3306 fd7552d2 2023-07-17 mark echo "got: ':head:+x': invalid commit keyword" > \
3307 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3309 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:head:+x 2> $testroot/stderr)
3311 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3312 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3313 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3317 fd7552d2 2023-07-17 mark echo "got: 'master::': invalid commit keyword" > \
3318 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3320 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -cmaster:: 2> $testroot/stderr)
3322 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3323 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3324 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3328 fd7552d2 2023-07-17 mark echo "got: 'master:++': invalid commit keyword" > \
3329 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3331 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -cmaster:++ 2> $testroot/stderr)
3333 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3334 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3335 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3339 fd7552d2 2023-07-17 mark echo "got: 'master:+x': invalid commit keyword" > \
3340 fd7552d2 2023-07-17 mark $testroot/stderr.expected
3342 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -cmaster:+x 2> $testroot/stderr)
3344 fd7552d2 2023-07-17 mark if [ $ret -ne 1 ]; then
3345 fd7552d2 2023-07-17 mark echo "update succeeded unexpectedly" >&2
3346 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3350 fd7552d2 2023-07-17 mark cmp -s $testroot/stderr.expected $testroot/stderr
3352 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3353 fd7552d2 2023-07-17 mark diff -u $testroot/stderr.expected $testroot/stderr
3354 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3358 fd7552d2 2023-07-17 mark echo "U alpha" > $testroot/stdout.expected
3359 fd7552d2 2023-07-17 mark echo "U beta" >> $testroot/stdout.expected
3360 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3361 79c49d84 2023-07-24 mark echo $(pop_idx 7 $@) >> "$testroot/stdout.expected"
3363 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:base:-2 > $testroot/stdout)
3365 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3366 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3367 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3371 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3373 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3374 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3375 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3379 fd7552d2 2023-07-17 mark echo "U beta" > $testroot/stdout.expected
3380 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3381 79c49d84 2023-07-24 mark echo $(pop_idx 8 $@) >> "$testroot/stdout.expected"
3383 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -cmaster:- > $testroot/stdout)
3385 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3386 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3387 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3391 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3393 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3394 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3395 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3399 fd7552d2 2023-07-17 mark echo "alpha change 6" > $testroot/content.expected
3400 fd7552d2 2023-07-17 mark cat $testroot/wt/alpha > $testroot/content
3402 fd7552d2 2023-07-17 mark cmp -s $testroot/content.expected $testroot/content
3404 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3405 fd7552d2 2023-07-17 mark diff -u $testroot/content.expected $testroot/content
3406 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3410 fd7552d2 2023-07-17 mark echo "U alpha" > $testroot/stdout.expected
3411 fd7552d2 2023-07-17 mark echo "U beta" >> $testroot/stdout.expected
3412 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3413 79c49d84 2023-07-24 mark echo $(pop_idx 2 $@) >> "$testroot/stdout.expected"
3415 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:base:-6 > $testroot/stdout)
3417 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3418 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3419 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3423 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3425 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3426 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3427 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3431 fd7552d2 2023-07-17 mark echo "beta change 1" > $testroot/content.expected
3432 fd7552d2 2023-07-17 mark cat $testroot/wt/beta > $testroot/content
3434 fd7552d2 2023-07-17 mark cmp -s $testroot/content.expected $testroot/content
3436 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3437 fd7552d2 2023-07-17 mark diff -u $testroot/content.expected $testroot/content
3438 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3442 fd7552d2 2023-07-17 mark echo "U alpha" > $testroot/stdout.expected
3443 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3444 79c49d84 2023-07-24 mark echo $(pop_idx 3 $@) >> "$testroot/stdout.expected"
3446 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:base:+ > $testroot/stdout)
3448 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3449 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3450 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3454 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3456 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3457 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3458 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3462 fd7552d2 2023-07-17 mark echo "alpha change 2" > $testroot/content.expected
3463 fd7552d2 2023-07-17 mark cat $testroot/wt/alpha > $testroot/content
3465 fd7552d2 2023-07-17 mark cmp -s $testroot/content.expected $testroot/content
3467 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3468 fd7552d2 2023-07-17 mark diff -u $testroot/content.expected $testroot/content
3469 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3473 fd7552d2 2023-07-17 mark echo "U alpha" > $testroot/stdout.expected
3474 fd7552d2 2023-07-17 mark echo "U beta" >> $testroot/stdout.expected
3475 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3476 79c49d84 2023-07-24 mark echo $(pop_idx 7 $@) >> "$testroot/stdout.expected"
3478 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:head:-2 > $testroot/stdout)
3480 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3481 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3482 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3486 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3488 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3489 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3490 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3494 fd7552d2 2023-07-17 mark echo "alpha change 6" > $testroot/content.expected
3495 fd7552d2 2023-07-17 mark cat $testroot/wt/alpha > $testroot/content
3497 fd7552d2 2023-07-17 mark cmp -s $testroot/content.expected $testroot/content
3499 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3500 fd7552d2 2023-07-17 mark diff -u $testroot/content.expected $testroot/content
3501 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3505 fd7552d2 2023-07-17 mark # if - modifier is too great, use root commit
3506 fd7552d2 2023-07-17 mark echo "U alpha" > $testroot/stdout.expected
3507 fd7552d2 2023-07-17 mark echo "U beta" >> $testroot/stdout.expected
3508 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3509 79c49d84 2023-07-24 mark echo $(pop_idx 1 $@) >> "$testroot/stdout.expected"
3511 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:base:-20 > $testroot/stdout)
3513 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3514 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3515 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3519 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3521 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3522 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3523 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3527 fd7552d2 2023-07-17 mark echo "alpha" > $testroot/content.expected
3528 fd7552d2 2023-07-17 mark cat $testroot/wt/alpha > $testroot/content
3530 fd7552d2 2023-07-17 mark cmp -s $testroot/content.expected $testroot/content
3532 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3533 fd7552d2 2023-07-17 mark diff -u $testroot/content.expected $testroot/content
3534 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3538 fd7552d2 2023-07-17 mark # if + modifier is too great, use HEAD commit
3539 fd7552d2 2023-07-17 mark echo "U alpha" > $testroot/stdout.expected
3540 fd7552d2 2023-07-17 mark echo "U beta" >> $testroot/stdout.expected
3541 fd7552d2 2023-07-17 mark echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
3542 79c49d84 2023-07-24 mark echo $(pop_idx 9 $@) >> "$testroot/stdout.expected"
3544 fd7552d2 2023-07-17 mark (cd $testroot/wt && got update -c:head:+10 > $testroot/stdout)
3546 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3547 fd7552d2 2023-07-17 mark echo "update failed unexpectedly" >&2
3548 fd7552d2 2023-07-17 mark test_done "$testroot" "1"
3552 fd7552d2 2023-07-17 mark cmp -s $testroot/stdout.expected $testroot/stdout
3554 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3555 fd7552d2 2023-07-17 mark diff -u $testroot/stdout.expected $testroot/stdout
3556 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3560 fd7552d2 2023-07-17 mark echo "alpha change 8" > $testroot/content.expected
3561 fd7552d2 2023-07-17 mark cat $testroot/wt/alpha > $testroot/content
3563 fd7552d2 2023-07-17 mark cmp -s $testroot/content.expected $testroot/content
3565 fd7552d2 2023-07-17 mark if [ $ret -ne 0 ]; then
3566 fd7552d2 2023-07-17 mark diff -u $testroot/content.expected $testroot/content
3568 fd7552d2 2023-07-17 mark test_done "$testroot" "$ret"
3571 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3572 c84d8c75 2019-01-02 stsp run_test test_update_basic
3573 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
3574 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
3575 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
3576 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
3577 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
3578 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
3579 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
3580 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
3581 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
3582 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
3583 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
3584 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
3585 c3b9af18 2023-02-26 naddy run_test test_update_changes_file_to_dir
3586 d48a8086 2023-03-10 stsp run_test test_update_changes_dir_to_file
3587 07fa9365 2023-03-10 stsp run_test test_update_changes_modified_file_to_dir
3588 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
3589 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
3590 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
3591 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
3592 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
3593 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
3594 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
3595 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
3596 c4cdcb68 2019-04-03 stsp run_test test_update_partial
3597 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
3598 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
3599 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
3600 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
3601 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
3602 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
3603 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
3604 303e2782 2019-08-09 stsp run_test test_update_tag
3605 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
3606 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
3607 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
3608 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
3609 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
3610 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
3611 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
3612 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
3613 194cb7cb 2021-01-19 stsp run_test test_update_single_file
3614 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
3615 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction
3616 67c65ed7 2021-09-14 tracey run_test test_update_quiet
3617 0e039681 2021-11-15 stsp run_test test_update_binary_file
3618 b2b3fce1 2022-10-29 op run_test test_update_umask
3619 fd7552d2 2023-07-17 mark run_test test_update_commit_keywords