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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 9c4b8182 2019-01-02 stsp echo -n "Updated to commit " >> $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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 693719bc 2019-01-03 stsp if [ "$ret" != "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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 3b4d3732 2019-01-02 stsp echo -n "Updated to commit " >> $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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 693719bc 2019-01-03 stsp if [ "$ret" != "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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
105 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
109 512f0d0e 2019-01-02 stsp (cd $testroot/repo && git_rm $testroot/repo beta)
110 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
112 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
113 512f0d0e 2019-01-02 stsp echo -n "Updated to commit " >> $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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
146 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
150 f5c49f82 2019-01-06 stsp (cd $testroot/repo && git_rm $testroot/repo -r epsilon)
151 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
153 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
154 f5c49f82 2019-01-06 stsp echo -n "Updated to commit " >> $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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 5cc266ba 2019-01-06 stsp echo "Updated to commit $first_rev" >> $testroot/stdout.expected
198 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
200 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
202 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
203 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
204 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
208 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
209 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
210 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
214 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
217 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_recursively() {
218 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
219 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
221 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
222 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
223 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
224 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
225 90285c3b 2019-01-08 stsp (cd $testroot/repo && git add .)
226 90285c3b 2019-01-08 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
228 90285c3b 2019-01-08 stsp # check out the epsilon/ sub-tree
229 90285c3b 2019-01-08 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
231 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
232 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
236 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
237 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
238 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
239 90285c3b 2019-01-08 stsp echo "Updated to commit $first_rev" >> $testroot/stdout.expected
241 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
243 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
245 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
246 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
247 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
251 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
252 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
253 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
257 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
260 f6cae3ed 2020-09-13 naddy test_update_sibling_dirs_with_common_prefix() {
261 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
263 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
265 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
266 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
270 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
271 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
272 81a30460 2019-01-08 stsp (cd $testroot/repo && git add epsilon2/mu)
273 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
274 81a30460 2019-01-08 stsp echo change > $testroot/repo/epsilon/zeta
275 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
277 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
278 81a30460 2019-01-08 stsp echo "A epsilon2/mu" >> $testroot/stdout.expected
279 81a30460 2019-01-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
280 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
281 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
283 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
285 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
287 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
288 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
289 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
293 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
294 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
296 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
297 81a30460 2019-01-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
298 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
299 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
301 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
302 81a30460 2019-01-08 stsp # U epsilon/zeta
303 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
304 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
305 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
307 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
309 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
310 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
311 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
315 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
317 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
318 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
320 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
323 f6cae3ed 2020-09-13 naddy test_update_dir_with_dot_sibling() {
324 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
326 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
328 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
329 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
333 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
334 50952927 2019-01-12 stsp (cd $testroot/repo && git add epsilon.txt)
335 50952927 2019-01-12 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
336 50952927 2019-01-12 stsp echo change > $testroot/repo/epsilon/zeta
337 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
339 f5d3d7af 2019-02-05 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
340 f5d3d7af 2019-02-05 stsp echo "A epsilon.txt" >> $testroot/stdout.expected
341 50952927 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
342 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
343 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
345 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
347 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
349 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
350 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
351 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
355 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
356 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
358 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
359 50952927 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
360 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
361 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
363 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
365 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
367 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
368 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
369 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
373 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
375 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
376 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
378 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
381 f6cae3ed 2020-09-13 naddy test_update_moves_files_upwards() {
382 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
384 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
385 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
386 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
387 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
388 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
389 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
391 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
393 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
394 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
398 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu)
399 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon/psi/tau)
400 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
402 21908da4 2019-01-13 stsp echo "A epsilon/mu" > $testroot/stdout.expected
403 21908da4 2019-01-13 stsp echo "D epsilon/psi/chi/tau" >> $testroot/stdout.expected
404 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
405 bd4792ec 2019-01-13 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
406 46cee7a3 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
407 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
408 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
410 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
412 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
414 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
415 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
416 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
420 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
421 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
422 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
426 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
427 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
428 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
432 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
435 f6cae3ed 2020-09-13 naddy test_update_moves_files_to_new_dir() {
436 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
438 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
439 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
440 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
441 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
442 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
443 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
445 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
447 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
448 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
452 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
453 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu)
454 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon-new/psi/tau)
455 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
457 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected
458 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
459 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
460 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
461 46cee7a3 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
462 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
463 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
465 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
467 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
469 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
470 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
471 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
475 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
476 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
477 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
481 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
482 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
483 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
487 4a1ddfc2 2019-01-12 stsp test_done "$testroot" "0"
490 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent() {
491 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent 1`
493 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/Makefile
494 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.6
495 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.c
496 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
497 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "adding initial snake tree"
499 4a1ddfc2 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
501 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
502 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
506 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
507 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c snake)
508 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/move.c
509 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/pathnames.h
510 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/snake.h
511 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snscore
512 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/Makefile
513 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/snscore.c
514 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
515 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "restructuring snake tree"
517 4a1ddfc2 2019-01-12 stsp echo "D Makefile" > $testroot/stdout.expected
518 4a1ddfc2 2019-01-12 stsp echo "A snake/Makefile" >> $testroot/stdout.expected
519 4a1ddfc2 2019-01-12 stsp echo "A snake/move.c" >> $testroot/stdout.expected
520 4a1ddfc2 2019-01-12 stsp echo "A snake/pathnames.h" >> $testroot/stdout.expected
521 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.6" >> $testroot/stdout.expected
522 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.c" >> $testroot/stdout.expected
523 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.h" >> $testroot/stdout.expected
524 18831e78 2019-02-10 stsp echo "D snake.6" >> $testroot/stdout.expected
525 18831e78 2019-02-10 stsp echo "D snake.c" >> $testroot/stdout.expected
526 bd4792ec 2019-01-13 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
527 bd4792ec 2019-01-13 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
528 bd4792ec 2019-01-13 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
529 bd4792ec 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
530 bd4792ec 2019-01-13 stsp echo >> $testroot/stdout.expected
532 bd4792ec 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
534 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
536 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
537 e60e7f5b 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
539 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
542 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent_with_subdir() {
543 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent_with_subdir 1`
545 bd4792ec 2019-01-13 stsp touch $testroot/repo/Makefile
546 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.6
547 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.c
548 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
549 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "adding initial snake tree"
551 bd4792ec 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
553 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
554 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
558 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
559 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c sss/snake)
560 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/move.c
561 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/pathnames.h
562 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/snake.h
563 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/snscore
564 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/Makefile
565 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/snscore.c
566 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
567 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "restructuring snake tree"
569 bd4792ec 2019-01-13 stsp echo "D Makefile" > $testroot/stdout.expected
570 4a1ddfc2 2019-01-12 stsp echo "D snake.6" >> $testroot/stdout.expected
571 4a1ddfc2 2019-01-12 stsp echo "D snake.c" >> $testroot/stdout.expected
572 4a1ddfc2 2019-01-12 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
573 4a1ddfc2 2019-01-12 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
574 bd4792ec 2019-01-13 stsp echo "A sss/snake/Makefile" >> $testroot/stdout.expected
575 bd4792ec 2019-01-13 stsp echo "A sss/snake/move.c" >> $testroot/stdout.expected
576 bd4792ec 2019-01-13 stsp echo "A sss/snake/pathnames.h" >> $testroot/stdout.expected
577 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.6" >> $testroot/stdout.expected
578 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.c" >> $testroot/stdout.expected
579 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.h" >> $testroot/stdout.expected
580 4a1ddfc2 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
581 4a1ddfc2 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
582 4a1ddfc2 2019-01-12 stsp echo >> $testroot/stdout.expected
584 4a1ddfc2 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
586 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
588 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
589 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
590 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
594 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
597 f6cae3ed 2020-09-13 naddy test_update_file_in_subsubdir() {
598 1aad446a 2019-01-13 stsp local testroot=`test_init update_fle_in_subsubdir 1`
600 21908da4 2019-01-13 stsp touch $testroot/repo/Makefile
601 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/altq
602 21908da4 2019-01-13 stsp touch $testroot/repo/altq/if_altq.h
603 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/arch/alpha
604 21908da4 2019-01-13 stsp touch $testroot/repo/arch/alpha/Makefile
605 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
606 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "adding initial tree"
608 21908da4 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
610 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
611 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
615 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
616 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
617 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "changed a file"
619 21908da4 2019-01-13 stsp echo "U arch/alpha/Makefile" > $testroot/stdout.expected
620 21908da4 2019-01-13 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
621 21908da4 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
622 21908da4 2019-01-13 stsp echo >> $testroot/stdout.expected
624 21908da4 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
626 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
628 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
629 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
630 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
634 21908da4 2019-01-13 stsp test_done "$testroot" "0"
637 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
638 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
640 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
641 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
642 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
643 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
644 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
645 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
646 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
647 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
648 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
649 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
650 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
652 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
654 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
655 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
659 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
660 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
661 6353ad76 2019-02-08 stsp sed -i 's/2/22/' $testroot/repo/numbers
662 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
664 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
665 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
666 6353ad76 2019-02-08 stsp sed -i 's/7/77/' $testroot/wt/numbers
668 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
669 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
670 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
671 6353ad76 2019-02-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
672 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
673 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
674 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
676 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
678 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
680 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
681 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
682 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
686 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
687 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
688 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
689 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
690 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
691 f69721c3 2019-10-21 stsp >> $testroot/content.expected
692 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
693 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
694 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
695 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
696 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
697 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
698 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
699 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
700 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
701 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
702 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
703 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
704 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
706 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
707 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
708 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
710 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
712 6353ad76 2019-02-08 stsp if [ "$ret" != "0" ]; then
713 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
715 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
718 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
719 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
721 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
722 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
723 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
724 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
726 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
728 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
729 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
733 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
734 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
736 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
737 68ed9ba5 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
738 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
739 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
741 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
743 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
744 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
748 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
750 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
751 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
752 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
756 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
758 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
759 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
760 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
762 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
765 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
766 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
768 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
769 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
770 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
771 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
773 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
775 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
776 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
780 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
782 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
783 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
784 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
785 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
789 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
790 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
791 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
792 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
794 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
795 ba8a0d4d 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
796 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
797 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
799 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
801 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
802 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
806 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
808 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
809 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
810 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
814 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
816 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
817 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
818 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
820 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
823 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
824 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
826 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
828 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
829 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
833 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
835 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
836 1545c615 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
837 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
838 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
839 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
841 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
843 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
844 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
845 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
849 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
851 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
853 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
855 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
856 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
858 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
861 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
862 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
864 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
866 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
867 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
871 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
872 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
873 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
875 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
876 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
878 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
880 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
881 1430b4e0 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
882 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
883 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
884 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
886 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
888 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
889 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
890 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
894 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
895 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
896 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
897 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
898 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
899 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
900 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
902 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
904 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
906 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
907 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
908 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
912 3165301c 2019-03-27 stsp # resolve the conflict
913 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
914 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
915 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
916 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
918 3165301c 2019-03-27 stsp if [ "$ret" != "0" ]; then
919 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
921 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
924 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
925 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
927 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
929 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
930 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
934 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
935 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
937 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
939 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
941 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
942 708d8e67 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
943 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
944 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
945 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
947 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
948 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
949 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
953 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
955 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
957 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
959 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
960 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
961 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
965 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
966 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
967 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
968 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
970 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
971 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
973 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
976 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
977 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
979 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
981 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
982 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
986 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
987 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
989 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
991 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
993 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
994 13d9040b 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
995 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
996 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
997 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
999 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
1000 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1001 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1005 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1006 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1007 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1008 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1010 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
1011 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1012 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1016 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1017 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1018 13d9040b 2019-03-27 stsp echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
1019 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1020 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1021 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1022 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1023 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1024 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1025 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1026 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1028 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1029 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1031 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
1032 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1034 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1037 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1038 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1040 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1042 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1043 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1047 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1048 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1050 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1052 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1054 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1055 66b11bf5 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1056 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1057 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1058 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1060 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1061 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1062 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1066 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1067 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1068 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1069 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1070 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1071 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1073 54817d72 2019-07-27 stsp if [ "$ret" != "0" ]; then
1074 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1075 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1078 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1080 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1081 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1082 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1086 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1087 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1088 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1092 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1095 f6cae3ed 2020-09-13 naddy test_update_partial() {
1096 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1098 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1100 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1101 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1105 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1106 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1107 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1108 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1110 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1111 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1112 f2ea84fa 2019-07-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1113 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1114 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1116 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1118 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1120 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1121 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1122 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1126 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1127 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1129 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1130 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1132 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1133 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1134 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1138 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1139 e4d984c2 2019-05-22 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1140 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1141 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1143 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1145 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1147 e4d984c2 2019-05-22 stsp if [ "$ret" != "0" ]; then
1148 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1149 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1153 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1154 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1156 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1158 e4d984c2 2019-05-22 stsp if [ "$ret" != "0" ]; then
1159 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1160 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1164 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1167 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1168 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1170 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1172 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1173 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1177 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1178 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1179 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1180 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1182 f2ea84fa 2019-07-27 stsp echo "A new" > $testroot/stdout.expected
1183 f2ea84fa 2019-07-27 stsp echo "A epsilon/new2" >> $testroot/stdout.expected
1184 f2ea84fa 2019-07-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1185 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1186 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1188 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1190 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1192 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1193 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1194 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1198 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1199 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1201 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1203 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1205 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1206 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1208 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1211 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1212 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1214 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1216 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1217 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1221 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1222 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1224 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1225 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1227 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1229 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
1230 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1231 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1235 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1237 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1238 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1239 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1242 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1245 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1246 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1248 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1250 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1251 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1255 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1256 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1257 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1258 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1260 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1261 c4cdcb68 2019-04-03 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1262 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1263 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1265 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1267 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1269 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1270 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1271 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1275 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1276 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1278 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1280 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1281 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1282 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1285 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1289 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1290 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1292 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1294 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1295 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1297 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1299 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1300 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1304 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1305 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1307 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1308 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1310 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1311 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1312 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1313 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1314 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1316 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1318 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1320 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1321 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1322 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1326 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1328 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1329 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1331 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1334 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1335 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1336 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1338 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1340 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1341 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1345 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1346 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1348 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1349 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1350 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1354 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1355 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1356 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1358 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1360 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1361 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1362 024e9686 2019-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1363 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1364 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1365 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1367 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1369 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1371 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1372 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1373 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1377 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1378 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1379 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1380 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1381 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1382 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1383 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1384 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1385 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1386 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1388 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1390 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1392 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1393 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1394 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1398 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1399 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1401 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1402 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1403 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1407 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1410 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1411 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1413 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1415 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1416 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1420 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1421 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1422 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1424 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1425 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1426 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1428 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1429 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1430 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1432 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1434 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1435 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1436 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1440 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1442 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1443 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1444 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1448 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1451 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1452 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1454 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1455 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1456 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1458 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1460 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1461 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1465 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1466 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1468 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1469 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1470 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1471 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1473 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1474 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1475 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1479 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1480 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1481 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1483 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1484 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1485 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1487 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1488 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1489 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1491 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1492 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1493 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1497 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1499 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1500 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1501 a484d721 2019-06-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1502 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1503 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1504 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1506 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1508 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1509 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1510 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1514 9bead371 2019-07-28 stsp # resolve conflict
1515 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1517 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1519 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1520 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1521 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1522 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1524 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1525 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1526 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1530 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1533 f6cae3ed 2020-09-13 naddy test_update_tag() {
1534 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1535 303e2782 2019-08-09 stsp local tag="1.0.0"
1537 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1539 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1540 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1544 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1545 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1546 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1548 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1549 303e2782 2019-08-09 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1550 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1551 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1553 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1555 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1557 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1558 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1559 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1563 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1564 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1566 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1568 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1569 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1571 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1574 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1575 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1577 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1578 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1579 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1580 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1581 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1583 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1585 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1586 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1590 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1592 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1593 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1594 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1595 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1599 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1600 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1601 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1603 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1604 523b8417 2019-10-19 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1605 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1606 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1608 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1610 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1611 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1615 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1616 523b8417 2019-10-19 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
1617 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1619 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1620 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1621 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1626 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1628 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1629 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1630 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1631 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1635 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1637 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1638 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1642 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1643 523b8417 2019-10-19 stsp echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
1644 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1646 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1647 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1648 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1652 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1654 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1655 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1656 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1658 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1661 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1662 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1663 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1665 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1666 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1667 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1669 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1671 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1672 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1676 5036ab18 2020-04-18 stsp # fake a merge conflict
1677 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1678 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1679 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1680 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1681 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1682 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1684 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1685 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1686 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1688 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1689 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1690 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1694 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1695 5036ab18 2020-04-18 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1696 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1697 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1698 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1699 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1700 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1702 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1704 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1705 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1706 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1710 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1712 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1713 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1715 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1718 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1719 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1721 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1723 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
1724 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1726 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1728 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1729 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1731 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1732 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1733 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1734 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1736 e7303626 2020-05-14 stsp # This update only records the new base commit. Otherwise it is a
1737 e7303626 2020-05-14 stsp # no-op change because Got's file index does not track submodules.
1738 e7303626 2020-05-14 stsp echo -n "Updated to commit " > $testroot/stdout.expected
1739 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1740 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1742 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1744 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1746 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1747 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1749 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1752 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1753 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1755 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1757 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1759 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1760 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1762 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
1763 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1765 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1766 e7303626 2020-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1767 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1768 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1770 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1772 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1774 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1775 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1777 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1780 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1781 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1783 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1785 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1787 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1788 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1789 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1790 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1792 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1793 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1794 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1798 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
1799 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1801 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1802 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1803 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1805 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1806 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1807 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1808 e7303626 2020-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1809 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1810 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1812 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1814 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1816 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1817 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1818 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1822 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1824 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1825 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1827 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1828 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1830 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1833 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1834 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1836 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1838 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1839 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1840 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1844 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1845 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1846 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1847 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1848 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1849 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
1850 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1852 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
1853 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
1854 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
1855 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
1856 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
1857 f35fa46a 2020-07-23 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1858 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1859 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
1861 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1863 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1865 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1866 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1867 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1871 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1872 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
1873 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1877 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1878 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1879 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1881 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1882 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1883 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1887 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1888 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
1889 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1893 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1894 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1895 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1897 f35fa46a 2020-07-23 stsp if [ "$ret" != "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/passwd.link ]; then
1904 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
1905 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
1906 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1910 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1911 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1913 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1915 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1916 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1917 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1921 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1922 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
1923 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1925 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1926 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1927 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1931 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1932 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1933 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1935 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1936 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1937 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
1941 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
1942 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
1943 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
1944 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1946 c6e8a826 2021-04-05 stsp if [ "$ret" != "0" ]; then
1947 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1949 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1952 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
1953 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
1955 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1956 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
1957 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
1959 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1961 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
1962 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1963 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1967 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
1968 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
1970 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
1971 993e2a1b 2020-07-23 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1972 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1973 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
1975 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1977 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1979 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
1980 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1981 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1985 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
1986 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
1987 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
1991 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
1994 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
1995 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
1997 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1998 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1999 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2000 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2001 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2002 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2003 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2004 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2005 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2007 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2009 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2010 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2011 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2015 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2016 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sfh gamma epsilon.link)
2017 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2018 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2019 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2020 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2021 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2022 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2023 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2024 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2025 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2027 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2028 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2029 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2030 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sfh beta epsilon.link)
2031 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2032 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link)
2033 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2034 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2035 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2036 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2037 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2038 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2039 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2040 993e2a1b 2020-07-23 stsp # to nonexistent file B
2041 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2042 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2043 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2044 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2045 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2046 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2048 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2050 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2051 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2052 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2053 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2054 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2055 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2056 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2057 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2058 993e2a1b 2020-07-23 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
2059 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2060 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2061 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2063 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2065 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2066 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2067 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2071 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2072 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2073 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2077 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2078 283102fc 2020-07-23 stsp > $testroot/content.expected
2079 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2080 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2081 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2082 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2083 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2084 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2085 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2086 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2088 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2089 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2091 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2092 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2093 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2097 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2098 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2099 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2103 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2104 283102fc 2020-07-23 stsp > $testroot/content.expected
2105 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2106 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2107 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2108 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2109 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2110 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2111 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2112 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2114 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2115 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2117 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2118 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2119 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2123 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2124 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2125 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2126 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2130 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2131 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2133 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2135 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2136 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2137 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2141 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2142 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2143 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2147 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2148 283102fc 2020-07-23 stsp > $testroot/content.expected
2149 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2150 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2151 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2152 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2153 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2154 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2155 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2156 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2158 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2159 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2161 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2162 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2163 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2167 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2168 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2169 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2170 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2174 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2175 283102fc 2020-07-23 stsp > $testroot/content.expected
2176 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2177 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2178 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2179 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2180 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2182 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2183 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2185 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2186 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2187 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2191 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2192 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2193 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2197 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2198 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2199 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2200 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2201 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2202 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2203 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2205 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2206 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2208 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2209 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2210 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2214 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2215 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2216 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2219 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2220 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2221 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2222 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2223 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2224 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2225 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2227 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2228 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2230 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2231 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2232 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2236 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2237 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2238 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2242 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2243 283102fc 2020-07-23 stsp > $testroot/content.expected
2244 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2245 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2246 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2247 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2248 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2250 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2251 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2253 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2254 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2255 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2259 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2260 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2261 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2262 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2263 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2264 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2265 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2269 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2273 194cb7cb 2021-01-19 stsp test_update_single_file() {
2274 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2276 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2277 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2278 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2279 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2281 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2282 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2283 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2284 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2285 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2286 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2288 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2289 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2290 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2292 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2294 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2295 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2299 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2300 79775c2f 2021-01-19 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
2302 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2303 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2305 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2307 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2308 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2309 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2313 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2314 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2316 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2318 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2319 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2320 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2324 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2325 79775c2f 2021-01-19 stsp echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
2327 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2329 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2331 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2332 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2333 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2337 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2338 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2340 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2342 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2343 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2344 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2348 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2349 d51387a0 2021-01-19 stsp echo "Updated to commit $commit_id3" >> $testroot/stdout.expected
2351 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2352 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2354 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2355 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2357 d51387a0 2021-01-19 stsp if [ "$ret" != "0" ]; then
2358 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2359 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2363 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2364 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2366 d51387a0 2021-01-19 stsp if [ "$ret" != "0" ]; then
2367 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2368 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2372 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2373 d51387a0 2021-01-19 stsp echo "Updated to commit $commit_id3" >> $testroot/stdout.expected
2375 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2376 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2378 d51387a0 2021-01-19 stsp if [ "$ret" != "0" ]; then
2379 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2380 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2384 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2385 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2386 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2390 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2394 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2395 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2396 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2397 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2399 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2400 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2401 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2402 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2404 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2406 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2407 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2411 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2412 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2413 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2414 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2415 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2419 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2420 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2421 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2422 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2423 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2427 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2429 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2431 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2432 a769b60b 2021-06-27 stsp echo "Updated to commit $commit_id0" >> $testroot/stdout.expected
2433 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2434 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2436 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2437 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2438 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2442 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2443 a769b60b 2021-06-27 stsp > $testroot/content.expected
2444 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2445 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2446 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2447 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2448 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2449 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2450 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2452 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2454 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2456 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2457 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2458 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2462 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2463 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2464 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2465 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2466 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2470 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2471 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2472 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2473 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2474 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2478 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2479 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2480 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2481 a769b60b 2021-06-27 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
2482 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2483 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2484 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2486 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2487 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2488 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2492 a769b60b 2021-06-27 stsp # blob ID of beta should not have changed
2493 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2494 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2495 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2496 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2497 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2501 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2502 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2503 a769b60b 2021-06-27 stsp # file was not updated.
2504 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2505 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2506 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2507 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2508 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2512 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2513 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2514 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2515 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2517 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2518 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2519 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2523 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2524 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2526 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2527 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2528 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2529 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2531 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2532 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2533 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2537 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2538 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2539 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2540 2c41dce7 2021-06-27 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
2541 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2543 2c41dce7 2021-06-27 stsp if [ "$ret" != "0" ]; then
2544 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2545 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2549 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2550 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2551 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2552 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2553 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2557 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2558 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2559 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2560 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2561 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2565 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2566 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2567 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2569 2c41dce7 2021-06-27 stsp if [ "$ret" != "0" ]; then
2570 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2572 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2575 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2576 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2577 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2578 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2580 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2581 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2582 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2583 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2585 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2587 2c41dce7 2021-06-27 stsp if [ "$ret" != "0" ]; then
2588 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2592 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2593 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2594 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2595 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2596 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2600 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2601 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2602 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2603 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2604 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2608 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2609 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2611 2c41dce7 2021-06-27 stsp # update to the latest commit; this skips beta
2612 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2614 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2615 a769b60b 2021-06-27 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
2616 2c41dce7 2021-06-27 stsp echo "File paths obstructed by a non-regular file: 1" >> $testroot/stdout.expected
2617 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2619 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2620 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2621 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2625 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2626 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2627 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2628 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2629 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2633 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2634 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2635 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2636 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2637 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2641 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2642 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2644 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2645 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2646 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2647 2c41dce7 2021-06-27 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
2648 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2650 2c41dce7 2021-06-27 stsp if [ "$ret" != "0" ]; then
2651 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2652 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2656 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2657 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2658 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2659 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2660 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2664 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2665 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2666 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2667 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2668 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2672 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2673 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2674 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2676 a769b60b 2021-06-27 stsp if [ "$ret" != "0" ]; then
2677 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2679 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2683 7fb414ae 2020-08-08 stsp test_parseargs "$@"
2684 c84d8c75 2019-01-02 stsp run_test test_update_basic
2685 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
2686 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
2687 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
2688 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
2689 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
2690 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
2691 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
2692 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
2693 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
2694 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
2695 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
2696 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
2697 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
2698 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
2699 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
2700 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
2701 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
2702 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
2703 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
2704 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
2705 c4cdcb68 2019-04-03 stsp run_test test_update_partial
2706 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
2707 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
2708 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
2709 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
2710 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
2711 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
2712 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
2713 303e2782 2019-08-09 stsp run_test test_update_tag
2714 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
2715 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
2716 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
2717 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
2718 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
2719 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
2720 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
2721 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
2722 194cb7cb 2021-01-19 stsp run_test test_update_single_file
2723 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
2724 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction