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 512f0d0e 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
103 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
104 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
108 512f0d0e 2019-01-02 stsp (cd $testroot/repo && git_rm $testroot/repo beta)
109 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
111 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
112 512f0d0e 2019-01-02 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
113 512f0d0e 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
114 512f0d0e 2019-01-02 stsp echo >> $testroot/stdout.expected
116 512f0d0e 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
118 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
120 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
121 512f0d0e 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
122 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
126 512f0d0e 2019-01-02 stsp if [ -e $testroot/wt/beta ]; then
127 512f0d0e 2019-01-02 stsp echo "removed file beta still exists on disk" >&2
128 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
132 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
135 f6cae3ed 2020-09-13 naddy test_update_deletes_dir() {
136 f5c49f82 2019-01-06 stsp local testroot=`test_init update_deletes_dir`
138 f5c49f82 2019-01-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
140 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
141 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
145 f5c49f82 2019-01-06 stsp (cd $testroot/repo && git_rm $testroot/repo -r epsilon)
146 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
148 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
149 f5c49f82 2019-01-06 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
150 f5c49f82 2019-01-06 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
151 f5c49f82 2019-01-06 stsp echo >> $testroot/stdout.expected
153 f5c49f82 2019-01-06 stsp (cd $testroot/wt && got update > $testroot/stdout)
155 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
157 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
158 f5c49f82 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
159 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
163 f5c49f82 2019-01-06 stsp if [ -e $testroot/wt/epsilon ]; then
164 f5c49f82 2019-01-06 stsp echo "removed dir epsilon still exists on disk" >&2
165 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
169 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
172 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_with_path_prefix() {
173 5cc266ba 2019-01-06 stsp local testroot=`test_init update_deletes_dir_with_path_prefix`
174 5cc266ba 2019-01-06 stsp local first_rev=`git_show_head $testroot/repo`
176 5cc266ba 2019-01-06 stsp mkdir $testroot/repo/epsilon/psi
177 5cc266ba 2019-01-06 stsp echo mu > $testroot/repo/epsilon/psi/mu
178 5cc266ba 2019-01-06 stsp (cd $testroot/repo && git add .)
179 5cc266ba 2019-01-06 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
181 5cc266ba 2019-01-06 stsp # check out the epsilon/ sub-tree
182 5cc266ba 2019-01-06 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
184 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
185 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
189 5cc266ba 2019-01-06 stsp # update back to first commit and expect psi/mu to be deleted
190 5cc266ba 2019-01-06 stsp echo "D psi/mu" > $testroot/stdout.expected
191 5cc266ba 2019-01-06 stsp echo "Updated to commit $first_rev" >> $testroot/stdout.expected
193 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
195 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
197 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
198 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
199 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
203 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
204 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
205 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
209 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
212 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_recursively() {
213 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
214 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
216 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
217 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
218 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
219 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
220 90285c3b 2019-01-08 stsp (cd $testroot/repo && git add .)
221 90285c3b 2019-01-08 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
223 90285c3b 2019-01-08 stsp # check out the epsilon/ sub-tree
224 90285c3b 2019-01-08 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
226 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
227 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
231 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
232 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
233 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
234 90285c3b 2019-01-08 stsp echo "Updated to commit $first_rev" >> $testroot/stdout.expected
236 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
238 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
240 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
241 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
242 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
246 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
247 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
248 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
252 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
255 f6cae3ed 2020-09-13 naddy test_update_sibling_dirs_with_common_prefix() {
256 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
258 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
260 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
261 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
265 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
266 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
267 81a30460 2019-01-08 stsp (cd $testroot/repo && git add epsilon2/mu)
268 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
269 81a30460 2019-01-08 stsp echo change > $testroot/repo/epsilon/zeta
270 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
272 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
273 81a30460 2019-01-08 stsp echo "A epsilon2/mu" >> $testroot/stdout.expected
274 81a30460 2019-01-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
275 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
276 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
278 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
280 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
282 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
283 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
284 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
288 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
289 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
291 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
292 81a30460 2019-01-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
293 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
294 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
296 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
297 81a30460 2019-01-08 stsp # U epsilon/zeta
298 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
299 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
300 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
302 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
304 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
305 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
306 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
310 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
312 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
313 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
315 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
318 f6cae3ed 2020-09-13 naddy test_update_dir_with_dot_sibling() {
319 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
321 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
323 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
324 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
328 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
329 50952927 2019-01-12 stsp (cd $testroot/repo && git add epsilon.txt)
330 50952927 2019-01-12 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
331 50952927 2019-01-12 stsp echo change > $testroot/repo/epsilon/zeta
332 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
334 f5d3d7af 2019-02-05 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
335 f5d3d7af 2019-02-05 stsp echo "A epsilon.txt" >> $testroot/stdout.expected
336 50952927 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
337 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
338 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
340 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
342 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
344 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
345 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
346 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
350 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
351 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
353 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
354 50952927 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
355 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
356 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
358 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
360 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
362 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
363 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
364 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
368 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
370 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
371 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
373 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
376 f6cae3ed 2020-09-13 naddy test_update_moves_files_upwards() {
377 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
379 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
380 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
381 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
382 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
383 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
384 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
386 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
388 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
389 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
393 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu)
394 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon/psi/tau)
395 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
397 21908da4 2019-01-13 stsp echo "A epsilon/mu" > $testroot/stdout.expected
398 21908da4 2019-01-13 stsp echo "D epsilon/psi/chi/tau" >> $testroot/stdout.expected
399 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
400 bd4792ec 2019-01-13 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
401 46cee7a3 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
402 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
403 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
405 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
407 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
409 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
410 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
411 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
415 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
416 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
417 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
421 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
422 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
423 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
427 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
430 f6cae3ed 2020-09-13 naddy test_update_moves_files_to_new_dir() {
431 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
433 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
434 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
435 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
436 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
437 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
438 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
440 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
442 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
443 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
447 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
448 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu)
449 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon-new/psi/tau)
450 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
452 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected
453 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
454 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
455 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
456 46cee7a3 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
457 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
458 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
460 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
462 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
464 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
465 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
466 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
470 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
471 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
472 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
476 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
477 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
478 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
482 4a1ddfc2 2019-01-12 stsp test_done "$testroot" "0"
485 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent() {
486 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent 1`
488 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/Makefile
489 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.6
490 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.c
491 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
492 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "adding initial snake tree"
494 4a1ddfc2 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
496 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
497 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
501 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
502 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c snake)
503 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/move.c
504 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/pathnames.h
505 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/snake.h
506 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snscore
507 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/Makefile
508 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/snscore.c
509 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
510 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "restructuring snake tree"
512 4a1ddfc2 2019-01-12 stsp echo "D Makefile" > $testroot/stdout.expected
513 4a1ddfc2 2019-01-12 stsp echo "A snake/Makefile" >> $testroot/stdout.expected
514 4a1ddfc2 2019-01-12 stsp echo "A snake/move.c" >> $testroot/stdout.expected
515 4a1ddfc2 2019-01-12 stsp echo "A snake/pathnames.h" >> $testroot/stdout.expected
516 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.6" >> $testroot/stdout.expected
517 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.c" >> $testroot/stdout.expected
518 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.h" >> $testroot/stdout.expected
519 18831e78 2019-02-10 stsp echo "D snake.6" >> $testroot/stdout.expected
520 18831e78 2019-02-10 stsp echo "D snake.c" >> $testroot/stdout.expected
521 bd4792ec 2019-01-13 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
522 bd4792ec 2019-01-13 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
523 bd4792ec 2019-01-13 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
524 bd4792ec 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
525 bd4792ec 2019-01-13 stsp echo >> $testroot/stdout.expected
527 bd4792ec 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
529 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
531 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
532 e60e7f5b 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
534 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
537 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent_with_subdir() {
538 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent_with_subdir 1`
540 bd4792ec 2019-01-13 stsp touch $testroot/repo/Makefile
541 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.6
542 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.c
543 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
544 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "adding initial snake tree"
546 bd4792ec 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
548 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
549 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
553 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
554 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c sss/snake)
555 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/move.c
556 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/pathnames.h
557 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/snake.h
558 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/snscore
559 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/Makefile
560 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/snscore.c
561 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
562 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "restructuring snake tree"
564 bd4792ec 2019-01-13 stsp echo "D Makefile" > $testroot/stdout.expected
565 4a1ddfc2 2019-01-12 stsp echo "D snake.6" >> $testroot/stdout.expected
566 4a1ddfc2 2019-01-12 stsp echo "D snake.c" >> $testroot/stdout.expected
567 4a1ddfc2 2019-01-12 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
568 4a1ddfc2 2019-01-12 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
569 bd4792ec 2019-01-13 stsp echo "A sss/snake/Makefile" >> $testroot/stdout.expected
570 bd4792ec 2019-01-13 stsp echo "A sss/snake/move.c" >> $testroot/stdout.expected
571 bd4792ec 2019-01-13 stsp echo "A sss/snake/pathnames.h" >> $testroot/stdout.expected
572 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.6" >> $testroot/stdout.expected
573 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.c" >> $testroot/stdout.expected
574 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.h" >> $testroot/stdout.expected
575 4a1ddfc2 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
576 4a1ddfc2 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
577 4a1ddfc2 2019-01-12 stsp echo >> $testroot/stdout.expected
579 4a1ddfc2 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
581 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
583 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
584 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
585 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
589 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
592 f6cae3ed 2020-09-13 naddy test_update_file_in_subsubdir() {
593 1aad446a 2019-01-13 stsp local testroot=`test_init update_fle_in_subsubdir 1`
595 21908da4 2019-01-13 stsp touch $testroot/repo/Makefile
596 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/altq
597 21908da4 2019-01-13 stsp touch $testroot/repo/altq/if_altq.h
598 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/arch/alpha
599 21908da4 2019-01-13 stsp touch $testroot/repo/arch/alpha/Makefile
600 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
601 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "adding initial tree"
603 21908da4 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
605 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
606 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
610 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
611 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
612 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "changed a file"
614 21908da4 2019-01-13 stsp echo "U arch/alpha/Makefile" > $testroot/stdout.expected
615 21908da4 2019-01-13 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
616 21908da4 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
617 21908da4 2019-01-13 stsp echo >> $testroot/stdout.expected
619 21908da4 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
621 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
623 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
624 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
625 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
629 21908da4 2019-01-13 stsp test_done "$testroot" "0"
632 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
633 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
635 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
636 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
637 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
638 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
639 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
640 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
641 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
642 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
643 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
644 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
645 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
647 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
649 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
650 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
654 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
655 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
656 6353ad76 2019-02-08 stsp sed -i 's/2/22/' $testroot/repo/numbers
657 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
659 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
660 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
661 6353ad76 2019-02-08 stsp sed -i 's/7/77/' $testroot/wt/numbers
663 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
664 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
665 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
666 6353ad76 2019-02-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
667 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
668 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
669 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
671 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
673 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
675 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
676 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
677 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
681 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
682 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
683 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
684 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
685 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
686 f69721c3 2019-10-21 stsp >> $testroot/content.expected
687 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
688 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
689 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
690 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
691 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
692 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
693 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
694 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
695 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
696 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
697 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
698 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
699 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
701 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
702 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
703 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
705 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
707 6353ad76 2019-02-08 stsp if [ "$ret" != "0" ]; then
708 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
710 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
713 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
714 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
716 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
717 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
718 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
719 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
721 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
723 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
724 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
728 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
729 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
731 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
732 68ed9ba5 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
733 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
734 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
736 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
738 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
739 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
743 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
745 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
746 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
747 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
751 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
753 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
754 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
755 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
757 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
760 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
761 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
763 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
764 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
765 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
766 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
768 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
770 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
771 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
775 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
777 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
778 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
779 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
780 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
784 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
785 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
786 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
787 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
789 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
790 ba8a0d4d 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
791 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
792 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
794 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
796 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
797 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
801 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
803 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
804 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
805 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
809 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
811 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
812 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
813 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
815 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
818 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
819 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
821 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
823 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
824 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
828 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
830 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
831 1545c615 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
832 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
833 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
834 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
836 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
838 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
839 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
840 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
844 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
846 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
848 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
850 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
851 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
853 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
856 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
857 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
859 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
861 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
862 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
866 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
867 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
868 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
870 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
871 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
873 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
875 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
876 1430b4e0 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
877 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
878 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
879 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
881 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
883 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
884 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
885 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
889 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
890 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
891 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
892 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
893 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
894 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
895 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
897 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
899 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
901 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
902 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
903 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
907 3165301c 2019-03-27 stsp # resolve the conflict
908 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
909 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
910 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
911 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
913 3165301c 2019-03-27 stsp if [ "$ret" != "0" ]; then
914 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
916 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
919 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
920 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
922 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
924 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
925 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
929 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
930 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
932 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
934 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
936 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
937 708d8e67 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
938 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
939 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
940 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
942 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
943 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
944 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
948 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
950 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
952 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
954 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
955 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
956 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
960 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
961 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
962 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
963 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
965 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
966 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
968 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
971 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
972 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
974 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
976 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
977 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
981 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
982 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
984 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
986 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
988 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
989 13d9040b 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
990 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
991 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
992 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
994 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
995 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
996 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1000 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1001 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1002 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1003 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1005 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
1006 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1007 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1011 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1012 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1013 13d9040b 2019-03-27 stsp echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
1014 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1015 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1016 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1017 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1018 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1019 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1020 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1021 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1023 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1024 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1026 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
1027 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1029 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1032 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1033 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1035 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1037 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1038 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1042 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1043 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1045 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1047 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1049 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1050 66b11bf5 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1051 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1052 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1053 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1055 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1056 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1057 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1061 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1062 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1063 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1064 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1065 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1066 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1068 54817d72 2019-07-27 stsp if [ "$ret" != "0" ]; then
1069 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1070 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1073 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1075 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1076 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1077 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1081 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1082 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1083 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1087 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1090 f6cae3ed 2020-09-13 naddy test_update_partial() {
1091 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1093 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1095 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1096 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1100 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1101 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1102 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1103 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1105 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1106 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1107 f2ea84fa 2019-07-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1108 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1109 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1111 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1113 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1115 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1116 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1117 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1121 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1122 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1124 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1125 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1127 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1128 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1129 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1133 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1134 e4d984c2 2019-05-22 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1135 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1136 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1138 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1140 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1142 e4d984c2 2019-05-22 stsp if [ "$ret" != "0" ]; then
1143 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1144 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1148 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1149 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1151 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1153 e4d984c2 2019-05-22 stsp if [ "$ret" != "0" ]; then
1154 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1155 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1159 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1162 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1163 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1165 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1167 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1168 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1172 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1173 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1174 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1175 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1177 f2ea84fa 2019-07-27 stsp echo "A new" > $testroot/stdout.expected
1178 f2ea84fa 2019-07-27 stsp echo "A epsilon/new2" >> $testroot/stdout.expected
1179 f2ea84fa 2019-07-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1180 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1181 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1183 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1185 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1187 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1188 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1189 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1193 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1194 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1196 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1198 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1200 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1201 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1203 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1206 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1207 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1209 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1211 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1212 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1216 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1217 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1219 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1220 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1222 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1224 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
1225 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1226 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1230 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1232 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1233 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1234 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1237 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1240 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1241 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1243 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1245 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1246 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1250 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1251 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1252 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1253 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1255 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1256 c4cdcb68 2019-04-03 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1257 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1258 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1260 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1262 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1264 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1265 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1266 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1270 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1271 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1273 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1275 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1276 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1277 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1280 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1284 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1285 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1287 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1289 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1290 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1292 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1294 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1295 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1299 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1300 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1302 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1303 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1305 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1306 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1307 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1308 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1309 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1311 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1313 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1315 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1316 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1317 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1321 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1323 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1324 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1326 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1329 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1330 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1331 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1333 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1335 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1336 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1340 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1341 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1343 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1344 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1345 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1349 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1350 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1351 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1353 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1355 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1356 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1357 024e9686 2019-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1358 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1359 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1360 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1362 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1364 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1366 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1367 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1368 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1372 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1373 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1374 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1375 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1376 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1377 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1378 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1379 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1380 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1381 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1383 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1385 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1387 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1388 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1389 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1393 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1394 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1396 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1397 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1398 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1402 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1405 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1406 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1408 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1410 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1411 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1415 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1416 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1417 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1419 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1420 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1421 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1423 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1424 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1425 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1427 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1429 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1430 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1431 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1435 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1437 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1438 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1439 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1443 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1446 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1447 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1449 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1450 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1451 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1453 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1455 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1456 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1460 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1461 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1463 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1464 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1465 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1466 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1468 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1469 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1470 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1474 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1475 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1476 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1478 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1479 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1480 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1482 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1483 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1484 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1486 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1487 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1488 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1492 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1494 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1495 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1496 a484d721 2019-06-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1497 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1498 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1499 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1501 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1503 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1504 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1505 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1509 9bead371 2019-07-28 stsp # resolve conflict
1510 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1512 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1514 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1515 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1516 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1517 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1519 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1520 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1521 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1525 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1528 f6cae3ed 2020-09-13 naddy test_update_tag() {
1529 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1530 303e2782 2019-08-09 stsp local tag="1.0.0"
1532 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1534 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1535 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1539 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1540 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1541 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1543 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1544 303e2782 2019-08-09 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1545 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1546 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1548 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1550 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1552 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1553 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1554 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1558 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1559 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1561 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1563 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1564 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1566 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1569 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1570 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1572 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1573 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1574 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1575 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1576 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1578 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1580 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1581 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1585 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1587 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1588 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1589 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1590 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1594 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1595 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1596 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1598 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1599 523b8417 2019-10-19 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1600 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1601 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1603 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1605 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1606 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1610 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1611 523b8417 2019-10-19 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
1612 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1614 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1615 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1616 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1621 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1623 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1624 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1625 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1626 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1630 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1632 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1633 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1637 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1638 523b8417 2019-10-19 stsp echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
1639 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1641 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1642 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1643 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1647 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1649 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1650 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1651 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1653 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1656 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1657 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1658 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1660 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1661 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1662 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1664 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1666 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1667 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1671 5036ab18 2020-04-18 stsp # fake a merge conflict
1672 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1673 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1674 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1675 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1676 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1677 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1679 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1680 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1681 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1683 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1684 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1685 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1689 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1690 5036ab18 2020-04-18 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1691 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1692 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1693 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1694 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1695 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1697 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1699 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1700 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1701 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1705 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1707 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1708 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1710 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1713 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1714 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1716 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1718 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
1719 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1721 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1723 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1724 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1726 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1727 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1728 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1729 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1731 e7303626 2020-05-14 stsp # This update only records the new base commit. Otherwise it is a
1732 e7303626 2020-05-14 stsp # no-op change because Got's file index does not track submodules.
1733 e7303626 2020-05-14 stsp echo -n "Updated to commit " > $testroot/stdout.expected
1734 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1735 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1737 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1739 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1741 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1742 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1744 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1747 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1748 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1750 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1752 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1754 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1755 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1757 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
1758 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1760 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1761 e7303626 2020-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1762 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1763 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1765 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1767 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1769 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1770 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1772 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1775 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1776 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1778 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1780 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1782 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1783 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1784 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1785 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1787 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1788 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1789 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1793 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
1794 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1796 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1797 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1798 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1800 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1801 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1802 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1803 e7303626 2020-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1804 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1805 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1807 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1809 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1811 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1812 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1813 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1817 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1819 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1820 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1822 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
1823 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1825 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1828 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1829 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1831 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1833 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1834 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1835 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1839 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1840 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1841 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1842 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1843 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1844 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
1845 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1847 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
1848 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
1849 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
1850 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
1851 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
1852 f35fa46a 2020-07-23 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1853 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1854 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
1856 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1858 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1860 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1861 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1862 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1866 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1867 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
1868 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1872 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1873 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1874 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1876 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1877 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1878 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1882 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1883 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
1884 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1888 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1889 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1890 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1892 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1893 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1894 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1898 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1899 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
1900 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
1901 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1905 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1906 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1908 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1910 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1911 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1912 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1916 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1917 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
1918 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1920 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1921 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1922 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1926 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1927 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1928 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1930 f35fa46a 2020-07-23 stsp if [ "$ret" != "0" ]; then
1931 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1932 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
1936 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
1937 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
1938 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
1939 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1941 c6e8a826 2021-04-05 stsp if [ "$ret" != "0" ]; then
1942 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1944 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1947 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
1948 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
1950 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1951 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
1952 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
1954 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1956 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
1957 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1958 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1962 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
1963 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
1965 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
1966 993e2a1b 2020-07-23 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1967 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1968 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
1970 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1972 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1974 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
1975 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1976 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
1980 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
1981 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
1982 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
1986 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
1989 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
1990 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
1992 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1993 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1994 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1995 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1996 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1997 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
1998 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
1999 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2000 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2002 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2004 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2005 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2006 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2010 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2011 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sfh gamma epsilon.link)
2012 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2013 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2014 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2015 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2016 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2017 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2018 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2019 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2020 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2022 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2023 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2024 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2025 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sfh beta epsilon.link)
2026 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2027 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link)
2028 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2029 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2030 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2031 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2032 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2033 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2034 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2035 993e2a1b 2020-07-23 stsp # to nonexistent file B
2036 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2037 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2038 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2039 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2040 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2041 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2043 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2045 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2046 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2047 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2048 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2049 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2050 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2051 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2052 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2053 993e2a1b 2020-07-23 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
2054 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2055 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2056 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2058 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2060 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2061 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2062 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2066 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2067 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2068 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2072 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2073 283102fc 2020-07-23 stsp > $testroot/content.expected
2074 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2075 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2076 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2077 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2078 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2079 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2080 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2081 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2083 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2084 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2086 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2087 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2088 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2092 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2093 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2094 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2098 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2099 283102fc 2020-07-23 stsp > $testroot/content.expected
2100 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2101 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2102 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2103 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2104 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2105 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2106 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2107 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2109 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2110 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2112 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2113 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2114 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2118 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2119 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2120 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2121 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2125 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2126 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2128 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2130 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2131 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2132 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2136 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2137 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2138 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2142 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2143 283102fc 2020-07-23 stsp > $testroot/content.expected
2144 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2145 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2146 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2147 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2148 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2149 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2150 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2151 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2153 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2154 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2156 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2157 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2158 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2162 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2163 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2164 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2165 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2169 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2170 283102fc 2020-07-23 stsp > $testroot/content.expected
2171 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2172 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2173 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2174 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2175 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2177 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2178 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2180 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2181 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2182 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2186 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2187 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2188 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2192 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2193 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2194 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2195 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2196 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2197 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2198 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2200 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2201 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2203 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2204 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2205 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2209 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2210 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2211 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2214 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2215 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2216 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2217 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2218 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2219 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2220 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2222 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2223 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2225 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2226 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2227 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2231 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2232 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2233 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2237 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2238 283102fc 2020-07-23 stsp > $testroot/content.expected
2239 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2240 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2241 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2242 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2243 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2245 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2246 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2248 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2249 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2250 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2254 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2255 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2256 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2257 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2258 993e2a1b 2020-07-23 stsp if [ "$ret" != "0" ]; then
2259 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2260 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2264 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2268 194cb7cb 2021-01-19 stsp test_update_single_file() {
2269 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2271 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2272 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2273 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2274 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2276 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2277 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2278 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2279 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2280 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2281 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2283 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2284 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2285 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2287 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2289 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2290 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2294 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2295 79775c2f 2021-01-19 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
2297 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2298 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2300 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2302 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2303 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2304 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2308 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2309 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2311 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2313 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2314 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2315 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2319 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2320 79775c2f 2021-01-19 stsp echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
2322 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2324 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2326 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2327 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2328 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2332 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2333 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2335 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2337 194cb7cb 2021-01-19 stsp if [ "$ret" != "0" ]; then
2338 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2339 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2343 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2344 d51387a0 2021-01-19 stsp echo "Updated to commit $commit_id3" >> $testroot/stdout.expected
2346 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2347 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2349 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2350 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2352 d51387a0 2021-01-19 stsp if [ "$ret" != "0" ]; then
2353 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2354 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2358 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2359 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2361 d51387a0 2021-01-19 stsp if [ "$ret" != "0" ]; then
2362 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2363 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2367 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2368 d51387a0 2021-01-19 stsp echo "Updated to commit $commit_id3" >> $testroot/stdout.expected
2370 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2371 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2373 d51387a0 2021-01-19 stsp if [ "$ret" != "0" ]; then
2374 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2375 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2379 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2380 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2381 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2385 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2390 7fb414ae 2020-08-08 stsp test_parseargs "$@"
2391 c84d8c75 2019-01-02 stsp run_test test_update_basic
2392 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
2393 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
2394 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
2395 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
2396 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
2397 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
2398 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
2399 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
2400 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
2401 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
2402 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
2403 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
2404 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
2405 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
2406 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
2407 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
2408 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
2409 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
2410 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
2411 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
2412 c4cdcb68 2019-04-03 stsp run_test test_update_partial
2413 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
2414 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
2415 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
2416 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
2417 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
2418 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
2419 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
2420 303e2782 2019-08-09 stsp run_test test_update_tag
2421 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
2422 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
2423 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
2424 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
2425 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
2426 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
2427 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
2428 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
2429 194cb7cb 2021-01-19 stsp run_test test_update_single_file