3 c84d8c75 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 c84d8c75 2019-01-02 stsp # Permission to use, copy, modify, and distribute this software for any
6 c84d8c75 2019-01-02 stsp # purpose with or without fee is hereby granted, provided that the above
7 c84d8c75 2019-01-02 stsp # copyright notice and this permission notice appear in all copies.
9 c84d8c75 2019-01-02 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c84d8c75 2019-01-02 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c84d8c75 2019-01-02 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c84d8c75 2019-01-02 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c84d8c75 2019-01-02 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c84d8c75 2019-01-02 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c84d8c75 2019-01-02 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c84d8c75 2019-01-02 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_update_basic() {
20 0fbd721f 2019-01-02 stsp local testroot=`test_init update_basic`
22 3c90ba67 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
25 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
29 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/repo/alpha
30 c84d8c75 2019-01-02 stsp git_commit $testroot/repo -m "modified alpha"
32 c84d8c75 2019-01-02 stsp echo "U alpha" > $testroot/stdout.expected
33 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
34 9c4b8182 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
35 9c4b8182 2019-01-02 stsp echo >> $testroot/stdout.expected
37 c84d8c75 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
39 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
41 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
42 c84d8c75 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
43 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
47 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/content.expected
48 52a3df9b 2019-01-06 stsp cat $testroot/wt/alpha > $testroot/content
50 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
52 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
53 c84d8c75 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
55 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
58 f6cae3ed 2020-09-13 naddy test_update_adds_file() {
59 3b4d3732 2019-01-02 stsp local testroot=`test_init update_adds_file`
61 3b4d3732 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
63 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
64 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
68 3b4d3732 2019-01-02 stsp echo "new" > $testroot/repo/gamma/new
69 3b4d3732 2019-01-02 stsp (cd $testroot/repo && git add .)
70 3b4d3732 2019-01-02 stsp git_commit $testroot/repo -m "adding a new file"
72 3b4d3732 2019-01-02 stsp echo "A gamma/new" > $testroot/stdout.expected
73 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
74 3b4d3732 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
75 3b4d3732 2019-01-02 stsp echo >> $testroot/stdout.expected
77 3b4d3732 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
79 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
81 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
82 3b4d3732 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
87 3b4d3732 2019-01-02 stsp echo "new" >> $testroot/content.expected
88 52a3df9b 2019-01-06 stsp cat $testroot/wt/gamma/new > $testroot/content
90 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
92 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
93 3b4d3732 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
95 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
98 f6cae3ed 2020-09-13 naddy test_update_deletes_file() {
99 512f0d0e 2019-01-02 stsp local testroot=`test_init update_deletes_file`
101 1c4cdd89 2021-06-20 stsp mkdir $testroot/wtparent
102 1c4cdd89 2021-06-20 stsp got checkout $testroot/repo $testroot/wtparent/wt > /dev/null
104 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
105 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
109 97631c52 2023-02-24 thomas git_rm $testroot/repo beta
110 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
112 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
113 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
114 512f0d0e 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
115 512f0d0e 2019-01-02 stsp echo >> $testroot/stdout.expected
117 1c4cdd89 2021-06-20 stsp # verify that no error occurs if the work tree's parent
118 1c4cdd89 2021-06-20 stsp # directory is not writable
119 1c4cdd89 2021-06-20 stsp chmod u-w $testroot/wtparent
120 1c4cdd89 2021-06-20 stsp (cd $testroot/wtparent/wt && got update > $testroot/stdout)
121 1c4cdd89 2021-06-20 stsp chmod u+w $testroot/wtparent
123 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
125 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
126 512f0d0e 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
127 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
131 1c4cdd89 2021-06-20 stsp if [ -e $testroot/wtparent/wt/beta ]; then
132 512f0d0e 2019-01-02 stsp echo "removed file beta still exists on disk" >&2
133 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
137 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
140 f6cae3ed 2020-09-13 naddy test_update_deletes_dir() {
141 f5c49f82 2019-01-06 stsp local testroot=`test_init update_deletes_dir`
143 f5c49f82 2019-01-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
145 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
146 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
150 97631c52 2023-02-24 thomas git_rm $testroot/repo -r epsilon
151 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
153 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
154 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
155 f5c49f82 2019-01-06 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
156 f5c49f82 2019-01-06 stsp echo >> $testroot/stdout.expected
158 f5c49f82 2019-01-06 stsp (cd $testroot/wt && got update > $testroot/stdout)
160 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
162 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
163 f5c49f82 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
164 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
168 f5c49f82 2019-01-06 stsp if [ -e $testroot/wt/epsilon ]; then
169 f5c49f82 2019-01-06 stsp echo "removed dir epsilon still exists on disk" >&2
170 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
174 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
177 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_with_path_prefix() {
178 5cc266ba 2019-01-06 stsp local testroot=`test_init update_deletes_dir_with_path_prefix`
179 5cc266ba 2019-01-06 stsp local first_rev=`git_show_head $testroot/repo`
181 5cc266ba 2019-01-06 stsp mkdir $testroot/repo/epsilon/psi
182 5cc266ba 2019-01-06 stsp echo mu > $testroot/repo/epsilon/psi/mu
183 5cc266ba 2019-01-06 stsp (cd $testroot/repo && git add .)
184 5cc266ba 2019-01-06 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
186 5cc266ba 2019-01-06 stsp # check out the epsilon/ sub-tree
187 5cc266ba 2019-01-06 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
189 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
190 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
194 5cc266ba 2019-01-06 stsp # update back to first commit and expect psi/mu to be deleted
195 5cc266ba 2019-01-06 stsp echo "D psi/mu" > $testroot/stdout.expected
196 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
197 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
199 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
201 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
203 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
204 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
205 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
209 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
210 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
211 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
215 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
218 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_recursively() {
219 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
220 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
222 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
223 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
224 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
225 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
226 90285c3b 2019-01-08 stsp (cd $testroot/repo && git add .)
227 90285c3b 2019-01-08 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
229 90285c3b 2019-01-08 stsp # check out the epsilon/ sub-tree
230 90285c3b 2019-01-08 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
232 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
233 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
237 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
238 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
239 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
240 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
241 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
243 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
245 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
247 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
248 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
249 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
253 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
254 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
255 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
259 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
262 f6cae3ed 2020-09-13 naddy test_update_sibling_dirs_with_common_prefix() {
263 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
265 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
267 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
268 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
272 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
273 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
274 81a30460 2019-01-08 stsp (cd $testroot/repo && git add epsilon2/mu)
275 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
276 81a30460 2019-01-08 stsp echo change > $testroot/repo/epsilon/zeta
277 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
279 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
280 81a30460 2019-01-08 stsp echo "A epsilon2/mu" >> $testroot/stdout.expected
281 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
282 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
283 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
285 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
287 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
289 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
290 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
291 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
295 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
296 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
298 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
299 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
300 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
301 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
303 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
304 81a30460 2019-01-08 stsp # U epsilon/zeta
305 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
306 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
307 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
309 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
311 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
312 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
313 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
317 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
319 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
320 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
322 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
325 f6cae3ed 2020-09-13 naddy test_update_dir_with_dot_sibling() {
326 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
328 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
330 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
331 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
335 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
336 50952927 2019-01-12 stsp (cd $testroot/repo && git add epsilon.txt)
337 50952927 2019-01-12 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
338 50952927 2019-01-12 stsp echo change > $testroot/repo/epsilon/zeta
339 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
341 f5d3d7af 2019-02-05 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
342 f5d3d7af 2019-02-05 stsp echo "A epsilon.txt" >> $testroot/stdout.expected
343 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
344 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
345 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
347 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
349 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
351 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
352 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
353 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
357 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
358 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
360 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
361 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
362 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
363 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
365 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
367 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
369 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
370 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
371 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
375 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
377 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
378 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
380 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
383 f6cae3ed 2020-09-13 naddy test_update_moves_files_upwards() {
384 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
386 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
387 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
388 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
389 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
390 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
391 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
393 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
395 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
396 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
400 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu)
401 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon/psi/tau)
402 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
404 21908da4 2019-01-13 stsp echo "A epsilon/mu" > $testroot/stdout.expected
405 21908da4 2019-01-13 stsp echo "D epsilon/psi/chi/tau" >> $testroot/stdout.expected
406 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
407 bd4792ec 2019-01-13 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
408 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
409 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
410 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
412 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
414 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
416 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
417 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
418 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
422 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
423 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
424 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
428 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
429 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
430 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
434 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
437 f6cae3ed 2020-09-13 naddy test_update_moves_files_to_new_dir() {
438 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
440 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
441 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
442 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
443 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
444 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
445 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
447 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
449 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
450 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
454 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
455 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu)
456 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon-new/psi/tau)
457 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
459 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected
460 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
461 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
462 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
463 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
464 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
465 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
467 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
469 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
471 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
472 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
473 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
477 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
478 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
479 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
483 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
484 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
485 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
489 4a1ddfc2 2019-01-12 stsp test_done "$testroot" "0"
492 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent() {
493 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent 1`
495 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/Makefile
496 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.6
497 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.c
498 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
499 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "adding initial snake tree"
501 4a1ddfc2 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
503 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
504 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
508 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
509 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c snake)
510 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/move.c
511 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/pathnames.h
512 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/snake.h
513 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snscore
514 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/Makefile
515 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/snscore.c
516 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
517 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "restructuring snake tree"
519 4a1ddfc2 2019-01-12 stsp echo "D Makefile" > $testroot/stdout.expected
520 4a1ddfc2 2019-01-12 stsp echo "A snake/Makefile" >> $testroot/stdout.expected
521 4a1ddfc2 2019-01-12 stsp echo "A snake/move.c" >> $testroot/stdout.expected
522 4a1ddfc2 2019-01-12 stsp echo "A snake/pathnames.h" >> $testroot/stdout.expected
523 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.6" >> $testroot/stdout.expected
524 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.c" >> $testroot/stdout.expected
525 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.h" >> $testroot/stdout.expected
526 18831e78 2019-02-10 stsp echo "D snake.6" >> $testroot/stdout.expected
527 18831e78 2019-02-10 stsp echo "D snake.c" >> $testroot/stdout.expected
528 bd4792ec 2019-01-13 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
529 bd4792ec 2019-01-13 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
530 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
531 bd4792ec 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
532 bd4792ec 2019-01-13 stsp echo >> $testroot/stdout.expected
534 bd4792ec 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
536 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
538 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
539 e60e7f5b 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
541 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
544 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent_with_subdir() {
545 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent_with_subdir 1`
547 bd4792ec 2019-01-13 stsp touch $testroot/repo/Makefile
548 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.6
549 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.c
550 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
551 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "adding initial snake tree"
553 bd4792ec 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
555 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
556 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
560 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
561 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c sss/snake)
562 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/move.c
563 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/pathnames.h
564 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/snake.h
565 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/snscore
566 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/Makefile
567 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/snscore.c
568 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
569 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "restructuring snake tree"
571 bd4792ec 2019-01-13 stsp echo "D Makefile" > $testroot/stdout.expected
572 4a1ddfc2 2019-01-12 stsp echo "D snake.6" >> $testroot/stdout.expected
573 4a1ddfc2 2019-01-12 stsp echo "D snake.c" >> $testroot/stdout.expected
574 4a1ddfc2 2019-01-12 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
575 4a1ddfc2 2019-01-12 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
576 bd4792ec 2019-01-13 stsp echo "A sss/snake/Makefile" >> $testroot/stdout.expected
577 bd4792ec 2019-01-13 stsp echo "A sss/snake/move.c" >> $testroot/stdout.expected
578 bd4792ec 2019-01-13 stsp echo "A sss/snake/pathnames.h" >> $testroot/stdout.expected
579 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.6" >> $testroot/stdout.expected
580 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.c" >> $testroot/stdout.expected
581 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.h" >> $testroot/stdout.expected
582 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
583 4a1ddfc2 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
584 4a1ddfc2 2019-01-12 stsp echo >> $testroot/stdout.expected
586 4a1ddfc2 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
588 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
590 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
591 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
592 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
596 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
599 f6cae3ed 2020-09-13 naddy test_update_file_in_subsubdir() {
600 1aad446a 2019-01-13 stsp local testroot=`test_init update_fle_in_subsubdir 1`
602 21908da4 2019-01-13 stsp touch $testroot/repo/Makefile
603 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/altq
604 21908da4 2019-01-13 stsp touch $testroot/repo/altq/if_altq.h
605 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/arch/alpha
606 21908da4 2019-01-13 stsp touch $testroot/repo/arch/alpha/Makefile
607 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
608 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "adding initial tree"
610 21908da4 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
612 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
613 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
617 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
618 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
619 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "changed a file"
621 21908da4 2019-01-13 stsp echo "U arch/alpha/Makefile" > $testroot/stdout.expected
622 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
623 21908da4 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
624 21908da4 2019-01-13 stsp echo >> $testroot/stdout.expected
626 21908da4 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
628 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
630 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
631 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
632 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
636 21908da4 2019-01-13 stsp test_done "$testroot" "0"
639 7b074ee1 2023-03-01 thomas test_update_changes_file_to_dir() {
640 7b074ee1 2023-03-01 thomas local testroot=`test_init update_changes_file_to_dir`
642 7b074ee1 2023-03-01 thomas got checkout $testroot/repo $testroot/wt > /dev/null
644 7b074ee1 2023-03-01 thomas if [ $ret -ne 0 ]; then
645 7b074ee1 2023-03-01 thomas test_done "$testroot" "$ret"
649 7b074ee1 2023-03-01 thomas git_rm $testroot/repo alpha
650 7b074ee1 2023-03-01 thomas mkdir $testroot/repo/alpha
651 7b074ee1 2023-03-01 thomas echo eta > $testroot/repo/alpha/eta
652 7b074ee1 2023-03-01 thomas (cd $testroot/repo && git add alpha/eta)
653 7b074ee1 2023-03-01 thomas git_commit $testroot/repo -m "changed alpha into directory"
655 7b074ee1 2023-03-01 thomas (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
657 7b074ee1 2023-03-01 thomas if [ $ret -ne 0 ]; then
658 7b074ee1 2023-03-01 thomas ret="xfail change file into directory"
660 7b074ee1 2023-03-01 thomas test_done "$testroot" "$ret"
663 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
664 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
666 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
667 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
668 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
669 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
670 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
671 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
672 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
673 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
674 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
675 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
676 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
678 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
680 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
681 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
685 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
686 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
687 c206b220 2021-10-09 thomas sed -i '' -e 's/2/22/' $testroot/repo/numbers
688 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
690 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
691 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
692 c206b220 2021-10-09 thomas sed -i '' -e 's/7/77/' $testroot/wt/numbers
694 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
695 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
696 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
697 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
698 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
699 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
700 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
702 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
704 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
706 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
707 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
708 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
712 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
713 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
714 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
715 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
716 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
717 f69721c3 2019-10-21 stsp >> $testroot/content.expected
718 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
719 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
720 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
721 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
722 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
723 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
724 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
725 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
726 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
727 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
728 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
729 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
730 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
732 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
733 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
734 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
736 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
738 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
739 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
741 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
744 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
745 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
747 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
748 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
749 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
750 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
752 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
754 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
755 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
759 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
760 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
762 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
763 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
764 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
765 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
767 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
769 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
770 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
774 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
776 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
777 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
778 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
782 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
784 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
785 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
786 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
788 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
791 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
792 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
794 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
795 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
796 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
797 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
799 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
801 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
802 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
806 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
808 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
809 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
810 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
811 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
815 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
816 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
817 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
818 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
820 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
821 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
822 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
823 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
825 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
827 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
828 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
832 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
834 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
835 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
836 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
840 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
842 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
843 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
844 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
846 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
849 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
850 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
852 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
854 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
855 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
859 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
861 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
862 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
863 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
864 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
865 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
867 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
869 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
870 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
871 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
875 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
877 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
879 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
881 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
882 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
884 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
887 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
888 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
890 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
892 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
893 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
897 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
898 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
899 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
901 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
902 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
904 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
906 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
907 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
908 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
909 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
910 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
912 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
914 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
915 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
916 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
920 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
921 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
922 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
923 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
924 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
925 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
926 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
928 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
930 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
932 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
933 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
934 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
938 3165301c 2019-03-27 stsp # resolve the conflict
939 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
940 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
941 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
942 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
944 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
945 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
947 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
950 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
951 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
953 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
955 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
956 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
960 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
961 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
963 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
965 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
967 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
968 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
969 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
970 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
971 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
973 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
974 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
975 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
979 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
981 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
983 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
985 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
986 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
987 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
991 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
992 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
993 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
994 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
996 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
997 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
999 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1002 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
1003 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
1005 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1007 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1008 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1012 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
1013 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
1015 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1017 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1019 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1020 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1021 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1022 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
1023 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1025 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1026 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1027 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1031 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1032 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1033 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1034 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1036 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1037 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1038 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1042 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1043 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1044 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
1045 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
1046 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
1047 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1048 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1049 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1050 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1051 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1052 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1053 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1054 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1056 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1057 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1059 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1060 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1062 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1065 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1066 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1068 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1070 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1071 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1075 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1076 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1078 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1080 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1082 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1083 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1084 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1085 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1086 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1088 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1089 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1090 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1094 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1095 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1096 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1097 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1098 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1099 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1101 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1102 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1103 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1106 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1108 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1109 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1110 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1114 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1115 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1116 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1120 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1123 f6cae3ed 2020-09-13 naddy test_update_partial() {
1124 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1126 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1128 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1129 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1133 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1134 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1135 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1136 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1138 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1139 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1140 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1141 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1142 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1144 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1146 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1148 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1149 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1150 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1154 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1155 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1157 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1158 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1160 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1161 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1162 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1166 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1167 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1168 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1169 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1171 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1173 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1175 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1176 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1177 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1181 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1182 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1184 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1186 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1187 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1188 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1192 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1195 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1196 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1198 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1200 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1201 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1205 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1206 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1207 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1208 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1210 f1417e9f 2021-10-12 thomas echo "A epsilon/new2" > $testroot/stdout.expected
1211 f1417e9f 2021-10-12 thomas echo "A new" >> $testroot/stdout.expected
1212 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1213 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1214 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1216 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1218 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1220 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1221 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1222 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1226 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1227 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1229 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1231 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1233 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1234 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1236 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1239 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1240 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1242 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1244 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1245 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1249 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1250 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1252 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1253 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1255 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1257 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1258 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1259 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1263 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1265 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1266 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1267 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1270 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1273 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1274 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1276 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1278 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1279 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1283 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1284 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1285 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1286 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1288 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1289 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1290 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1291 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1293 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1295 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1297 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1298 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1299 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1303 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1304 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1306 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1308 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1309 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1310 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1313 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1317 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1318 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1320 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1322 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1323 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1325 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1327 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1328 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1332 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1333 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1335 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1336 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1338 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1339 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1340 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1341 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1342 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1344 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1346 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1348 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1349 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1350 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1354 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1356 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1357 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1359 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1362 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1363 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1364 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1366 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1368 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1369 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1373 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1374 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1376 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1377 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1378 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1382 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1383 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1384 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1386 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1388 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1389 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1390 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/newbranch: " >> $testroot/stdout.expected
1391 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1392 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1393 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1395 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1397 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1399 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1400 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1401 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1405 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1406 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1407 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1408 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1409 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1410 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1411 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1412 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1413 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1414 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1416 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1418 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1420 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1421 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1422 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1426 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1427 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1429 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1430 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1431 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1435 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1438 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1439 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1441 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1443 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1444 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1448 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1449 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1450 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1452 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1453 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1454 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1456 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1457 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1458 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1460 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1462 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1463 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1464 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1468 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1470 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1471 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1472 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1476 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1479 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1480 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1482 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1483 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1484 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1486 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1488 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1489 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1493 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1494 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1496 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1497 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1498 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1499 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1501 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1502 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1503 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1507 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1508 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1509 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1511 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1512 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1513 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1515 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1516 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1517 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1519 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1520 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1521 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1525 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1527 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1528 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1529 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1530 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1531 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1532 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1534 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1536 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1537 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1538 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1542 9bead371 2019-07-28 stsp # resolve conflict
1543 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1545 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1547 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1548 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1549 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1550 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1552 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1553 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1554 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1558 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1561 f6cae3ed 2020-09-13 naddy test_update_tag() {
1562 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1563 303e2782 2019-08-09 stsp local tag="1.0.0"
1565 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1567 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1568 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1572 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1573 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1574 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1576 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1577 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1578 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1579 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1581 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1583 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1585 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1586 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1587 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1591 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1592 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1594 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1596 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1597 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1599 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1602 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1603 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1605 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1606 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1607 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1608 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1609 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1611 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1613 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1614 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1618 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1620 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1621 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1622 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1623 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1627 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1628 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1629 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1631 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1632 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1633 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1634 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1636 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1638 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1639 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1643 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1644 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
1645 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1647 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1648 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1649 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1654 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1656 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1657 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1658 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1659 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1663 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1665 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1666 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1670 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1671 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
1672 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
1673 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1675 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1676 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1677 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1681 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1683 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1684 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1685 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1687 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1690 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1691 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1692 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1694 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1695 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1696 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1698 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1700 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1701 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1705 5036ab18 2020-04-18 stsp # fake a merge conflict
1706 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1707 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1708 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1709 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1710 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1711 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1713 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1714 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1715 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1717 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1718 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1719 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1723 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1724 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1725 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1726 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1727 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1728 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1729 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1731 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1733 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1734 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1735 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1739 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1741 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1742 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1744 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1747 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1748 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1750 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1752 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1753 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1754 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1756 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1758 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1759 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1761 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1762 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1763 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1764 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1766 e7303626 2020-05-14 stsp # This update only records the new base commit. Otherwise it is a
1767 e7303626 2020-05-14 stsp # no-op change because Got's file index does not track submodules.
1768 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " > $testroot/stdout.expected
1769 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1770 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1772 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1774 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1776 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1777 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1779 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1782 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1783 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1785 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1787 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1789 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1790 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1792 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1793 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1794 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1796 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1797 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1798 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1799 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1801 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1803 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1805 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1806 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1808 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1811 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1812 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1814 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1816 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1818 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1819 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1820 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1821 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1823 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1824 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1825 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1829 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1830 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1831 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1833 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1834 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1835 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1837 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1838 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1839 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1840 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1841 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1842 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1844 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1846 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1848 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1849 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1850 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1854 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1856 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1857 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1859 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1860 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1862 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1865 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1866 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1868 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1870 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1871 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1872 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1876 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1877 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1878 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1879 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1880 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1881 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
1882 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1884 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
1885 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
1886 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
1887 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
1888 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
1889 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1890 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1891 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
1893 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1895 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1897 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1898 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1899 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1903 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1904 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
1905 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1909 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1910 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1911 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1913 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1914 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1915 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1919 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1920 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
1921 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1925 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1926 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1927 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1929 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1930 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1931 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1935 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1936 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
1937 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
1938 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1942 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1943 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1945 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1947 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1948 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1949 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1953 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1954 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
1955 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1957 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1958 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1959 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1963 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1964 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1965 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1967 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1968 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1969 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
1973 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
1974 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
1975 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
1976 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1978 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1979 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1981 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1984 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
1985 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
1987 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1988 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
1989 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
1991 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1993 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1994 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1995 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1999 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
2000 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
2002 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
2003 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2004 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2005 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2007 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2009 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2011 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2012 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2013 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2017 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
2018 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
2019 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2023 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2026 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
2027 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
2029 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2030 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2031 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2032 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2033 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2034 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2035 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2036 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2037 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2039 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2041 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2042 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2043 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2047 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2048 e6f45b72 2023-03-03 thomas (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link)
2049 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2050 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2051 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2052 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2053 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2054 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2055 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2056 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2057 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2059 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2060 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2061 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2062 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon.link && ln -s beta epsilon.link)
2063 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2064 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon/beta.link && ln -s ../gamma \
2065 e6f45b72 2023-03-03 thomas epsilon/beta.link)
2066 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2067 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2068 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2069 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2070 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2071 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2072 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2073 993e2a1b 2020-07-23 stsp # to nonexistent file B
2074 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2075 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2076 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2077 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2078 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2079 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2081 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2083 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2084 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2085 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2086 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2087 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2088 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2089 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2090 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2091 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2092 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2093 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2094 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2096 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2098 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2099 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2100 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2104 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2105 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2106 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2110 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2111 283102fc 2020-07-23 stsp > $testroot/content.expected
2112 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2113 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2114 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2115 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2116 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2117 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2118 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2119 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2121 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2122 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2124 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2125 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2126 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2130 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2131 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2132 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2136 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2137 283102fc 2020-07-23 stsp > $testroot/content.expected
2138 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2139 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2140 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2141 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2142 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2143 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2144 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2145 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2147 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2148 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2150 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2151 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2152 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2156 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2157 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2158 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2159 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2163 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2164 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2166 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2168 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2169 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2170 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2174 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2175 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2176 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2180 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2181 283102fc 2020-07-23 stsp > $testroot/content.expected
2182 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2183 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2184 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2185 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2186 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2187 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2188 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2189 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2191 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2192 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2194 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2195 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2196 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2200 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2201 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2202 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2203 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2207 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2208 283102fc 2020-07-23 stsp > $testroot/content.expected
2209 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2210 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2211 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2212 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2213 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2215 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2216 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2218 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2219 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2220 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2224 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2225 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2226 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2230 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2231 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2232 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2233 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2234 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2235 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2236 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2238 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2239 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2241 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2242 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2243 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2247 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2248 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2249 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2252 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2253 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2254 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2255 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2256 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2257 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2258 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2260 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2261 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2263 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2264 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2265 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2269 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2270 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2271 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2275 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2276 283102fc 2020-07-23 stsp > $testroot/content.expected
2277 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2278 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2279 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2280 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2281 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2283 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2284 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2286 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2287 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2288 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2292 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2293 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2294 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2295 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2297 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2298 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2299 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2303 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2307 194cb7cb 2021-01-19 stsp test_update_single_file() {
2308 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2310 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2311 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2312 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2313 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2315 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2316 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2317 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2318 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2319 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2320 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2322 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2323 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2324 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2326 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2328 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2329 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2333 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2334 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2335 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2337 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2338 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2340 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2342 fc414659 2022-04-16 thomas 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 c1 > $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 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2354 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2355 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2359 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2360 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
2361 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2363 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2365 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2367 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2368 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2369 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2373 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2374 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2376 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2378 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2379 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
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 c \
2389 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2391 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2392 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2394 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2395 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2396 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2400 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2401 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2403 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2404 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2405 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2409 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2410 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2411 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2413 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2414 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2416 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2417 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2418 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2422 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2423 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2424 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2428 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2432 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2433 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2434 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2435 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2437 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2438 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2439 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2440 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2442 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2444 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2445 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2449 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2450 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2451 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2452 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2453 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2457 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2458 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2459 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2460 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2461 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2465 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2467 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2469 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2470 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id0" \
2471 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2472 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2473 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2475 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2476 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2477 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2481 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2482 a769b60b 2021-06-27 stsp > $testroot/content.expected
2483 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2484 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2485 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2486 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2487 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2488 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2489 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2491 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2493 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2495 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2496 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2497 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2501 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2502 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2503 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2504 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2505 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2509 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2510 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2511 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2512 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2513 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2517 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2518 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2519 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2520 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2521 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2522 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2523 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2524 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2526 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2527 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2528 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2532 a769b60b 2021-06-27 stsp # blob ID of beta should not have changed
2533 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2534 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2535 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2536 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2537 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2541 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2542 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2543 a769b60b 2021-06-27 stsp # file was not updated.
2544 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2545 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2546 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2547 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2548 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2552 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2553 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2554 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2555 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2557 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2558 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2559 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2563 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2564 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2566 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2567 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2568 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2569 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2571 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2572 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2573 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2577 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2578 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2579 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2580 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2581 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2582 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2584 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2585 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2586 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2590 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2591 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2592 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2593 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2594 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2598 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2599 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2600 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2601 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2602 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2606 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2607 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2608 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2610 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2611 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2613 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2616 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2617 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2618 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2619 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2621 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2622 e6f4ba31 2021-09-24 thomas echo "new file" > $testroot/repo/new
2623 e6f4ba31 2021-09-24 thomas (cd $testroot/repo && git add new)
2624 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2625 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2626 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2628 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2630 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2631 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2635 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2636 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2637 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2638 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2639 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2643 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2644 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2645 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2646 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2647 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2651 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2652 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2653 e6f4ba31 2021-09-24 thomas mkdir -p $testroot/wt/new
2655 e6f4ba31 2021-09-24 thomas # update to the latest commit; this skips beta and the new file
2656 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2658 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2659 e6f4ba31 2021-09-24 thomas echo "update failed unexpectedly" >&2
2660 e6f4ba31 2021-09-24 thomas test_done "$testroot" "1"
2661 e6f4ba31 2021-09-24 thomas return 1
2664 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2665 e6f4ba31 2021-09-24 thomas echo "~ new" >> $testroot/stdout.expected
2666 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2667 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2668 e6f4ba31 2021-09-24 thomas echo "File paths obstructed by a non-regular file: 2" \
2669 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2670 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2672 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2673 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2674 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2678 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2679 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2680 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2681 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2682 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2686 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2687 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2688 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2689 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2690 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2694 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2695 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2697 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2698 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2699 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2700 e6f4ba31 2021-09-24 thomas echo "~ new" >> $testroot/stdout.expected
2701 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2702 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2703 e6f4ba31 2021-09-24 thomas echo "File paths obstructed by a non-regular file: 1" \
2704 e6f4ba31 2021-09-24 thomas >> $testroot/stdout.expected
2705 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2707 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2708 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2709 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2713 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2714 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2715 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2716 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2717 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2721 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2722 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2723 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2724 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2725 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2729 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2730 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2731 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2733 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2734 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2736 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2739 67c65ed7 2021-09-14 tracey test_update_quiet() {
2740 67c65ed7 2021-09-14 tracey local testroot=`test_init update_quiet`
2742 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
2744 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2745 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2746 67c65ed7 2021-09-14 tracey return 1
2749 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/repo/alpha
2750 67c65ed7 2021-09-14 tracey git_commit $testroot/repo -m "modified alpha"
2752 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2753 67c65ed7 2021-09-14 tracey git_show_head $testroot/repo >> $testroot/stdout.expected
2754 67c65ed7 2021-09-14 tracey echo >> $testroot/stdout.expected
2756 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got update -q > $testroot/stdout)
2758 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
2760 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2761 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
2762 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2763 67c65ed7 2021-09-14 tracey return 1
2766 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/content.expected
2767 67c65ed7 2021-09-14 tracey cat $testroot/wt/alpha > $testroot/content
2769 67c65ed7 2021-09-14 tracey cmp -s $testroot/content.expected $testroot/content
2771 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2772 67c65ed7 2021-09-14 tracey diff -u $testroot/content.expected $testroot/content
2774 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2777 24f136e0 2021-11-20 thomas test_update_binary_file() {
2778 24f136e0 2021-11-20 thomas local testroot=`test_init update_binary_file`
2779 24f136e0 2021-11-20 thomas local commit_id0=`git_show_head $testroot/repo`
2781 24f136e0 2021-11-20 thomas got checkout $testroot/repo $testroot/wt > /dev/null
2783 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2784 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2785 24f136e0 2021-11-20 thomas return 1
2788 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/wt/foo
2789 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2790 24f136e0 2021-11-20 thomas (cd $testroot/wt && got add foo >/dev/null)
2791 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
2792 24f136e0 2021-11-20 thomas local commit_id1=`git_show_head $testroot/repo`
2794 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/wt/foo
2795 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2796 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2797 24f136e0 2021-11-20 thomas local commit_id2=`git_show_head $testroot/repo`
2799 24f136e0 2021-11-20 thomas cp /bin/cp $testroot/wt/foo
2800 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2801 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2802 24f136e0 2021-11-20 thomas local commit_id3=`git_show_head $testroot/repo`
2804 24f136e0 2021-11-20 thomas (cd $testroot/wt && got rm foo >/dev/null)
2805 24f136e0 2021-11-20 thomas (cd $testroot/wt && got commit -m 'remove binary file' > /dev/null)
2806 24f136e0 2021-11-20 thomas local commit_id4=`git_show_head $testroot/repo`
2808 24f136e0 2021-11-20 thomas # backdate the work tree to make it usable for updating
2809 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2811 24f136e0 2021-11-20 thomas # update which adds a binary file
2812 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2814 24f136e0 2021-11-20 thomas echo "A foo" > $testroot/stdout.expected
2815 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id1" \
2816 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
2817 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
2818 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2820 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2821 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
2822 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2823 24f136e0 2021-11-20 thomas return 1
2826 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/content.expected
2827 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2828 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
2830 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2832 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2833 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2834 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2835 24f136e0 2021-11-20 thomas return 1
2838 24f136e0 2021-11-20 thomas # update which adds a conflicting binary file
2839 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2840 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/wt/foo
2841 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2842 24f136e0 2021-11-20 thomas (cd $testroot/wt && got add foo > /dev/null)
2843 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2845 24f136e0 2021-11-20 thomas echo "C foo" > $testroot/stdout.expected
2846 24f136e0 2021-11-20 thomas echo "Updated to refs/heads/master: $commit_id1" \
2847 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
2848 24f136e0 2021-11-20 thomas echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2849 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2851 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2852 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
2853 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2854 24f136e0 2021-11-20 thomas return 1
2857 24f136e0 2021-11-20 thomas echo "Binary files differ and cannot be merged automatically:" \
2858 24f136e0 2021-11-20 thomas > $testroot/content.expected
2859 24f136e0 2021-11-20 thomas echo "<<<<<<< merged change: commit $commit_id1" \
2860 24f136e0 2021-11-20 thomas >> $testroot/content.expected
2861 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
2862 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-1-* >> $testroot/content.expected
2863 24f136e0 2021-11-20 thomas echo '=======' >> $testroot/content.expected
2864 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
2865 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-2-* >> $testroot/content.expected
2866 24f136e0 2021-11-20 thomas echo ">>>>>>>" >> $testroot/content.expected
2867 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
2869 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2871 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2872 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2873 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2874 24f136e0 2021-11-20 thomas return 1
2877 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/content.expected
2878 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2879 24f136e0 2021-11-20 thomas cat $testroot/wt/foo-1-* > $testroot/content
2881 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2883 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2884 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2885 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2886 24f136e0 2021-11-20 thomas return 1
2889 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/content.expected
2890 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2891 24f136e0 2021-11-20 thomas cat $testroot/wt/foo-2-* > $testroot/content
2893 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2895 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2896 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2897 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2898 24f136e0 2021-11-20 thomas return 1
2901 24f136e0 2021-11-20 thomas # tidy up
2902 24f136e0 2021-11-20 thomas (cd $testroot/wt && got revert -R . >/dev/null)
2903 24f136e0 2021-11-20 thomas rm $testroot/wt/foo-1-* $testroot/wt/foo-2-*
2904 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id1 > /dev/null)
2906 24f136e0 2021-11-20 thomas # update which changes a binary file
2907 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id2 > $testroot/stdout)
2909 24f136e0 2021-11-20 thomas echo "U foo" > $testroot/stdout.expected
2910 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id2" \
2911 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
2912 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
2913 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2915 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2916 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
2917 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2918 24f136e0 2021-11-20 thomas return 1
2921 24f136e0 2021-11-20 thomas cp /bin/cat $testroot/content.expected
2922 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2923 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
2925 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2927 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2928 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2929 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2930 24f136e0 2021-11-20 thomas return 1
2933 24f136e0 2021-11-20 thomas # update which changes a locally modified binary file
2934 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/wt/foo
2935 24f136e0 2021-11-20 thomas chmod 755 $testroot/wt/foo
2936 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id3 > $testroot/stdout)
2938 24f136e0 2021-11-20 thomas echo "C foo" > $testroot/stdout.expected
2939 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id3" \
2940 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
2941 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
2942 24f136e0 2021-11-20 thomas echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2943 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2945 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2946 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
2947 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2948 24f136e0 2021-11-20 thomas return 1
2951 24f136e0 2021-11-20 thomas echo "Binary files differ and cannot be merged automatically:" \
2952 24f136e0 2021-11-20 thomas > $testroot/content.expected
2953 24f136e0 2021-11-20 thomas echo "<<<<<<< merged change: commit $commit_id3" \
2954 24f136e0 2021-11-20 thomas >> $testroot/content.expected
2955 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
2956 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-1-* >> $testroot/content.expected
2957 24f136e0 2021-11-20 thomas echo "||||||| 3-way merge base: commit $commit_id2" \
2958 24f136e0 2021-11-20 thomas >> $testroot/content.expected
2959 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
2960 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-orig-* >> $testroot/content.expected
2961 24f136e0 2021-11-20 thomas echo '=======' >> $testroot/content.expected
2962 24f136e0 2021-11-20 thomas echo -n "file " >> $testroot/content.expected
2963 24f136e0 2021-11-20 thomas ls $testroot/wt/foo-2-* >> $testroot/content.expected
2964 24f136e0 2021-11-20 thomas echo ">>>>>>>" >> $testroot/content.expected
2965 24f136e0 2021-11-20 thomas cat $testroot/wt/foo > $testroot/content
2967 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2969 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2970 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2971 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2972 24f136e0 2021-11-20 thomas return 1
2975 24f136e0 2021-11-20 thomas cp /bin/cp $testroot/content.expected
2976 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2977 24f136e0 2021-11-20 thomas cp $testroot/wt/foo-1-* $testroot/content
2978 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2980 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2981 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2982 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2983 24f136e0 2021-11-20 thomas return 1
2986 24f136e0 2021-11-20 thomas cp /bin/ls $testroot/content.expected
2987 24f136e0 2021-11-20 thomas chmod 755 $testroot/content.expected
2988 24f136e0 2021-11-20 thomas cp $testroot/wt/foo-2-* $testroot/content
2989 24f136e0 2021-11-20 thomas cmp -s $testroot/content.expected $testroot/content
2991 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
2992 24f136e0 2021-11-20 thomas diff -u $testroot/content.expected $testroot/content
2993 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
2994 24f136e0 2021-11-20 thomas return 1
2997 24f136e0 2021-11-20 thomas (cd $testroot/wt && got status > $testroot/stdout)
2998 8de9d8ad 2023-02-20 thomas echo 'C foo' > $testroot/stdout.expected
2999 24f136e0 2021-11-20 thomas echo -n '? ' >> $testroot/stdout.expected
3000 24f136e0 2021-11-20 thomas (cd $testroot/wt && ls foo-1-* >> $testroot/stdout.expected)
3001 24f136e0 2021-11-20 thomas echo -n '? ' >> $testroot/stdout.expected
3002 24f136e0 2021-11-20 thomas (cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
3003 24f136e0 2021-11-20 thomas echo -n '? ' >> $testroot/stdout.expected
3004 24f136e0 2021-11-20 thomas (cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
3005 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
3007 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3008 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
3009 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3010 24f136e0 2021-11-20 thomas return 1
3013 24f136e0 2021-11-20 thomas # tidy up
3014 24f136e0 2021-11-20 thomas (cd $testroot/wt && got revert -R . > /dev/null)
3015 24f136e0 2021-11-20 thomas rm $testroot/wt/foo-orig-* $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3017 24f136e0 2021-11-20 thomas # update which deletes a binary file
3018 24f136e0 2021-11-20 thomas (cd $testroot/wt && got up -c $commit_id4 > $testroot/stdout)
3019 24f136e0 2021-11-20 thomas echo "D foo" > $testroot/stdout.expected
3020 24f136e0 2021-11-20 thomas echo -n "Updated to refs/heads/master: $commit_id4" \
3021 24f136e0 2021-11-20 thomas >> $testroot/stdout.expected
3022 24f136e0 2021-11-20 thomas echo >> $testroot/stdout.expected
3023 24f136e0 2021-11-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
3025 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
3026 24f136e0 2021-11-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
3027 24f136e0 2021-11-20 thomas test_done "$testroot" "$ret"
3030 24f136e0 2021-11-20 thomas if [ -e $testroot/wt/foo ]; then
3031 24f136e0 2021-11-20 thomas echo "removed file foo still exists on disk" >&2
3032 24f136e0 2021-11-20 thomas test_done "$testroot" "1"
3033 24f136e0 2021-11-20 thomas return 1
3035 24f136e0 2021-11-20 thomas test_done "$testroot" "0"
3038 a2c162eb 2022-10-30 thomas test_update_umask() {
3039 a2c162eb 2022-10-30 thomas local testroot=`test_init update_binary_file`
3041 a2c162eb 2022-10-30 thomas got checkout "$testroot/repo" "$testroot/wt" >/dev/null
3043 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3044 a2c162eb 2022-10-30 thomas test_done "$testroot" "$ret"
3045 a2c162eb 2022-10-30 thomas return 1
3048 a2c162eb 2022-10-30 thomas rm "$testroot/wt/alpha"
3050 a2c162eb 2022-10-30 thomas # using a subshell to avoid clobbering global umask
3051 a2c162eb 2022-10-30 thomas (umask 022 && cd "$testroot/wt" && got update alpha) \
3052 a2c162eb 2022-10-30 thomas >/dev/null 2>/dev/null
3054 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3055 a2c162eb 2022-10-30 thomas test_done "$testroot" $ret
3056 a2c162eb 2022-10-30 thomas return 1
3059 a2c162eb 2022-10-30 thomas if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-r--r--; then
3060 a2c162eb 2022-10-30 thomas echo "alpha is not 0644" >&2
3061 a2c162eb 2022-10-30 thomas test_done "$testroot" 1
3062 a2c162eb 2022-10-30 thomas return 1
3065 a2c162eb 2022-10-30 thomas rm "$testroot/wt/alpha"
3067 a2c162eb 2022-10-30 thomas # using a subshell to avoid clobbering global umask
3068 a2c162eb 2022-10-30 thomas (umask 044 && cd "$testroot/wt" && got update alpha) \
3069 a2c162eb 2022-10-30 thomas >/dev/null 2>/dev/null
3071 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3072 a2c162eb 2022-10-30 thomas test_done "$testroot" $ret
3073 a2c162eb 2022-10-30 thomas return 1
3076 a2c162eb 2022-10-30 thomas if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
3077 a2c162eb 2022-10-30 thomas echo "alpha is not 0600" >&2
3078 a2c162eb 2022-10-30 thomas test_done "$testroot" 1
3079 a2c162eb 2022-10-30 thomas return 1
3082 a2c162eb 2022-10-30 thomas rm "$testroot/wt/alpha"
3084 a2c162eb 2022-10-30 thomas # using a subshell to avoid clobbering global umask
3085 a2c162eb 2022-10-30 thomas (umask 222 && cd "$testroot/wt" && got update alpha) \
3086 a2c162eb 2022-10-30 thomas >/dev/null 2>/dev/null
3088 a2c162eb 2022-10-30 thomas if [ $ret -ne 0 ]; then
3089 a2c162eb 2022-10-30 thomas test_done "$testroot" $ret
3090 a2c162eb 2022-10-30 thomas return 1
3093 a2c162eb 2022-10-30 thomas if ! ls -l "$testroot/wt/alpha" | grep -q ^-r--r--r--; then
3094 a2c162eb 2022-10-30 thomas echo "alpha is not 0444" >&2
3095 a2c162eb 2022-10-30 thomas test_done "$testroot" 1
3096 a2c162eb 2022-10-30 thomas return 1;
3099 a2c162eb 2022-10-30 thomas test_done "$testroot" 0
3102 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3103 c84d8c75 2019-01-02 stsp run_test test_update_basic
3104 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
3105 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
3106 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
3107 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
3108 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
3109 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
3110 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
3111 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
3112 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
3113 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
3114 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
3115 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
3116 7b074ee1 2023-03-01 thomas run_test test_update_changes_file_to_dir
3117 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
3118 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
3119 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
3120 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
3121 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
3122 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
3123 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
3124 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
3125 c4cdcb68 2019-04-03 stsp run_test test_update_partial
3126 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
3127 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
3128 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
3129 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
3130 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
3131 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
3132 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
3133 303e2782 2019-08-09 stsp run_test test_update_tag
3134 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
3135 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
3136 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
3137 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
3138 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
3139 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
3140 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
3141 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
3142 194cb7cb 2021-01-19 stsp run_test test_update_single_file
3143 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
3144 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction
3145 67c65ed7 2021-09-14 tracey run_test test_update_quiet
3146 24f136e0 2021-11-20 thomas run_test test_update_binary_file
3147 a2c162eb 2022-10-30 thomas run_test test_update_umask