3 c84d8c75 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 c84d8c75 2019-01-02 stsp # Permission to use, copy, modify, and distribute this software for any
6 c84d8c75 2019-01-02 stsp # purpose with or without fee is hereby granted, provided that the above
7 c84d8c75 2019-01-02 stsp # copyright notice and this permission notice appear in all copies.
9 c84d8c75 2019-01-02 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c84d8c75 2019-01-02 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c84d8c75 2019-01-02 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c84d8c75 2019-01-02 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c84d8c75 2019-01-02 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c84d8c75 2019-01-02 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c84d8c75 2019-01-02 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c84d8c75 2019-01-02 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_update_basic() {
20 0fbd721f 2019-01-02 stsp local testroot=`test_init update_basic`
22 3c90ba67 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
25 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
29 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/repo/alpha
30 c84d8c75 2019-01-02 stsp git_commit $testroot/repo -m "modified alpha"
32 c84d8c75 2019-01-02 stsp echo "U alpha" > $testroot/stdout.expected
33 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
34 9c4b8182 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
35 9c4b8182 2019-01-02 stsp echo >> $testroot/stdout.expected
37 c84d8c75 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
39 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
41 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
42 c84d8c75 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
43 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
47 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/content.expected
48 52a3df9b 2019-01-06 stsp cat $testroot/wt/alpha > $testroot/content
50 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
52 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
53 c84d8c75 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
55 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
58 f6cae3ed 2020-09-13 naddy test_update_adds_file() {
59 3b4d3732 2019-01-02 stsp local testroot=`test_init update_adds_file`
61 3b4d3732 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
63 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
64 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
68 3b4d3732 2019-01-02 stsp echo "new" > $testroot/repo/gamma/new
69 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
82 3b4d3732 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
87 3b4d3732 2019-01-02 stsp echo "new" >> $testroot/content.expected
88 52a3df9b 2019-01-06 stsp cat $testroot/wt/gamma/new > $testroot/content
90 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
92 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
93 3b4d3732 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
95 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
98 f6cae3ed 2020-09-13 naddy test_update_deletes_file() {
99 512f0d0e 2019-01-02 stsp local testroot=`test_init update_deletes_file`
101 1c4cdd89 2021-06-20 stsp mkdir $testroot/wtparent
102 1c4cdd89 2021-06-20 stsp got checkout $testroot/repo $testroot/wtparent/wt > /dev/null
104 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
105 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
109 512f0d0e 2019-01-02 stsp (cd $testroot/repo && git_rm $testroot/repo beta)
110 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
112 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
113 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
114 512f0d0e 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
115 512f0d0e 2019-01-02 stsp echo >> $testroot/stdout.expected
117 1c4cdd89 2021-06-20 stsp # verify that no error occurs if the work tree's parent
118 1c4cdd89 2021-06-20 stsp # directory is not writable
119 1c4cdd89 2021-06-20 stsp chmod u-w $testroot/wtparent
120 1c4cdd89 2021-06-20 stsp (cd $testroot/wtparent/wt && got update > $testroot/stdout)
121 1c4cdd89 2021-06-20 stsp chmod u+w $testroot/wtparent
123 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
125 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
126 512f0d0e 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
127 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
131 1c4cdd89 2021-06-20 stsp if [ -e $testroot/wtparent/wt/beta ]; then
132 512f0d0e 2019-01-02 stsp echo "removed file beta still exists on disk" >&2
133 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
137 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
140 f6cae3ed 2020-09-13 naddy test_update_deletes_dir() {
141 f5c49f82 2019-01-06 stsp local testroot=`test_init update_deletes_dir`
143 f5c49f82 2019-01-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
145 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
146 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
150 f5c49f82 2019-01-06 stsp (cd $testroot/repo && git_rm $testroot/repo -r epsilon)
151 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
153 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
154 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
155 f5c49f82 2019-01-06 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
156 f5c49f82 2019-01-06 stsp echo >> $testroot/stdout.expected
158 f5c49f82 2019-01-06 stsp (cd $testroot/wt && got update > $testroot/stdout)
160 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
162 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
163 f5c49f82 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
164 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
168 f5c49f82 2019-01-06 stsp if [ -e $testroot/wt/epsilon ]; then
169 f5c49f82 2019-01-06 stsp echo "removed dir epsilon still exists on disk" >&2
170 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
174 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
177 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_with_path_prefix() {
178 5cc266ba 2019-01-06 stsp local testroot=`test_init update_deletes_dir_with_path_prefix`
179 5cc266ba 2019-01-06 stsp local first_rev=`git_show_head $testroot/repo`
181 5cc266ba 2019-01-06 stsp mkdir $testroot/repo/epsilon/psi
182 5cc266ba 2019-01-06 stsp echo mu > $testroot/repo/epsilon/psi/mu
183 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
190 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
194 5cc266ba 2019-01-06 stsp # update back to first commit and expect psi/mu to be deleted
195 5cc266ba 2019-01-06 stsp echo "D psi/mu" > $testroot/stdout.expected
196 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
197 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
199 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
201 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
203 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
204 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
205 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
209 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
210 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
211 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
215 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
218 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_recursively() {
219 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
220 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
222 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
223 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
224 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
225 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
226 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
233 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
237 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
238 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
239 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
240 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
241 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
243 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
245 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
247 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
248 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
249 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
253 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
254 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
255 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
259 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
262 f6cae3ed 2020-09-13 naddy test_update_sibling_dirs_with_common_prefix() {
263 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
265 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
267 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
268 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
272 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
273 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
274 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
290 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
291 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
295 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
296 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
298 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
299 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
300 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
301 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
303 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
304 81a30460 2019-01-08 stsp # U epsilon/zeta
305 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
306 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
307 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
309 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
311 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
312 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
313 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
317 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
319 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
320 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
322 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
325 f6cae3ed 2020-09-13 naddy test_update_dir_with_dot_sibling() {
326 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
328 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
330 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
331 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
335 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
336 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 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
349 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
351 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
352 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
353 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
357 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
358 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
360 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
361 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
362 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
363 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
365 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
367 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
369 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
370 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
371 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
375 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
377 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
378 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
380 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
383 f6cae3ed 2020-09-13 naddy test_update_moves_files_upwards() {
384 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
386 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
387 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
388 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
389 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
390 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 49c543a6 2022-03-31 naddy 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 bd4792ec 2019-01-13 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
407 46cee7a3 2019-01-12 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
408 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
409 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
410 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
412 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
414 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
416 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
417 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
418 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
422 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
423 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
424 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
428 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
429 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
430 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
434 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
437 f6cae3ed 2020-09-13 naddy test_update_moves_files_to_new_dir() {
438 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
440 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
441 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
442 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
443 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
444 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
450 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
454 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
455 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 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
461 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
462 46cee7a3 2019-01-12 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
463 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
464 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
465 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
467 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
469 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
471 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
472 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
473 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
477 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
478 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
479 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
483 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
484 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
485 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
489 46cee7a3 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
504 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
508 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
509 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
539 bd4792ec 2019-01-13 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
556 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
560 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
561 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
591 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
592 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
596 4a1ddfc2 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
613 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
617 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
618 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 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
631 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
632 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
636 21908da4 2019-01-13 stsp test_done "$testroot" "0"
639 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
640 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
642 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
643 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
644 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
645 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
646 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
647 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
648 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
649 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
650 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
651 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
652 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
654 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
656 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
657 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
661 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
662 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
663 6353ad76 2019-02-08 stsp sed -i 's/2/22/' $testroot/repo/numbers
664 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
666 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
667 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
668 6353ad76 2019-02-08 stsp sed -i 's/7/77/' $testroot/wt/numbers
670 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
671 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
672 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
673 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
674 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
675 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
676 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
678 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
680 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
682 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
683 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
684 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
688 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
689 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
690 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
691 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
692 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
693 f69721c3 2019-10-21 stsp >> $testroot/content.expected
694 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
695 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
696 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
697 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
698 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
699 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
700 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
701 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
702 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
703 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
704 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
705 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
706 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
708 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
709 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
710 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
712 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
714 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
715 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
717 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
720 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
721 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
723 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
724 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
725 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
726 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
728 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
730 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
731 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
735 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
736 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
738 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
739 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
740 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
741 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
743 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
745 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
746 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
750 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
752 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
753 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
754 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
758 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
760 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
761 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
762 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
764 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
767 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
768 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
770 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
771 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
772 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
773 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
775 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
777 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
778 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
782 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
784 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
785 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
786 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
787 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
791 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
792 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
793 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
794 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
796 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
797 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
798 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
799 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
801 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
803 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
804 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
808 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
810 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
811 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
812 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
816 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
818 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
819 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
820 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
822 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
825 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
826 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
828 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
830 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
831 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
835 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
837 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
838 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
839 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
840 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
841 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
843 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
845 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
846 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
847 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
851 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
853 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
855 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
857 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
858 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
860 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
863 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
864 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
866 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
868 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
869 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
873 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
874 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
875 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
877 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
878 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
880 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
882 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
883 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
884 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
885 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
886 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
888 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
890 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
891 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
892 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
896 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
897 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
898 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
899 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
900 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
901 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
902 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
904 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
906 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
908 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
909 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
910 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
914 3165301c 2019-03-27 stsp # resolve the conflict
915 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
916 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
917 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
918 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
920 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
921 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
923 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
926 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
927 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
929 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
931 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
932 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
936 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
937 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
939 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
941 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
943 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
944 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
945 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
946 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
947 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
949 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
950 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
951 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
955 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
957 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
959 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
961 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
962 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
963 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
967 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
968 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
969 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
970 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
972 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
973 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
975 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
978 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
979 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
981 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
983 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
984 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
988 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
989 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
991 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
993 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
995 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
996 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
997 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
998 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
999 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1001 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1002 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1003 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1007 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1008 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1009 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1010 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1012 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1013 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1014 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1018 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1019 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1020 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1021 8469d821 2022-06-25 stsp echo "commit - $head_rev" >> $testroot/stdout.expected
1022 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1023 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1024 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1025 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1026 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1027 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1028 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1029 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1030 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1032 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1033 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1035 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1036 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1038 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1041 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1042 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1044 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1046 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1047 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1051 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1052 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1054 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1056 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1058 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1059 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1060 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1061 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1062 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1064 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1065 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1066 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1070 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1071 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1072 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1073 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1074 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1075 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1077 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1078 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1079 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1082 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1084 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1085 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1086 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1090 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1091 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1092 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1096 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1099 f6cae3ed 2020-09-13 naddy test_update_partial() {
1100 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1102 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1104 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1105 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1109 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1110 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1111 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1112 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1114 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1115 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1116 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1117 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1118 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1120 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1122 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1124 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1125 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1126 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1130 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1131 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1133 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1134 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1136 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1137 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1138 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1142 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1143 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1144 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1145 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1147 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1149 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1151 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1152 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1153 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1157 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1158 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1160 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1162 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1163 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1164 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1168 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1171 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1172 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1174 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1176 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1177 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1181 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1182 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1183 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1184 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1186 10a623df 2021-10-11 stsp echo "A epsilon/new2" > $testroot/stdout.expected
1187 10a623df 2021-10-11 stsp echo "A new" >> $testroot/stdout.expected
1188 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1189 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1190 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1192 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1194 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1196 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1197 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1198 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1202 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1203 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1205 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1207 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1209 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1210 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1212 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1215 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1216 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1218 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1220 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1221 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1225 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1226 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1228 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1229 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1231 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1233 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1234 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1235 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1239 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1241 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1242 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1243 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1246 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1249 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1250 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1252 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1254 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1255 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1259 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1260 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1261 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1262 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1264 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1265 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1266 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1267 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1269 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1271 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1273 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1274 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1275 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1279 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1280 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1282 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1284 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1285 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1286 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1289 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1293 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1294 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1296 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1298 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1299 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1301 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1303 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1304 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1308 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1309 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1311 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1312 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1314 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1315 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1316 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1317 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1318 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1320 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1322 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1324 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1325 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1326 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1330 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1332 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1333 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1335 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1338 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1339 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1340 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1342 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1344 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1345 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1349 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1350 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1352 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1353 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1354 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1358 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1359 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1360 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1362 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1364 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1365 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1366 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/newbranch: " >> $testroot/stdout.expected
1367 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1368 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1369 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1371 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1373 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1375 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1376 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1377 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1381 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1382 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1383 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1384 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1385 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1386 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1387 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1388 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1389 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1390 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1392 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1394 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1396 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1397 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1398 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1402 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1403 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1405 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1406 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1407 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1411 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1414 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1415 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1417 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1419 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1420 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1424 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1425 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1426 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1428 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1429 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1430 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1432 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1433 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1434 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1436 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1438 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1439 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1440 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1444 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1446 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1447 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1448 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1452 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1455 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1456 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1458 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1459 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1460 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1462 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1464 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1465 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1469 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1470 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1472 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1473 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1474 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1475 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1477 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1478 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1479 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1483 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1484 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1485 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1487 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1488 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1489 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1491 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1492 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1493 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1495 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1496 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1497 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1501 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1503 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1504 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1505 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1506 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1507 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1508 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1510 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1512 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1513 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1514 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1518 9bead371 2019-07-28 stsp # resolve conflict
1519 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1521 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1523 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1524 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1525 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1526 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1528 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1529 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1530 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1534 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1537 f6cae3ed 2020-09-13 naddy test_update_tag() {
1538 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1539 303e2782 2019-08-09 stsp local tag="1.0.0"
1541 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1543 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1544 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1548 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1549 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1550 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1552 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1553 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1554 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1555 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1557 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1559 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1561 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1562 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1563 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1567 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1568 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1570 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1572 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1573 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1575 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1578 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1579 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1581 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1582 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1583 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1584 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1585 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1587 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1589 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1590 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1594 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1596 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1597 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1598 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1599 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1603 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1604 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1605 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1607 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1608 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1609 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1610 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1612 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1614 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1615 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1619 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1620 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
1621 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1623 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1624 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1625 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1630 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1632 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1633 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1634 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1635 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1639 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1641 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1642 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1646 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1647 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
1648 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
1649 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1651 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1652 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1653 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1657 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1659 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1660 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1661 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1663 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1666 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1667 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1668 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1670 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1671 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1672 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1674 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1676 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1677 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1681 5036ab18 2020-04-18 stsp # fake a merge conflict
1682 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1683 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1684 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1685 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1686 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1687 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1689 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1690 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1691 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1693 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1694 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1695 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1699 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1700 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1701 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1702 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1703 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1704 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1705 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1707 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1709 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1710 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1711 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1715 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1717 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1718 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1720 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1723 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1724 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1726 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1728 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1729 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1730 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1732 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1734 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1735 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1737 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1738 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1739 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1740 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1742 e7303626 2020-05-14 stsp # This update only records the new base commit. Otherwise it is a
1743 e7303626 2020-05-14 stsp # no-op change because Got's file index does not track submodules.
1744 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " > $testroot/stdout.expected
1745 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1746 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1748 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1750 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1752 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1753 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1755 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1758 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1759 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1761 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1763 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1765 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1766 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1768 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1769 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1770 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1772 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1773 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1774 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1775 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1777 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1779 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1781 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1782 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1784 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1787 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1788 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1790 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1792 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1794 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1795 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1796 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1797 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1799 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1800 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1801 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1805 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1806 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1807 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1809 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1810 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1811 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1813 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1814 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1815 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1816 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1817 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1818 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1820 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1822 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1824 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1825 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1826 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1830 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1832 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1833 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1835 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1836 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1838 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1841 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1842 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1844 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1846 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1847 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1848 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1852 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1853 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1854 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1855 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1856 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1857 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
1858 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1860 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
1861 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
1862 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
1863 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
1864 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
1865 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1866 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1867 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
1869 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1871 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1873 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1874 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1875 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1879 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1880 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
1881 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1885 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1886 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1887 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1889 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1890 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1891 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1895 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1896 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
1897 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1901 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1902 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1903 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1905 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1906 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1907 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1911 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1912 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
1913 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
1914 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1918 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1919 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1921 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1923 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1924 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1925 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1929 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1930 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
1931 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1933 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1934 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1935 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1939 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1940 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1941 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1943 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1944 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1945 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
1949 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
1950 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
1951 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
1952 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1954 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1955 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1957 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1960 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
1961 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
1963 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1964 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
1965 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
1967 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1969 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1970 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1971 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1975 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
1976 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
1978 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
1979 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1980 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1981 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
1983 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1985 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1987 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1988 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1989 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1993 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
1994 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
1995 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
1999 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2002 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
2003 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
2005 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2006 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2007 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2008 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2009 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2010 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2011 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2012 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2013 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2015 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2017 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2018 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2019 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2023 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2024 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sfh gamma epsilon.link)
2025 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2026 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2027 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2028 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2029 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2030 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2031 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2032 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2033 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2035 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2036 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2037 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2038 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sfh beta epsilon.link)
2039 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2040 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link)
2041 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2042 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2043 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2044 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2045 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2046 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2047 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2048 993e2a1b 2020-07-23 stsp # to nonexistent file B
2049 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2050 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2051 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2052 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2053 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2054 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2056 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2058 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2059 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2060 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2061 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2062 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2063 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2064 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2065 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2066 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2067 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2068 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2069 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2071 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2073 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2074 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2075 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2079 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2080 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2081 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2085 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2086 283102fc 2020-07-23 stsp > $testroot/content.expected
2087 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2088 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2089 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2090 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2091 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2092 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2093 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2094 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2096 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2097 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2099 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2100 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2101 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2105 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2106 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2107 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2111 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2112 283102fc 2020-07-23 stsp > $testroot/content.expected
2113 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2114 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2115 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2116 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2117 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2118 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2119 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2120 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2122 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2123 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2125 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2126 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2127 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2131 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2132 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2133 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2134 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2138 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2139 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2141 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2143 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2144 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2145 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2149 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2150 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2151 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2155 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2156 283102fc 2020-07-23 stsp > $testroot/content.expected
2157 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2158 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2159 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2160 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2161 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2162 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2163 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2164 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2166 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2167 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2169 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2170 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2171 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2175 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2176 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2177 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2178 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2182 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2183 283102fc 2020-07-23 stsp > $testroot/content.expected
2184 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2185 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2186 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2187 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2188 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2190 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2191 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2193 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2194 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2195 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2199 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2200 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2201 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2205 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2206 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2207 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2208 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2209 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2210 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2211 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2213 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2214 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2216 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2217 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2218 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2222 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2223 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2224 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2227 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2228 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2229 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2230 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2231 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2232 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2233 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2235 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2236 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2238 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2239 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2240 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2244 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2245 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2246 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2250 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2251 283102fc 2020-07-23 stsp > $testroot/content.expected
2252 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2253 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2254 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2255 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2256 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2258 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2259 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2261 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2262 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2263 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2267 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2268 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2269 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2270 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2272 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2273 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2274 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2278 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2282 194cb7cb 2021-01-19 stsp test_update_single_file() {
2283 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2285 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2286 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2287 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2288 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2290 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2291 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2292 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2293 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2294 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2295 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2297 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2298 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2299 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2301 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2303 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2304 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2308 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2309 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2310 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2312 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2313 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2315 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2317 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2318 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2319 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2323 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2324 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2326 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2328 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2329 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2330 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2334 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2335 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
2336 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2338 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2340 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2342 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2343 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2344 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2348 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2349 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2351 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2353 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2354 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2355 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2359 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2360 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2361 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2363 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2364 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2366 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2367 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2369 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2370 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2371 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2375 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2376 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2378 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2379 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2380 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2384 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2385 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2386 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2388 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2389 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2391 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2392 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2393 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2397 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2398 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2399 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2403 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2407 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2408 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2409 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2410 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2412 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2413 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2414 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2415 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2417 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2419 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2420 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2424 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2425 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2426 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2427 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2428 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2432 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2433 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2434 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2435 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2436 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2440 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2442 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2444 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2445 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id0" \
2446 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2447 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2448 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2450 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2451 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2452 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2456 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2457 a769b60b 2021-06-27 stsp > $testroot/content.expected
2458 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2459 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2460 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2461 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2462 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2463 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2464 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2466 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2468 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2470 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2471 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2472 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2476 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2477 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2478 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2479 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2480 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2484 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2485 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2486 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2487 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2488 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2492 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2493 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2494 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2495 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2496 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2497 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2498 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2499 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2501 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2502 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2503 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2507 a769b60b 2021-06-27 stsp # blob ID of beta should not have changed
2508 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2509 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2510 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2511 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2512 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2516 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2517 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2518 a769b60b 2021-06-27 stsp # file was not updated.
2519 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2520 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2521 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2522 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2523 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2527 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2528 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2529 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2530 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2532 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2533 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2534 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2538 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2539 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2541 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2542 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2543 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2544 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2546 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2547 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2548 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2552 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2553 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2554 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2555 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2556 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2557 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2559 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2560 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2561 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2565 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2566 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2567 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2568 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2569 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2573 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2574 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2575 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2576 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2577 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2581 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2582 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2583 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2585 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2586 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2588 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2591 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2592 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2593 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2594 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2596 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2597 f6764181 2021-09-24 stsp echo "new file" > $testroot/repo/new
2598 f6764181 2021-09-24 stsp (cd $testroot/repo && git add new)
2599 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2600 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2601 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2603 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2605 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2606 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2610 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2611 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2612 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2613 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2614 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2618 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2619 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2620 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2621 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2622 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2626 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2627 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2628 f6764181 2021-09-24 stsp mkdir -p $testroot/wt/new
2630 f6764181 2021-09-24 stsp # update to the latest commit; this skips beta and the new file
2631 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2633 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2634 f6764181 2021-09-24 stsp echo "update failed unexpectedly" >&2
2635 f6764181 2021-09-24 stsp test_done "$testroot" "1"
2639 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2640 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2641 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2642 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2643 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 2" \
2644 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2645 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2647 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2648 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2649 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2653 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2654 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2655 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2656 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2657 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2661 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2662 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2663 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2664 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2665 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2669 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2670 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2672 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2673 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2674 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2675 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2676 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2677 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2678 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 1" \
2679 f6764181 2021-09-24 stsp >> $testroot/stdout.expected
2680 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2682 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2683 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2684 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2688 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2689 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2690 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2691 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2692 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2696 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2697 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2698 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2699 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2700 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2704 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2705 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2706 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2708 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2709 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2711 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2714 67c65ed7 2021-09-14 tracey test_update_quiet() {
2715 67c65ed7 2021-09-14 tracey local testroot=`test_init update_quiet`
2717 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
2719 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2720 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2721 67c65ed7 2021-09-14 tracey return 1
2724 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/repo/alpha
2725 67c65ed7 2021-09-14 tracey git_commit $testroot/repo -m "modified alpha"
2727 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2728 67c65ed7 2021-09-14 tracey git_show_head $testroot/repo >> $testroot/stdout.expected
2729 67c65ed7 2021-09-14 tracey echo >> $testroot/stdout.expected
2731 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got update -q > $testroot/stdout)
2733 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
2735 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2736 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
2737 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2738 67c65ed7 2021-09-14 tracey return 1
2741 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/content.expected
2742 67c65ed7 2021-09-14 tracey cat $testroot/wt/alpha > $testroot/content
2744 67c65ed7 2021-09-14 tracey cmp -s $testroot/content.expected $testroot/content
2746 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2747 67c65ed7 2021-09-14 tracey diff -u $testroot/content.expected $testroot/content
2749 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2752 0e039681 2021-11-15 stsp test_update_binary_file() {
2753 0e039681 2021-11-15 stsp local testroot=`test_init update_binary_file`
2754 0e039681 2021-11-15 stsp local commit_id0=`git_show_head $testroot/repo`
2756 0e039681 2021-11-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2758 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2759 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2763 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
2764 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2765 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo >/dev/null)
2766 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
2767 0e039681 2021-11-15 stsp local commit_id1=`git_show_head $testroot/repo`
2769 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2770 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2771 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2772 0e039681 2021-11-15 stsp local commit_id2=`git_show_head $testroot/repo`
2774 0e039681 2021-11-15 stsp cp /bin/cp $testroot/wt/foo
2775 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2776 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2777 0e039681 2021-11-15 stsp local commit_id3=`git_show_head $testroot/repo`
2779 0e039681 2021-11-15 stsp (cd $testroot/wt && got rm foo >/dev/null)
2780 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'remove binary file' > /dev/null)
2781 0e039681 2021-11-15 stsp local commit_id4=`git_show_head $testroot/repo`
2783 0e039681 2021-11-15 stsp # backdate the work tree to make it usable for updating
2784 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2786 0e039681 2021-11-15 stsp # update which adds a binary file
2787 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2789 0e039681 2021-11-15 stsp echo "A foo" > $testroot/stdout.expected
2790 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id1" \
2791 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2792 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2793 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2795 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2796 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2797 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2801 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2802 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2803 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2805 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2807 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2808 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2809 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2813 0e039681 2021-11-15 stsp # update which adds a conflicting binary file
2814 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2815 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2816 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2817 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo > /dev/null)
2818 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2820 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
2821 0e039681 2021-11-15 stsp echo "Updated to refs/heads/master: $commit_id1" \
2822 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2823 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2824 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2826 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2827 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2828 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2832 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
2833 0e039681 2021-11-15 stsp > $testroot/content.expected
2834 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id1" \
2835 0e039681 2021-11-15 stsp >> $testroot/content.expected
2836 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2837 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
2838 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
2839 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2840 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
2841 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
2842 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2844 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2846 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2847 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2848 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2852 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2853 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2854 0e039681 2021-11-15 stsp cat $testroot/wt/foo-1-* > $testroot/content
2856 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2858 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2859 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2860 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2864 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
2865 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2866 0e039681 2021-11-15 stsp cat $testroot/wt/foo-2-* > $testroot/content
2868 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2870 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2871 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2872 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2877 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . >/dev/null)
2878 0e039681 2021-11-15 stsp rm $testroot/wt/foo-1-* $testroot/wt/foo-2-*
2879 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > /dev/null)
2881 0e039681 2021-11-15 stsp # update which changes a binary file
2882 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id2 > $testroot/stdout)
2884 0e039681 2021-11-15 stsp echo "U foo" > $testroot/stdout.expected
2885 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id2" \
2886 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2887 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2888 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2890 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2891 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2892 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2896 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
2897 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2898 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2900 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2902 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2903 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2904 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2908 0e039681 2021-11-15 stsp # update which changes a locally modified binary file
2909 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
2910 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2911 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id3 > $testroot/stdout)
2913 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
2914 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id3" \
2915 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2916 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2917 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2918 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2920 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2921 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2922 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2926 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
2927 0e039681 2021-11-15 stsp > $testroot/content.expected
2928 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id3" \
2929 0e039681 2021-11-15 stsp >> $testroot/content.expected
2930 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2931 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
2932 0e039681 2021-11-15 stsp echo "||||||| 3-way merge base: commit $commit_id2" \
2933 0e039681 2021-11-15 stsp >> $testroot/content.expected
2934 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2935 0e039681 2021-11-15 stsp ls $testroot/wt/foo-orig-* >> $testroot/content.expected
2936 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
2937 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2938 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
2939 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
2940 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2942 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2944 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2945 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2946 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2950 0e039681 2021-11-15 stsp cp /bin/cp $testroot/content.expected
2951 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2952 0e039681 2021-11-15 stsp cp $testroot/wt/foo-1-* $testroot/content
2953 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2955 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2956 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2957 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2961 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2962 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2963 0e039681 2021-11-15 stsp cp $testroot/wt/foo-2-* $testroot/content
2964 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2966 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2967 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2968 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2972 0e039681 2021-11-15 stsp (cd $testroot/wt && got status > $testroot/stdout)
2973 0e039681 2021-11-15 stsp echo 'C foo' > $testroot/stdout.expected
2974 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
2975 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-1-* >> $testroot/stdout.expected)
2976 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
2977 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
2978 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
2979 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
2980 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2982 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2983 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2984 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2989 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . > /dev/null)
2990 0e039681 2021-11-15 stsp rm $testroot/wt/foo-orig-* $testroot/wt/foo-1-* $testroot/wt/foo-2-*
2992 0e039681 2021-11-15 stsp # update which deletes a binary file
2993 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id4 > $testroot/stdout)
2994 0e039681 2021-11-15 stsp echo "D foo" > $testroot/stdout.expected
2995 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id4" \
2996 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2997 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2998 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3000 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3001 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3002 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3005 0e039681 2021-11-15 stsp if [ -e $testroot/wt/foo ]; then
3006 0e039681 2021-11-15 stsp echo "removed file foo still exists on disk" >&2
3007 0e039681 2021-11-15 stsp test_done "$testroot" "1"
3010 0e039681 2021-11-15 stsp test_done "$testroot" "0"
3013 b2b3fce1 2022-10-29 op test_update_umask() {
3014 b2b3fce1 2022-10-29 op local testroot=`test_init update_binary_file`
3016 b2b3fce1 2022-10-29 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
3018 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3019 b2b3fce1 2022-10-29 op test_done "$testroot" "$ret"
3023 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3025 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3026 b2b3fce1 2022-10-29 op (umask 022 && cd "$testroot/wt" && got update alpha) \
3027 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3029 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3030 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3034 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-r--r--; then
3035 b2b3fce1 2022-10-29 op echo "alpha is not 0644" >&2
3036 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3040 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3042 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3043 b2b3fce1 2022-10-29 op (umask 044 && cd "$testroot/wt" && got update alpha) \
3044 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3046 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3047 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3051 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
3052 b2b3fce1 2022-10-29 op echo "alpha is not 0600" >&2
3053 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3057 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3059 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3060 b2b3fce1 2022-10-29 op (umask 222 && cd "$testroot/wt" && got update alpha) \
3061 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3063 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3064 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3068 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-r--r--r--; then
3069 b2b3fce1 2022-10-29 op echo "alpha is not 0444" >&2
3070 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3074 b2b3fce1 2022-10-29 op test_done "$testroot" 0
3077 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3078 c84d8c75 2019-01-02 stsp run_test test_update_basic
3079 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
3080 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
3081 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
3082 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
3083 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
3084 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
3085 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
3086 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
3087 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
3088 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
3089 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
3090 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
3091 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
3092 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
3093 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
3094 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
3095 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
3096 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
3097 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
3098 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
3099 c4cdcb68 2019-04-03 stsp run_test test_update_partial
3100 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
3101 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
3102 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
3103 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
3104 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
3105 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
3106 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
3107 303e2782 2019-08-09 stsp run_test test_update_tag
3108 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
3109 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
3110 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
3111 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
3112 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
3113 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
3114 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
3115 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
3116 194cb7cb 2021-01-19 stsp run_test test_update_single_file
3117 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
3118 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction
3119 67c65ed7 2021-09-14 tracey run_test test_update_quiet
3120 0e039681 2021-11-15 stsp run_test test_update_binary_file
3121 b2b3fce1 2022-10-29 op run_test test_update_umask