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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 3b4d3732 2019-01-02 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
105 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
109 97631c52 2023-02-24 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
146 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
150 97631c52 2023-02-24 thomas 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 fc414659 2022-04-16 thomas 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 5cc266ba 2019-01-06 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 90285c3b 2019-01-08 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 81a30460 2019-01-08 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 50952927 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
396 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
400 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu)
401 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu)
456 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git 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 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git 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 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 21908da4 2019-01-13 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 21908da4 2019-01-13 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 7b074ee1 2023-03-01 thomas test_update_changes_file_to_dir() {
640 7b074ee1 2023-03-01 thomas local testroot=`test_init update_changes_file_to_dir`
642 7b074ee1 2023-03-01 thomas got checkout $testroot/repo $testroot/wt > /dev/null
644 7b074ee1 2023-03-01 thomas if [ $ret -ne 0 ]; then
645 7b074ee1 2023-03-01 thomas test_done "$testroot" "$ret"
649 7b074ee1 2023-03-01 thomas git_rm $testroot/repo alpha
650 7b074ee1 2023-03-01 thomas mkdir $testroot/repo/alpha
651 7b074ee1 2023-03-01 thomas echo eta > $testroot/repo/alpha/eta
652 7b074ee1 2023-03-01 thomas (cd $testroot/repo && git add alpha/eta)
653 7b074ee1 2023-03-01 thomas git_commit $testroot/repo -m "changed alpha into directory"
655 7b074ee1 2023-03-01 thomas (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
657 7b074ee1 2023-03-01 thomas if [ $ret -ne 0 ]; then
658 9f323212 2023-03-10 thomas echo "update failed unexpectedly" >&2
659 9f323212 2023-03-10 thomas test_done "$testroot" "1"
663 9f323212 2023-03-10 thomas echo "D alpha" > $testroot/stdout.expected
664 9f323212 2023-03-10 thomas echo "A alpha/eta" >> $testroot/stdout.expected
665 9f323212 2023-03-10 thomas echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
666 9f323212 2023-03-10 thomas git_show_head $testroot/repo >> $testroot/stdout.expected
667 9f323212 2023-03-10 thomas echo >> $testroot/stdout.expected
669 9f323212 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
671 9f323212 2023-03-10 thomas if [ $ret -ne 0 ]; then
672 9f323212 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
674 7b074ee1 2023-03-01 thomas test_done "$testroot" "$ret"
677 8ed5d26b 2023-03-10 thomas test_update_changes_dir_to_file() {
678 8ed5d26b 2023-03-10 thomas local testroot=`test_init update_changes_dir_to_file`
680 8ed5d26b 2023-03-10 thomas got checkout $testroot/repo $testroot/wt > /dev/null
682 8ed5d26b 2023-03-10 thomas if [ $ret -ne 0 ]; then
683 8ed5d26b 2023-03-10 thomas test_done "$testroot" "$ret"
687 8ed5d26b 2023-03-10 thomas git_rmdir $testroot/repo epsilon
688 8ed5d26b 2023-03-10 thomas echo epsilon > $testroot/repo/epsilon
689 8ed5d26b 2023-03-10 thomas cp $testroot/repo/epsilon $testroot/content.expected
690 8ed5d26b 2023-03-10 thomas (cd $testroot/repo && git add epsilon)
691 8ed5d26b 2023-03-10 thomas git_commit $testroot/repo -m "changed epsilon into file"
693 8ed5d26b 2023-03-10 thomas (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
695 8ed5d26b 2023-03-10 thomas if [ $ret -ne 0 ]; then
696 8ed5d26b 2023-03-10 thomas echo "update failed unexpectedly" >&2
697 8ed5d26b 2023-03-10 thomas test_done "$testroot" "1"
701 8ed5d26b 2023-03-10 thomas # The current behaviour is not perfect, but we accept it for now.
702 8ed5d26b 2023-03-10 thomas echo "~ epsilon" > $testroot/stdout.expected
703 8ed5d26b 2023-03-10 thomas echo "D epsilon/zeta" >> $testroot/stdout.expected
704 8ed5d26b 2023-03-10 thomas echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
705 8ed5d26b 2023-03-10 thomas git_show_head $testroot/repo >> $testroot/stdout.expected
706 8ed5d26b 2023-03-10 thomas echo >> $testroot/stdout.expected
707 8ed5d26b 2023-03-10 thomas echo "File paths obstructed by a non-regular file: 1" \
708 8ed5d26b 2023-03-10 thomas >> $testroot/stdout.expected
710 8ed5d26b 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
712 8ed5d26b 2023-03-10 thomas if [ $ret -ne 0 ]; then
713 8ed5d26b 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
714 8ed5d26b 2023-03-10 thomas test_done "$testroot" "$ret"
718 8ed5d26b 2023-03-10 thomas # Updating again now restores the file which was obstructed by a
719 8ed5d26b 2023-03-10 thomas # directory in the previous update operation. Ideally, a single
720 8ed5d26b 2023-03-10 thomas # update operation would suffice.
721 8ed5d26b 2023-03-10 thomas (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
723 8ed5d26b 2023-03-10 thomas if [ $ret -ne 0 ]; then
724 8ed5d26b 2023-03-10 thomas echo "update failed unexpectedly" >&2
725 8ed5d26b 2023-03-10 thomas test_done "$testroot" "1"
728 8ed5d26b 2023-03-10 thomas echo "A epsilon" > $testroot/stdout.expected
729 8ed5d26b 2023-03-10 thomas echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
730 8ed5d26b 2023-03-10 thomas git_show_head $testroot/repo >> $testroot/stdout.expected
731 8ed5d26b 2023-03-10 thomas echo >> $testroot/stdout.expected
733 8ed5d26b 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
735 8ed5d26b 2023-03-10 thomas if [ $ret -ne 0 ]; then
736 8ed5d26b 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
737 8ed5d26b 2023-03-10 thomas test_done "$testroot" "$ret"
741 8ed5d26b 2023-03-10 thomas cmp -s $testroot/content.expected $testroot/wt/epsilon
743 8ed5d26b 2023-03-10 thomas if [ $ret -ne 0 ]; then
744 8ed5d26b 2023-03-10 thomas diff -u $testroot/content.expected $testroot/wt/epsilon
746 8ed5d26b 2023-03-10 thomas test_done "$testroot" "$ret"
749 9f323212 2023-03-10 thomas test_update_changes_modified_file_to_dir() {
750 9f323212 2023-03-10 thomas local testroot=`test_init update_changes_modified_file_to_dir`
752 9f323212 2023-03-10 thomas got checkout $testroot/repo $testroot/wt > /dev/null
754 9f323212 2023-03-10 thomas if [ $ret -ne 0 ]; then
755 9f323212 2023-03-10 thomas test_done "$testroot" "$ret"
759 9f323212 2023-03-10 thomas git_rm $testroot/repo alpha
760 9f323212 2023-03-10 thomas mkdir $testroot/repo/alpha
761 9f323212 2023-03-10 thomas echo eta > $testroot/repo/alpha/eta
762 9f323212 2023-03-10 thomas (cd $testroot/repo && git add alpha/eta)
763 9f323212 2023-03-10 thomas git_commit $testroot/repo -m "changed alpha into directory"
765 9f323212 2023-03-10 thomas echo "modified alpha" >> $testroot/wt/alpha
766 9f323212 2023-03-10 thomas cp $testroot/wt/alpha $testroot/wt/content.expected
767 9f323212 2023-03-10 thomas (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
769 9f323212 2023-03-10 thomas if [ $ret -eq 0 ]; then
770 9f323212 2023-03-10 thomas echo "update succeeded unexpectedly" >&2
771 9f323212 2023-03-10 thomas test_done "$testroot" "1"
775 9f323212 2023-03-10 thomas echo "d alpha" > $testroot/stdout.expected
776 9f323212 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
778 9f323212 2023-03-10 thomas if [ $ret -ne 0 ]; then
779 9f323212 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
780 9f323212 2023-03-10 thomas test_done "$testroot" "$ret"
784 9f323212 2023-03-10 thomas echo "got: alpha/eta: file is obstructed" > $testroot/stderr.expected
785 9f323212 2023-03-10 thomas cmp -s $testroot/stderr.expected $testroot/stderr
787 9f323212 2023-03-10 thomas if [ $ret -ne 0 ]; then
788 9f323212 2023-03-10 thomas diff -u $testroot/stderr.expected $testroot/stderr
790 9f323212 2023-03-10 thomas 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 6353ad76 2019-02-08 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 ac3cdf31 2023-03-06 thomas 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 ac3cdf31 2023-03-06 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1092 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1096 708d8e67 2019-03-27 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
1181 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
1182 9b4458b4 2022-06-26 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1207 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1211 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1344 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1346 f1417e9f 2021-10-12 thomas echo "A epsilon/new2" > $testroot/stdout.expected
1347 f1417e9f 2021-10-12 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1381 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1385 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 024e9686 2019-05-14 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1580 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1584 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 1a36436d 2019-06-10 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 9bead371 2019-07-28 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 303e2782 2019-08-09 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 523b8417 2019-10-19 stsp (cd $testroot/repo && git 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 fc414659 2022-04-16 thomas 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 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1889 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1890 e7303626 2020-05-14 stsp (cd $testroot/repo && git 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 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1897 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1898 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1899 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1900 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1902 e7303626 2020-05-14 stsp # This update only records the new base commit. Otherwise it is a
1903 e7303626 2020-05-14 stsp # no-op change because Got's file index does not track submodules.
1904 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " > $testroot/stdout.expected
1905 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1906 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1908 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1910 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1912 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1913 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1915 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1918 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1919 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1921 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1923 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1925 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1926 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1928 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1929 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1930 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1932 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1933 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1934 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1935 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1937 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1939 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1941 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1942 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1944 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1947 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1948 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1950 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1952 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1954 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1955 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1956 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1957 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1959 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1960 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1961 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1965 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1966 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1967 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1969 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1970 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1971 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1973 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1974 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1975 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1976 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1977 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1978 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1980 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1982 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1984 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1985 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1986 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1990 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1992 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1993 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1995 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1996 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1998 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
2001 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
2002 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
2004 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2006 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2007 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2008 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2012 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2013 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2014 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2015 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2016 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2017 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
2018 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2020 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
2021 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
2022 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
2023 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
2024 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
2025 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2026 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2027 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
2029 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2031 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2033 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2034 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2035 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2039 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
2040 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
2041 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2045 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
2046 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
2047 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2049 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2050 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2051 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2055 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2056 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
2057 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2061 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2062 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
2063 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2065 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2066 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2067 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2071 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2072 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2073 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2074 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2078 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2079 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2081 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2083 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2084 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2085 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2089 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
2090 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
2091 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2093 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2094 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2095 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2099 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
2100 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
2101 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2103 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2104 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2105 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
2109 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
2110 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
2111 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
2112 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2114 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2115 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
2117 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2120 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
2121 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
2123 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2124 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2125 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
2127 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2129 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2130 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2131 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2135 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
2136 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
2138 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
2139 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2140 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2141 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2143 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2145 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2147 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2148 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2149 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2153 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
2154 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
2155 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2159 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2162 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
2163 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
2165 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2166 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2167 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2168 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2169 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2170 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2171 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2172 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2173 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2175 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2177 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2178 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2179 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2183 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2184 e6f45b72 2023-03-03 thomas (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link)
2185 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2186 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2187 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2188 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2189 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2190 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2191 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2192 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2193 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2195 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2196 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2197 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2198 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon.link && ln -s beta epsilon.link)
2199 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2200 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon/beta.link && ln -s ../gamma \
2201 e6f45b72 2023-03-03 thomas epsilon/beta.link)
2202 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2203 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2204 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2205 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2206 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2207 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2208 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2209 993e2a1b 2020-07-23 stsp # to nonexistent file B
2210 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2211 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2212 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2213 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2214 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2215 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2217 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2219 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2220 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2221 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2222 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2223 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2224 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2225 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2226 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2227 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2228 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2229 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2230 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2232 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2234 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2235 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2236 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2240 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2241 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2242 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2246 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2247 283102fc 2020-07-23 stsp > $testroot/content.expected
2248 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2249 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2250 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2251 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2252 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2253 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2254 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2255 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2257 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2258 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2260 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2261 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2262 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2266 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2267 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2268 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2272 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2273 283102fc 2020-07-23 stsp > $testroot/content.expected
2274 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2275 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2276 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2277 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2278 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2279 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2280 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2281 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2283 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2284 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2286 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2287 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2288 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2292 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2293 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2294 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2295 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2299 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2300 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2302 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2304 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2305 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2306 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2310 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2311 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2312 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2316 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2317 283102fc 2020-07-23 stsp > $testroot/content.expected
2318 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2319 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2320 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2321 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2322 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2323 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2324 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2325 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2327 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2328 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2330 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2331 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2332 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2336 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2337 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2338 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2339 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2343 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2344 283102fc 2020-07-23 stsp > $testroot/content.expected
2345 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2346 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2347 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2348 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2349 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2351 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2352 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2354 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2355 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2356 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2360 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2361 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2362 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2366 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2367 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2368 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2369 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2370 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2371 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2372 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2374 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2375 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2377 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2378 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2379 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2383 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2384 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2385 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2388 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2389 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2390 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2391 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2392 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2393 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2394 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2396 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2397 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2399 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2400 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2401 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2405 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2406 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2407 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2411 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2412 283102fc 2020-07-23 stsp > $testroot/content.expected
2413 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2414 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2415 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2416 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2417 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2419 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2420 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2422 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2423 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2424 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2428 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2429 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2430 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2431 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2433 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2434 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2435 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2439 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2443 194cb7cb 2021-01-19 stsp test_update_single_file() {
2444 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2446 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2447 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2448 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2449 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2451 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2452 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2453 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2454 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2455 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2456 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2458 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2459 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2460 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2462 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2464 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2465 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2469 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2470 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2471 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2473 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2474 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2476 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2478 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2479 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2480 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2484 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2485 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2487 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2489 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2490 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2491 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2495 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2496 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
2497 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2499 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2501 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2503 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2504 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2505 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2509 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2510 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2512 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2514 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2515 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2516 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2520 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2521 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2522 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2524 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2525 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2527 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2528 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2530 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2531 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2532 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2536 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2537 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2539 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2540 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2541 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2545 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2546 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2547 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2549 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2550 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2552 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2553 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2554 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2558 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2559 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2560 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2564 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2568 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2569 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2570 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2571 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2573 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2574 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2575 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2576 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2578 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2580 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2581 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2585 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2586 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2587 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2588 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2589 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2593 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2594 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2595 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2596 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2597 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2601 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2603 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2605 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2606 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id0" \
2607 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2608 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2609 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2611 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2612 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2613 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2617 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2618 a769b60b 2021-06-27 stsp > $testroot/content.expected
2619 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2620 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2621 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2622 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2623 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2624 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2625 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2627 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2629 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2631 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2632 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2633 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2637 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2638 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2639 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2640 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2641 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2645 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2646 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2647 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2648 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2649 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2653 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2654 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2655 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2656 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2657 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2658 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2659 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2660 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2662 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2663 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2664 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2668 a769b60b 2021-06-27 stsp # blob ID of beta should not have changed
2669 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2670 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2671 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2672 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2673 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2677 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2678 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2679 a769b60b 2021-06-27 stsp # file was not updated.
2680 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2681 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2682 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2683 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2684 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2688 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2689 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2690 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2691 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2693 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2694 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2695 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2699 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2700 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2702 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2703 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2704 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2705 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2707 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2708 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2709 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2713 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2714 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2715 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2716 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2717 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2718 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2720 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2721 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2722 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2726 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2727 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2728 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2729 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2730 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2734 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2735 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2736 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2737 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2738 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2742 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2743 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2744 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2746 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2747 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2749 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2752 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2753 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2754 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2755 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2757 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2758 e6f4ba31 2021-09-24 thomas echo "new file" > $testroot/repo/new
2759 e6f4ba31 2021-09-24 thomas (cd $testroot/repo && git add new)
2760 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2761 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2762 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2764 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2766 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2767 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2771 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2772 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2773 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2774 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2775 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2779 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2780 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2781 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2782 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2783 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2787 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2788 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2789 e6f4ba31 2021-09-24 thomas mkdir -p $testroot/wt/new
2791 e6f4ba31 2021-09-24 thomas # update to the latest commit; this skips beta and the new file
2792 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2794 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2795 e6f4ba31 2021-09-24 thomas echo "update failed unexpectedly" >&2
2796 e6f4ba31 2021-09-24 thomas test_done "$testroot" "1"
2797 e6f4ba31 2021-09-24 thomas return 1
2800 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2801 e6f4ba31 2021-09-24 thomas echo "~ new" >> $testroot/stdout.expected
2802 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2803 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2804 e6f4ba31 2021-09-24 thomas echo "File paths obstructed by a non-regular file: 2" \
2805 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2806 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2808 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2809 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2810 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2814 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2815 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2816 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2817 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2818 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2822 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2823 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2824 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2825 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2826 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2830 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2831 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2833 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2834 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2835 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2836 e6f4ba31 2021-09-24 thomas echo "~ new" >> $testroot/stdout.expected
2837 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2838 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2839 e6f4ba31 2021-09-24 thomas echo "File paths obstructed by a non-regular file: 1" \
2840 e6f4ba31 2021-09-24 thomas >> $testroot/stdout.expected
2841 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2843 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2844 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2845 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2849 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2850 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2851 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2852 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2853 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2857 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2858 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2859 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2860 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2861 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2865 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2866 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2867 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2869 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2870 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2872 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2875 67c65ed7 2021-09-14 tracey test_update_quiet() {
2876 67c65ed7 2021-09-14 tracey local testroot=`test_init update_quiet`
2878 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
2880 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2881 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2882 67c65ed7 2021-09-14 tracey return 1
2885 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/repo/alpha
2886 67c65ed7 2021-09-14 tracey git_commit $testroot/repo -m "modified alpha"
2888 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2889 67c65ed7 2021-09-14 tracey git_show_head $testroot/repo >> $testroot/stdout.expected
2890 67c65ed7 2021-09-14 tracey echo >> $testroot/stdout.expected
2892 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got update -q > $testroot/stdout)
2894 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
2896 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2897 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
2898 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2899 67c65ed7 2021-09-14 tracey return 1
2902 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/content.expected
2903 67c65ed7 2021-09-14 tracey cat $testroot/wt/alpha > $testroot/content
2905 67c65ed7 2021-09-14 tracey cmp -s $testroot/content.expected $testroot/content
2907 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2908 67c65ed7 2021-09-14 tracey diff -u $testroot/content.expected $testroot/content
2910 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2913 24f136e0 2021-11-20 thomas test_update_binary_file() {
2914 24f136e0 2021-11-20 thomas local testroot=`test_init update_binary_file`
2915 24f136e0 2021-11-20 thomas local commit_id0=`git_show_head $testroot/repo`
2917 24f136e0 2021-11-20 thomas got checkout $testroot/repo $testroot/wt > /dev/null
2919 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2920 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2921 24f136e0 2021-11-20 thomas return 1
2924 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/wt/foo
2925 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2926 24f136e0 2021-11-20 thomas (cd $testroot/wt && got add foo >/dev/null)
2927 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
2928 24f136e0 2021-11-20 thomas local commit_id1=`git_show_head $testroot/repo`
2930 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/wt/foo
2931 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2932 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2933 24f136e0 2021-11-20 thomas local commit_id2=`git_show_head $testroot/repo`
2935 24f136e0 2021-11-20 thomas cp /bin/cp $testroot/wt/foo
2936 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2937 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2938 24f136e0 2021-11-20 thomas local commit_id3=`git_show_head $testroot/repo`
2940 24f136e0 2021-11-20 thomas (cd $testroot/wt && got rm foo >/dev/null)
2941 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'remove binary file' > /dev/null)
2942 24f136e0 2021-11-20 thomas local commit_id4=`git_show_head $testroot/repo`
2944 24f136e0 2021-11-20 thomas # backdate the work tree to make it usable for updating
2945 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2947 24f136e0 2021-11-20 thomas # update which adds a binary file
2948 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2950 24f136e0 2021-11-20 thomas echo "A foo" > $testroot/stdout.expected
2951 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id1" \
2952 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
2953 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
2954 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2956 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2957 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
2958 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2959 24f136e0 2021-11-20 thomas return 1
2962 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/content.expected
2963 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2964 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
2966 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2968 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2969 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2970 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2971 24f136e0 2021-11-20 thomas return 1
2974 24f136e0 2021-11-20 thomas # update which adds a conflicting binary file
2975 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2976 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/wt/foo
2977 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2978 24f136e0 2021-11-20 thomas (cd $testroot/wt && got add foo > /dev/null)
2979 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2981 24f136e0 2021-11-20 thomas echo "C foo" > $testroot/stdout.expected
2982 24f136e0 2021-11-20 thomas echo "Updated to refs/heads/master: $commit_id1" \
2983 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
2984 24f136e0 2021-11-20 thomas echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2985 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2987 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2988 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
2989 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2990 24f136e0 2021-11-20 thomas return 1
2993 24f136e0 2021-11-20 thomas echo "Binary files differ and cannot be merged automatically:" \
2994 24f136e0 2021-11-20 thomas > $testroot/content.expected
2995 24f136e0 2021-11-20 thomas echo "<<<<<<< merged change: commit $commit_id1" \
2996 24f136e0 2021-11-20 thomas >> $testroot/content.expected
2997 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
2998 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-1-* >> $testroot/content.expected
2999 24f136e0 2021-11-20 thomas echo '=======' >> $testroot/content.expected
3000 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
3001 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-2-* >> $testroot/content.expected
3002 24f136e0 2021-11-20 thomas echo ">>>>>>>" >> $testroot/content.expected
3003 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
3005 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3007 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3008 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3009 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3010 24f136e0 2021-11-20 thomas return 1
3013 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/content.expected
3014 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
3015 24f136e0 2021-11-20 thomas cat $testroot/wt/foo-1-* > $testroot/content
3017 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3019 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3020 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3021 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3022 24f136e0 2021-11-20 thomas return 1
3025 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/content.expected
3026 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
3027 24f136e0 2021-11-20 thomas cat $testroot/wt/foo-2-* > $testroot/content
3029 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3031 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3032 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3033 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3034 24f136e0 2021-11-20 thomas return 1
3037 24f136e0 2021-11-20 thomas # tidy up
3038 24f136e0 2021-11-20 thomas (cd $testroot/wt && got revert -R . >/dev/null)
3039 24f136e0 2021-11-20 thomas rm $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3040 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id1 > /dev/null)
3042 24f136e0 2021-11-20 thomas # update which changes a binary file
3043 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id2 > $testroot/stdout)
3045 24f136e0 2021-11-20 thomas echo "U foo" > $testroot/stdout.expected
3046 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id2" \
3047 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
3048 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
3049 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
3051 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3052 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
3053 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3054 24f136e0 2021-11-20 thomas return 1
3057 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/content.expected
3058 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
3059 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
3061 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3063 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3064 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3065 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3066 24f136e0 2021-11-20 thomas return 1
3069 24f136e0 2021-11-20 thomas # update which changes a locally modified binary file
3070 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/wt/foo
3071 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
3072 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id3 > $testroot/stdout)
3074 24f136e0 2021-11-20 thomas echo "C foo" > $testroot/stdout.expected
3075 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id3" \
3076 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
3077 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
3078 24f136e0 2021-11-20 thomas echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
3079 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
3081 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3082 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
3083 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3084 24f136e0 2021-11-20 thomas return 1
3087 24f136e0 2021-11-20 thomas echo "Binary files differ and cannot be merged automatically:" \
3088 24f136e0 2021-11-20 thomas > $testroot/content.expected
3089 24f136e0 2021-11-20 thomas echo "<<<<<<< merged change: commit $commit_id3" \
3090 24f136e0 2021-11-20 thomas >> $testroot/content.expected
3091 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
3092 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-1-* >> $testroot/content.expected
3093 24f136e0 2021-11-20 thomas echo "||||||| 3-way merge base: commit $commit_id2" \
3094 24f136e0 2021-11-20 thomas >> $testroot/content.expected
3095 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
3096 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-orig-* >> $testroot/content.expected
3097 24f136e0 2021-11-20 thomas echo '=======' >> $testroot/content.expected
3098 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
3099 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-2-* >> $testroot/content.expected
3100 24f136e0 2021-11-20 thomas echo ">>>>>>>" >> $testroot/content.expected
3101 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
3103 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3105 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3106 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3107 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3108 24f136e0 2021-11-20 thomas return 1
3111 24f136e0 2021-11-20 thomas cp /bin/cp $testroot/content.expected
3112 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
3113 24f136e0 2021-11-20 thomas cp $testroot/wt/foo-1-* $testroot/content
3114 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3116 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3117 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3118 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3119 24f136e0 2021-11-20 thomas return 1
3122 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/content.expected
3123 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
3124 24f136e0 2021-11-20 thomas cp $testroot/wt/foo-2-* $testroot/content
3125 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
3127 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3128 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
3129 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3130 24f136e0 2021-11-20 thomas return 1
3133 24f136e0 2021-11-20 thomas (cd $testroot/wt && got status > $testroot/stdout)
3134 8de9d8ad 2023-02-20 thomas echo 'C foo' > $testroot/stdout.expected
3135 24f136e0 2021-11-20 thomas echo -n '? ' >> $testroot/stdout.expected
3136 24f136e0 2021-11-20 thomas (cd $testroot/wt && ls foo-1-* >> $testroot/stdout.expected)
3137 24f136e0 2021-11-20 thomas echo -n '? ' >> $testroot/stdout.expected
3138 24f136e0 2021-11-20 thomas (cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
3139 24f136e0 2021-11-20 thomas echo -n '? ' >> $testroot/stdout.expected
3140 24f136e0 2021-11-20 thomas (cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
3141 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
3143 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3144 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
3145 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3146 24f136e0 2021-11-20 thomas return 1
3149 24f136e0 2021-11-20 thomas # tidy up
3150 24f136e0 2021-11-20 thomas (cd $testroot/wt && got revert -R . > /dev/null)
3151 24f136e0 2021-11-20 thomas rm $testroot/wt/foo-orig-* $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3153 24f136e0 2021-11-20 thomas # update which deletes a binary file
3154 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id4 > $testroot/stdout)
3155 24f136e0 2021-11-20 thomas echo "D foo" > $testroot/stdout.expected
3156 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id4" \
3157 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
3158 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
3159 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
3161 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3162 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
3163 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3166 24f136e0 2021-11-20 thomas if [ -e $testroot/wt/foo ]; then
3167 24f136e0 2021-11-20 thomas echo "removed file foo still exists on disk" >&2
3168 24f136e0 2021-11-20 thomas test_done "$testroot" "1"
3169 24f136e0 2021-11-20 thomas return 1
3171 24f136e0 2021-11-20 thomas test_done "$testroot" "0"
3174 a2c162eb 2022-10-30 thomas test_update_umask() {
3175 a2c162eb 2022-10-30 thomas local testroot=`test_init update_binary_file`
3177 a2c162eb 2022-10-30 thomas got checkout "$testroot/repo" "$testroot/wt" >/dev/null
3179 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3180 a2c162eb 2022-10-30 thomas test_done "$testroot" "$ret"
3181 a2c162eb 2022-10-30 thomas return 1
3184 a2c162eb 2022-10-30 thomas rm "$testroot/wt/alpha"
3186 a2c162eb 2022-10-30 thomas # using a subshell to avoid clobbering global umask
3187 a2c162eb 2022-10-30 thomas (umask 022 && cd "$testroot/wt" && got update alpha) \
3188 a2c162eb 2022-10-30 thomas >/dev/null 2>/dev/null
3190 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3191 a2c162eb 2022-10-30 thomas test_done "$testroot" $ret
3192 a2c162eb 2022-10-30 thomas return 1
3195 a2c162eb 2022-10-30 thomas if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-r--r--; then
3196 a2c162eb 2022-10-30 thomas echo "alpha is not 0644" >&2
3197 a2c162eb 2022-10-30 thomas test_done "$testroot" 1
3198 a2c162eb 2022-10-30 thomas return 1
3201 a2c162eb 2022-10-30 thomas rm "$testroot/wt/alpha"
3203 a2c162eb 2022-10-30 thomas # using a subshell to avoid clobbering global umask
3204 a2c162eb 2022-10-30 thomas (umask 044 && cd "$testroot/wt" && got update alpha) \
3205 a2c162eb 2022-10-30 thomas >/dev/null 2>/dev/null
3207 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3208 a2c162eb 2022-10-30 thomas test_done "$testroot" $ret
3209 a2c162eb 2022-10-30 thomas return 1
3212 a2c162eb 2022-10-30 thomas if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
3213 a2c162eb 2022-10-30 thomas echo "alpha is not 0600" >&2
3214 a2c162eb 2022-10-30 thomas test_done "$testroot" 1
3215 a2c162eb 2022-10-30 thomas return 1
3218 a2c162eb 2022-10-30 thomas rm "$testroot/wt/alpha"
3220 a2c162eb 2022-10-30 thomas # using a subshell to avoid clobbering global umask
3221 a2c162eb 2022-10-30 thomas (umask 222 && cd "$testroot/wt" && got update alpha) \
3222 a2c162eb 2022-10-30 thomas >/dev/null 2>/dev/null
3224 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3225 a2c162eb 2022-10-30 thomas test_done "$testroot" $ret
3226 a2c162eb 2022-10-30 thomas return 1
3229 a2c162eb 2022-10-30 thomas if ! ls -l "$testroot/wt/alpha" | grep -q ^-r--r--r--; then
3230 a2c162eb 2022-10-30 thomas echo "alpha is not 0444" >&2
3231 a2c162eb 2022-10-30 thomas test_done "$testroot" 1
3232 a2c162eb 2022-10-30 thomas return 1;
3235 a2c162eb 2022-10-30 thomas test_done "$testroot" 0
3238 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3239 c84d8c75 2019-01-02 stsp run_test test_update_basic
3240 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
3241 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
3242 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
3243 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
3244 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
3245 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
3246 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
3247 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
3248 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
3249 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
3250 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
3251 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
3252 7b074ee1 2023-03-01 thomas run_test test_update_changes_file_to_dir
3253 8ed5d26b 2023-03-10 thomas run_test test_update_changes_dir_to_file
3254 9f323212 2023-03-10 thomas run_test test_update_changes_modified_file_to_dir
3255 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
3256 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
3257 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
3258 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
3259 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
3260 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
3261 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
3262 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
3263 c4cdcb68 2019-04-03 stsp run_test test_update_partial
3264 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
3265 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
3266 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
3267 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
3268 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
3269 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
3270 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
3271 303e2782 2019-08-09 stsp run_test test_update_tag
3272 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
3273 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
3274 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
3275 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
3276 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
3277 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
3278 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
3279 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
3280 194cb7cb 2021-01-19 stsp run_test test_update_single_file
3281 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
3282 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction
3283 67c65ed7 2021-09-14 tracey run_test test_update_quiet
3284 24f136e0 2021-11-20 thomas run_test test_update_binary_file
3285 a2c162eb 2022-10-30 thomas run_test test_update_umask