Blame


1 c84d8c75 2019-01-02 stsp #!/bin/sh
2 c84d8c75 2019-01-02 stsp #
3 c84d8c75 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 c84d8c75 2019-01-02 stsp #
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.
8 c84d8c75 2019-01-02 stsp #
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.
16 c84d8c75 2019-01-02 stsp
17 c84d8c75 2019-01-02 stsp . ./common.sh
18 c84d8c75 2019-01-02 stsp
19 f6cae3ed 2020-09-13 naddy test_update_basic() {
20 0fbd721f 2019-01-02 stsp local testroot=`test_init update_basic`
21 c84d8c75 2019-01-02 stsp
22 3c90ba67 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
23 49c543a6 2022-03-31 naddy ret=$?
24 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
25 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
26 c84d8c75 2019-01-02 stsp return 1
27 c84d8c75 2019-01-02 stsp fi
28 c84d8c75 2019-01-02 stsp
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"
31 c84d8c75 2019-01-02 stsp
32 c84d8c75 2019-01-02 stsp echo "U alpha" > $testroot/stdout.expected
33 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
34 9c4b8182 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
35 9c4b8182 2019-01-02 stsp echo >> $testroot/stdout.expected
36 c84d8c75 2019-01-02 stsp
37 c84d8c75 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
38 c84d8c75 2019-01-02 stsp
39 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
40 49c543a6 2022-03-31 naddy ret=$?
41 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
42 c84d8c75 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
43 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
44 c84d8c75 2019-01-02 stsp return 1
45 c84d8c75 2019-01-02 stsp fi
46 c84d8c75 2019-01-02 stsp
47 c84d8c75 2019-01-02 stsp echo "modified alpha" > $testroot/content.expected
48 52a3df9b 2019-01-06 stsp cat $testroot/wt/alpha > $testroot/content
49 c84d8c75 2019-01-02 stsp
50 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
51 49c543a6 2022-03-31 naddy ret=$?
52 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
53 c84d8c75 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
54 c84d8c75 2019-01-02 stsp fi
55 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
56 c84d8c75 2019-01-02 stsp }
57 c84d8c75 2019-01-02 stsp
58 f6cae3ed 2020-09-13 naddy test_update_adds_file() {
59 3b4d3732 2019-01-02 stsp local testroot=`test_init update_adds_file`
60 3b4d3732 2019-01-02 stsp
61 3b4d3732 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
62 49c543a6 2022-03-31 naddy ret=$?
63 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
64 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
65 3b4d3732 2019-01-02 stsp return 1
66 3b4d3732 2019-01-02 stsp fi
67 3b4d3732 2019-01-02 stsp
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"
71 3b4d3732 2019-01-02 stsp
72 3b4d3732 2019-01-02 stsp echo "A gamma/new" > $testroot/stdout.expected
73 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
74 3b4d3732 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
75 3b4d3732 2019-01-02 stsp echo >> $testroot/stdout.expected
76 3b4d3732 2019-01-02 stsp
77 3b4d3732 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
78 3b4d3732 2019-01-02 stsp
79 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
80 49c543a6 2022-03-31 naddy ret=$?
81 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
82 3b4d3732 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
84 3b4d3732 2019-01-02 stsp return 1
85 3b4d3732 2019-01-02 stsp fi
86 3b4d3732 2019-01-02 stsp
87 3b4d3732 2019-01-02 stsp echo "new" >> $testroot/content.expected
88 52a3df9b 2019-01-06 stsp cat $testroot/wt/gamma/new > $testroot/content
89 3b4d3732 2019-01-02 stsp
90 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
91 49c543a6 2022-03-31 naddy ret=$?
92 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
93 3b4d3732 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
94 3b4d3732 2019-01-02 stsp fi
95 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
96 3b4d3732 2019-01-02 stsp }
97 3b4d3732 2019-01-02 stsp
98 f6cae3ed 2020-09-13 naddy test_update_deletes_file() {
99 512f0d0e 2019-01-02 stsp local testroot=`test_init update_deletes_file`
100 512f0d0e 2019-01-02 stsp
101 1c4cdd89 2021-06-20 stsp mkdir $testroot/wtparent
102 1c4cdd89 2021-06-20 stsp got checkout $testroot/repo $testroot/wtparent/wt > /dev/null
103 49c543a6 2022-03-31 naddy ret=$?
104 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
105 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
106 512f0d0e 2019-01-02 stsp return 1
107 512f0d0e 2019-01-02 stsp fi
108 512f0d0e 2019-01-02 stsp
109 1eb5d2a0 2023-02-24 naddy git_rm $testroot/repo beta
110 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
111 512f0d0e 2019-01-02 stsp
112 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
113 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
114 512f0d0e 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
115 512f0d0e 2019-01-02 stsp echo >> $testroot/stdout.expected
116 512f0d0e 2019-01-02 stsp
117 1c4cdd89 2021-06-20 stsp # verify that no error occurs if the work tree's parent
118 1c4cdd89 2021-06-20 stsp # directory is not writable
119 1c4cdd89 2021-06-20 stsp chmod u-w $testroot/wtparent
120 1c4cdd89 2021-06-20 stsp (cd $testroot/wtparent/wt && got update > $testroot/stdout)
121 1c4cdd89 2021-06-20 stsp chmod u+w $testroot/wtparent
122 512f0d0e 2019-01-02 stsp
123 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
124 49c543a6 2022-03-31 naddy ret=$?
125 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
126 512f0d0e 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
127 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
128 512f0d0e 2019-01-02 stsp return 1
129 512f0d0e 2019-01-02 stsp fi
130 512f0d0e 2019-01-02 stsp
131 1c4cdd89 2021-06-20 stsp if [ -e $testroot/wtparent/wt/beta ]; then
132 512f0d0e 2019-01-02 stsp echo "removed file beta still exists on disk" >&2
133 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
134 512f0d0e 2019-01-02 stsp return 1
135 512f0d0e 2019-01-02 stsp fi
136 512f0d0e 2019-01-02 stsp
137 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
138 512f0d0e 2019-01-02 stsp }
139 512f0d0e 2019-01-02 stsp
140 f6cae3ed 2020-09-13 naddy test_update_deletes_dir() {
141 f5c49f82 2019-01-06 stsp local testroot=`test_init update_deletes_dir`
142 f5c49f82 2019-01-06 stsp
143 f5c49f82 2019-01-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
144 49c543a6 2022-03-31 naddy ret=$?
145 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
146 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
147 f5c49f82 2019-01-06 stsp return 1
148 f5c49f82 2019-01-06 stsp fi
149 f5c49f82 2019-01-06 stsp
150 1eb5d2a0 2023-02-24 naddy git_rm $testroot/repo -r epsilon
151 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
152 f5c49f82 2019-01-06 stsp
153 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
154 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
155 f5c49f82 2019-01-06 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
156 f5c49f82 2019-01-06 stsp echo >> $testroot/stdout.expected
157 f5c49f82 2019-01-06 stsp
158 f5c49f82 2019-01-06 stsp (cd $testroot/wt && got update > $testroot/stdout)
159 f5c49f82 2019-01-06 stsp
160 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
161 49c543a6 2022-03-31 naddy ret=$?
162 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
163 f5c49f82 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
164 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
165 f5c49f82 2019-01-06 stsp return 1
166 f5c49f82 2019-01-06 stsp fi
167 f5c49f82 2019-01-06 stsp
168 f5c49f82 2019-01-06 stsp if [ -e $testroot/wt/epsilon ]; then
169 f5c49f82 2019-01-06 stsp echo "removed dir epsilon still exists on disk" >&2
170 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
171 f5c49f82 2019-01-06 stsp return 1
172 f5c49f82 2019-01-06 stsp fi
173 f5c49f82 2019-01-06 stsp
174 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
175 f5c49f82 2019-01-06 stsp }
176 f5c49f82 2019-01-06 stsp
177 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_with_path_prefix() {
178 5cc266ba 2019-01-06 stsp local testroot=`test_init update_deletes_dir_with_path_prefix`
179 5cc266ba 2019-01-06 stsp local first_rev=`git_show_head $testroot/repo`
180 5cc266ba 2019-01-06 stsp
181 5cc266ba 2019-01-06 stsp mkdir $testroot/repo/epsilon/psi
182 5cc266ba 2019-01-06 stsp echo mu > $testroot/repo/epsilon/psi/mu
183 5cc266ba 2019-01-06 stsp (cd $testroot/repo && git add .)
184 5cc266ba 2019-01-06 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
185 5cc266ba 2019-01-06 stsp
186 5cc266ba 2019-01-06 stsp # check out the epsilon/ sub-tree
187 5cc266ba 2019-01-06 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
188 49c543a6 2022-03-31 naddy ret=$?
189 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
190 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
191 5cc266ba 2019-01-06 stsp return 1
192 5cc266ba 2019-01-06 stsp fi
193 5cc266ba 2019-01-06 stsp
194 5cc266ba 2019-01-06 stsp # update back to first commit and expect psi/mu to be deleted
195 5cc266ba 2019-01-06 stsp echo "D psi/mu" > $testroot/stdout.expected
196 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
197 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
198 5cc266ba 2019-01-06 stsp
199 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
200 5cc266ba 2019-01-06 stsp
201 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
202 49c543a6 2022-03-31 naddy ret=$?
203 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
204 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
205 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
206 5cc266ba 2019-01-06 stsp return 1
207 5cc266ba 2019-01-06 stsp fi
208 5cc266ba 2019-01-06 stsp
209 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
210 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
211 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
212 5cc266ba 2019-01-06 stsp return 1
213 5cc266ba 2019-01-06 stsp fi
214 5cc266ba 2019-01-06 stsp
215 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
216 5cc266ba 2019-01-06 stsp }
217 5cc266ba 2019-01-06 stsp
218 f6cae3ed 2020-09-13 naddy test_update_deletes_dir_recursively() {
219 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
220 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
221 90285c3b 2019-01-08 stsp
222 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
223 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
224 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
225 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
226 90285c3b 2019-01-08 stsp (cd $testroot/repo && git add .)
227 90285c3b 2019-01-08 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
228 90285c3b 2019-01-08 stsp
229 90285c3b 2019-01-08 stsp # check out the epsilon/ sub-tree
230 90285c3b 2019-01-08 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
231 49c543a6 2022-03-31 naddy ret=$?
232 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
233 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
234 90285c3b 2019-01-08 stsp return 1
235 90285c3b 2019-01-08 stsp fi
236 90285c3b 2019-01-08 stsp
237 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
238 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
239 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
240 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $first_rev" \
241 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
242 90285c3b 2019-01-08 stsp
243 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
244 90285c3b 2019-01-08 stsp
245 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
246 49c543a6 2022-03-31 naddy ret=$?
247 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
248 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
249 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
250 90285c3b 2019-01-08 stsp return 1
251 90285c3b 2019-01-08 stsp fi
252 90285c3b 2019-01-08 stsp
253 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
254 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
255 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
256 90285c3b 2019-01-08 stsp return 1
257 90285c3b 2019-01-08 stsp fi
258 90285c3b 2019-01-08 stsp
259 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
260 90285c3b 2019-01-08 stsp }
261 90285c3b 2019-01-08 stsp
262 f6cae3ed 2020-09-13 naddy test_update_sibling_dirs_with_common_prefix() {
263 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
264 81a30460 2019-01-08 stsp
265 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
266 49c543a6 2022-03-31 naddy ret=$?
267 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
268 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
269 81a30460 2019-01-08 stsp return 1
270 81a30460 2019-01-08 stsp fi
271 81a30460 2019-01-08 stsp
272 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
273 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
274 81a30460 2019-01-08 stsp (cd $testroot/repo && git add epsilon2/mu)
275 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
276 81a30460 2019-01-08 stsp echo change > $testroot/repo/epsilon/zeta
277 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
278 81a30460 2019-01-08 stsp
279 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
280 81a30460 2019-01-08 stsp echo "A epsilon2/mu" >> $testroot/stdout.expected
281 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
282 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
283 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
284 81a30460 2019-01-08 stsp
285 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
286 81a30460 2019-01-08 stsp
287 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
288 49c543a6 2022-03-31 naddy ret=$?
289 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
290 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
291 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
292 81a30460 2019-01-08 stsp return 1
293 81a30460 2019-01-08 stsp fi
294 81a30460 2019-01-08 stsp
295 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
296 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
297 81a30460 2019-01-08 stsp
298 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
299 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
300 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
301 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
302 81a30460 2019-01-08 stsp
303 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
304 81a30460 2019-01-08 stsp # U epsilon/zeta
305 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
306 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
307 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
308 50952927 2019-01-12 stsp
309 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
310 49c543a6 2022-03-31 naddy ret=$?
311 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
312 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
313 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
314 50952927 2019-01-12 stsp return 1
315 50952927 2019-01-12 stsp fi
316 50952927 2019-01-12 stsp
317 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
318 49c543a6 2022-03-31 naddy ret=$?
319 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
320 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
321 50952927 2019-01-12 stsp fi
322 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
323 50952927 2019-01-12 stsp }
324 50952927 2019-01-12 stsp
325 f6cae3ed 2020-09-13 naddy test_update_dir_with_dot_sibling() {
326 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
327 50952927 2019-01-12 stsp
328 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
329 49c543a6 2022-03-31 naddy ret=$?
330 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
331 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
332 50952927 2019-01-12 stsp return 1
333 50952927 2019-01-12 stsp fi
334 50952927 2019-01-12 stsp
335 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
336 50952927 2019-01-12 stsp (cd $testroot/repo && git add epsilon.txt)
337 50952927 2019-01-12 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
338 50952927 2019-01-12 stsp echo change > $testroot/repo/epsilon/zeta
339 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
340 50952927 2019-01-12 stsp
341 f5d3d7af 2019-02-05 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
342 f5d3d7af 2019-02-05 stsp echo "A epsilon.txt" >> $testroot/stdout.expected
343 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
344 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
345 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
346 50952927 2019-01-12 stsp
347 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
348 81a30460 2019-01-08 stsp
349 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
350 49c543a6 2022-03-31 naddy ret=$?
351 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
352 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
353 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
354 81a30460 2019-01-08 stsp return 1
355 81a30460 2019-01-08 stsp fi
356 81a30460 2019-01-08 stsp
357 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
358 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
359 50952927 2019-01-12 stsp
360 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
361 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
362 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
363 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
364 50952927 2019-01-12 stsp
365 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
366 50952927 2019-01-12 stsp
367 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
368 49c543a6 2022-03-31 naddy ret=$?
369 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
370 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
371 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
372 81a30460 2019-01-08 stsp return 1
373 81a30460 2019-01-08 stsp fi
374 81a30460 2019-01-08 stsp
375 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
376 49c543a6 2022-03-31 naddy ret=$?
377 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
378 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
379 50952927 2019-01-12 stsp fi
380 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
381 81a30460 2019-01-08 stsp }
382 46cee7a3 2019-01-12 stsp
383 f6cae3ed 2020-09-13 naddy test_update_moves_files_upwards() {
384 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
385 46cee7a3 2019-01-12 stsp
386 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
387 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
388 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
389 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
390 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
391 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
392 46cee7a3 2019-01-12 stsp
393 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
394 49c543a6 2022-03-31 naddy ret=$?
395 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
396 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
397 46cee7a3 2019-01-12 stsp return 1
398 46cee7a3 2019-01-12 stsp fi
399 81a30460 2019-01-08 stsp
400 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu)
401 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon/psi/tau)
402 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
403 46cee7a3 2019-01-12 stsp
404 21908da4 2019-01-13 stsp echo "A epsilon/mu" > $testroot/stdout.expected
405 21908da4 2019-01-13 stsp echo "D epsilon/psi/chi/tau" >> $testroot/stdout.expected
406 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
407 bd4792ec 2019-01-13 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
408 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
409 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
410 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
411 46cee7a3 2019-01-12 stsp
412 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
413 46cee7a3 2019-01-12 stsp
414 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
415 49c543a6 2022-03-31 naddy ret=$?
416 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
417 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
418 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
419 46cee7a3 2019-01-12 stsp return 1
420 46cee7a3 2019-01-12 stsp fi
421 46cee7a3 2019-01-12 stsp
422 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
423 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
424 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
425 46cee7a3 2019-01-12 stsp return 1
426 46cee7a3 2019-01-12 stsp fi
427 46cee7a3 2019-01-12 stsp
428 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
429 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
430 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
431 46cee7a3 2019-01-12 stsp return 1
432 46cee7a3 2019-01-12 stsp fi
433 46cee7a3 2019-01-12 stsp
434 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
435 46cee7a3 2019-01-12 stsp }
436 46cee7a3 2019-01-12 stsp
437 f6cae3ed 2020-09-13 naddy test_update_moves_files_to_new_dir() {
438 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
439 46cee7a3 2019-01-12 stsp
440 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
441 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
442 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
443 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
444 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
445 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
446 46cee7a3 2019-01-12 stsp
447 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
448 49c543a6 2022-03-31 naddy ret=$?
449 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
450 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
451 46cee7a3 2019-01-12 stsp return 1
452 46cee7a3 2019-01-12 stsp fi
453 46cee7a3 2019-01-12 stsp
454 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
455 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu)
456 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon-new/psi/tau)
457 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
458 46cee7a3 2019-01-12 stsp
459 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected
460 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
461 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
462 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
463 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
464 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
465 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
466 46cee7a3 2019-01-12 stsp
467 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
468 46cee7a3 2019-01-12 stsp
469 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
470 49c543a6 2022-03-31 naddy ret=$?
471 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
472 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
473 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
474 46cee7a3 2019-01-12 stsp return 1
475 46cee7a3 2019-01-12 stsp fi
476 46cee7a3 2019-01-12 stsp
477 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
478 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
479 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
480 46cee7a3 2019-01-12 stsp return 1
481 46cee7a3 2019-01-12 stsp fi
482 46cee7a3 2019-01-12 stsp
483 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
484 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
485 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
486 4a1ddfc2 2019-01-12 stsp return 1
487 4a1ddfc2 2019-01-12 stsp fi
488 4a1ddfc2 2019-01-12 stsp
489 4a1ddfc2 2019-01-12 stsp test_done "$testroot" "0"
490 4a1ddfc2 2019-01-12 stsp }
491 4a1ddfc2 2019-01-12 stsp
492 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent() {
493 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent 1`
494 4a1ddfc2 2019-01-12 stsp
495 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/Makefile
496 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.6
497 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.c
498 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
499 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "adding initial snake tree"
500 4a1ddfc2 2019-01-12 stsp
501 4a1ddfc2 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
502 49c543a6 2022-03-31 naddy ret=$?
503 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
504 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
505 4a1ddfc2 2019-01-12 stsp return 1
506 4a1ddfc2 2019-01-12 stsp fi
507 4a1ddfc2 2019-01-12 stsp
508 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
509 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c snake)
510 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/move.c
511 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/pathnames.h
512 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/snake.h
513 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snscore
514 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/Makefile
515 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/snscore.c
516 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
517 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "restructuring snake tree"
518 4a1ddfc2 2019-01-12 stsp
519 4a1ddfc2 2019-01-12 stsp echo "D Makefile" > $testroot/stdout.expected
520 4a1ddfc2 2019-01-12 stsp echo "A snake/Makefile" >> $testroot/stdout.expected
521 4a1ddfc2 2019-01-12 stsp echo "A snake/move.c" >> $testroot/stdout.expected
522 4a1ddfc2 2019-01-12 stsp echo "A snake/pathnames.h" >> $testroot/stdout.expected
523 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.6" >> $testroot/stdout.expected
524 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.c" >> $testroot/stdout.expected
525 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.h" >> $testroot/stdout.expected
526 18831e78 2019-02-10 stsp echo "D snake.6" >> $testroot/stdout.expected
527 18831e78 2019-02-10 stsp echo "D snake.c" >> $testroot/stdout.expected
528 bd4792ec 2019-01-13 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
529 bd4792ec 2019-01-13 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
530 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
531 bd4792ec 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
532 bd4792ec 2019-01-13 stsp echo >> $testroot/stdout.expected
533 bd4792ec 2019-01-13 stsp
534 bd4792ec 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
535 bd4792ec 2019-01-13 stsp
536 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
537 49c543a6 2022-03-31 naddy ret=$?
538 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
539 e60e7f5b 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
540 bd4792ec 2019-01-13 stsp fi
541 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
542 bd4792ec 2019-01-13 stsp }
543 bd4792ec 2019-01-13 stsp
544 f6cae3ed 2020-09-13 naddy test_update_creates_missing_parent_with_subdir() {
545 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent_with_subdir 1`
546 bd4792ec 2019-01-13 stsp
547 bd4792ec 2019-01-13 stsp touch $testroot/repo/Makefile
548 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.6
549 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.c
550 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
551 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "adding initial snake tree"
552 bd4792ec 2019-01-13 stsp
553 bd4792ec 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
554 49c543a6 2022-03-31 naddy ret=$?
555 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
556 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
557 bd4792ec 2019-01-13 stsp return 1
558 bd4792ec 2019-01-13 stsp fi
559 bd4792ec 2019-01-13 stsp
560 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
561 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c sss/snake)
562 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/move.c
563 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/pathnames.h
564 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/snake.h
565 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/snscore
566 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/Makefile
567 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/snscore.c
568 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
569 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "restructuring snake tree"
570 bd4792ec 2019-01-13 stsp
571 bd4792ec 2019-01-13 stsp echo "D Makefile" > $testroot/stdout.expected
572 4a1ddfc2 2019-01-12 stsp echo "D snake.6" >> $testroot/stdout.expected
573 4a1ddfc2 2019-01-12 stsp echo "D snake.c" >> $testroot/stdout.expected
574 4a1ddfc2 2019-01-12 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
575 4a1ddfc2 2019-01-12 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
576 bd4792ec 2019-01-13 stsp echo "A sss/snake/Makefile" >> $testroot/stdout.expected
577 bd4792ec 2019-01-13 stsp echo "A sss/snake/move.c" >> $testroot/stdout.expected
578 bd4792ec 2019-01-13 stsp echo "A sss/snake/pathnames.h" >> $testroot/stdout.expected
579 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.6" >> $testroot/stdout.expected
580 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.c" >> $testroot/stdout.expected
581 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.h" >> $testroot/stdout.expected
582 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
583 4a1ddfc2 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
584 4a1ddfc2 2019-01-12 stsp echo >> $testroot/stdout.expected
585 4a1ddfc2 2019-01-12 stsp
586 4a1ddfc2 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
587 4a1ddfc2 2019-01-12 stsp
588 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
589 49c543a6 2022-03-31 naddy ret=$?
590 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
591 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
592 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
593 46cee7a3 2019-01-12 stsp return 1
594 46cee7a3 2019-01-12 stsp fi
595 46cee7a3 2019-01-12 stsp
596 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
597 46cee7a3 2019-01-12 stsp }
598 21908da4 2019-01-13 stsp
599 f6cae3ed 2020-09-13 naddy test_update_file_in_subsubdir() {
600 1aad446a 2019-01-13 stsp local testroot=`test_init update_fle_in_subsubdir 1`
601 46cee7a3 2019-01-12 stsp
602 21908da4 2019-01-13 stsp touch $testroot/repo/Makefile
603 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/altq
604 21908da4 2019-01-13 stsp touch $testroot/repo/altq/if_altq.h
605 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/arch/alpha
606 21908da4 2019-01-13 stsp touch $testroot/repo/arch/alpha/Makefile
607 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
608 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "adding initial tree"
609 21908da4 2019-01-13 stsp
610 21908da4 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
611 49c543a6 2022-03-31 naddy ret=$?
612 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
613 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
614 21908da4 2019-01-13 stsp return 1
615 21908da4 2019-01-13 stsp fi
616 21908da4 2019-01-13 stsp
617 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
618 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
619 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "changed a file"
620 21908da4 2019-01-13 stsp
621 21908da4 2019-01-13 stsp echo "U arch/alpha/Makefile" > $testroot/stdout.expected
622 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
623 21908da4 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
624 21908da4 2019-01-13 stsp echo >> $testroot/stdout.expected
625 21908da4 2019-01-13 stsp
626 21908da4 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
627 21908da4 2019-01-13 stsp
628 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
629 49c543a6 2022-03-31 naddy ret=$?
630 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
631 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
632 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
633 21908da4 2019-01-13 stsp return 1
634 21908da4 2019-01-13 stsp fi
635 21908da4 2019-01-13 stsp
636 21908da4 2019-01-13 stsp test_done "$testroot" "0"
637 21908da4 2019-01-13 stsp }
638 c3b9af18 2023-02-26 naddy
639 c3b9af18 2023-02-26 naddy test_update_changes_file_to_dir() {
640 c3b9af18 2023-02-26 naddy local testroot=`test_init update_changes_file_to_dir`
641 c3b9af18 2023-02-26 naddy
642 c3b9af18 2023-02-26 naddy got checkout $testroot/repo $testroot/wt > /dev/null
643 c3b9af18 2023-02-26 naddy ret=$?
644 c3b9af18 2023-02-26 naddy if [ $ret -ne 0 ]; then
645 c3b9af18 2023-02-26 naddy test_done "$testroot" "$ret"
646 c3b9af18 2023-02-26 naddy return 1
647 c3b9af18 2023-02-26 naddy fi
648 6353ad76 2019-02-08 stsp
649 c3b9af18 2023-02-26 naddy git_rm $testroot/repo alpha
650 c3b9af18 2023-02-26 naddy mkdir $testroot/repo/alpha
651 c3b9af18 2023-02-26 naddy echo eta > $testroot/repo/alpha/eta
652 c3b9af18 2023-02-26 naddy (cd $testroot/repo && git add alpha/eta)
653 c3b9af18 2023-02-26 naddy git_commit $testroot/repo -m "changed alpha into directory"
654 c3b9af18 2023-02-26 naddy
655 c3b9af18 2023-02-26 naddy (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
656 c3b9af18 2023-02-26 naddy ret=$?
657 c3b9af18 2023-02-26 naddy if [ $ret -ne 0 ]; then
658 07fa9365 2023-03-10 stsp echo "update failed unexpectedly" >&2
659 07fa9365 2023-03-10 stsp test_done "$testroot" "1"
660 07fa9365 2023-03-10 stsp return 1
661 07fa9365 2023-03-10 stsp fi
662 07fa9365 2023-03-10 stsp
663 07fa9365 2023-03-10 stsp echo "D alpha" > $testroot/stdout.expected
664 07fa9365 2023-03-10 stsp echo "A alpha/eta" >> $testroot/stdout.expected
665 07fa9365 2023-03-10 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
666 07fa9365 2023-03-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
667 07fa9365 2023-03-10 stsp echo >> $testroot/stdout.expected
668 07fa9365 2023-03-10 stsp
669 07fa9365 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
670 07fa9365 2023-03-10 stsp ret=$?
671 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
672 07fa9365 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
673 c3b9af18 2023-02-26 naddy fi
674 c3b9af18 2023-02-26 naddy test_done "$testroot" "$ret"
675 c3b9af18 2023-02-26 naddy }
676 d48a8086 2023-03-10 stsp
677 d48a8086 2023-03-10 stsp test_update_changes_dir_to_file() {
678 d48a8086 2023-03-10 stsp local testroot=`test_init update_changes_dir_to_file`
679 d48a8086 2023-03-10 stsp
680 d48a8086 2023-03-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
681 d48a8086 2023-03-10 stsp ret=$?
682 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
683 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
684 d48a8086 2023-03-10 stsp return 1
685 d48a8086 2023-03-10 stsp fi
686 d48a8086 2023-03-10 stsp
687 d48a8086 2023-03-10 stsp git_rmdir $testroot/repo epsilon
688 d48a8086 2023-03-10 stsp echo epsilon > $testroot/repo/epsilon
689 d48a8086 2023-03-10 stsp cp $testroot/repo/epsilon $testroot/content.expected
690 d48a8086 2023-03-10 stsp (cd $testroot/repo && git add epsilon)
691 d48a8086 2023-03-10 stsp git_commit $testroot/repo -m "changed epsilon into file"
692 d48a8086 2023-03-10 stsp
693 d48a8086 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
694 d48a8086 2023-03-10 stsp ret=$?
695 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
696 d48a8086 2023-03-10 stsp echo "update failed unexpectedly" >&2
697 d48a8086 2023-03-10 stsp test_done "$testroot" "1"
698 d48a8086 2023-03-10 stsp return 1
699 d48a8086 2023-03-10 stsp fi
700 c3b9af18 2023-02-26 naddy
701 d48a8086 2023-03-10 stsp # The current behaviour is not perfect, but we accept it for now.
702 d48a8086 2023-03-10 stsp echo "~ epsilon" > $testroot/stdout.expected
703 d48a8086 2023-03-10 stsp echo "D epsilon/zeta" >> $testroot/stdout.expected
704 d48a8086 2023-03-10 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
705 d48a8086 2023-03-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
706 d48a8086 2023-03-10 stsp echo >> $testroot/stdout.expected
707 d48a8086 2023-03-10 stsp echo "File paths obstructed by a non-regular file: 1" \
708 d48a8086 2023-03-10 stsp >> $testroot/stdout.expected
709 d48a8086 2023-03-10 stsp
710 d48a8086 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
711 d48a8086 2023-03-10 stsp ret=$?
712 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
713 d48a8086 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
714 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
715 d48a8086 2023-03-10 stsp return 1
716 d48a8086 2023-03-10 stsp fi
717 d48a8086 2023-03-10 stsp
718 d48a8086 2023-03-10 stsp # Updating again now restores the file which was obstructed by a
719 d48a8086 2023-03-10 stsp # directory in the previous update operation. Ideally, a single
720 d48a8086 2023-03-10 stsp # update operation would suffice.
721 d48a8086 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
722 d48a8086 2023-03-10 stsp ret=$?
723 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
724 d48a8086 2023-03-10 stsp echo "update failed unexpectedly" >&2
725 d48a8086 2023-03-10 stsp test_done "$testroot" "1"
726 d48a8086 2023-03-10 stsp return 1
727 d48a8086 2023-03-10 stsp fi
728 d48a8086 2023-03-10 stsp echo "A epsilon" > $testroot/stdout.expected
729 d48a8086 2023-03-10 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
730 d48a8086 2023-03-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
731 d48a8086 2023-03-10 stsp echo >> $testroot/stdout.expected
732 d48a8086 2023-03-10 stsp
733 d48a8086 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
734 d48a8086 2023-03-10 stsp ret=$?
735 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
736 d48a8086 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
737 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
738 d48a8086 2023-03-10 stsp return 1
739 d48a8086 2023-03-10 stsp fi
740 d48a8086 2023-03-10 stsp
741 d48a8086 2023-03-10 stsp cmp -s $testroot/content.expected $testroot/wt/epsilon
742 d48a8086 2023-03-10 stsp ret=$?
743 d48a8086 2023-03-10 stsp if [ $ret -ne 0 ]; then
744 d48a8086 2023-03-10 stsp diff -u $testroot/content.expected $testroot/wt/epsilon
745 d48a8086 2023-03-10 stsp fi
746 d48a8086 2023-03-10 stsp test_done "$testroot" "$ret"
747 d48a8086 2023-03-10 stsp }
748 d48a8086 2023-03-10 stsp
749 07fa9365 2023-03-10 stsp test_update_changes_modified_file_to_dir() {
750 07fa9365 2023-03-10 stsp local testroot=`test_init update_changes_modified_file_to_dir`
751 07fa9365 2023-03-10 stsp
752 07fa9365 2023-03-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
753 07fa9365 2023-03-10 stsp ret=$?
754 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
755 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
756 07fa9365 2023-03-10 stsp return 1
757 07fa9365 2023-03-10 stsp fi
758 07fa9365 2023-03-10 stsp
759 07fa9365 2023-03-10 stsp git_rm $testroot/repo alpha
760 07fa9365 2023-03-10 stsp mkdir $testroot/repo/alpha
761 07fa9365 2023-03-10 stsp echo eta > $testroot/repo/alpha/eta
762 07fa9365 2023-03-10 stsp (cd $testroot/repo && git add alpha/eta)
763 07fa9365 2023-03-10 stsp git_commit $testroot/repo -m "changed alpha into directory"
764 07fa9365 2023-03-10 stsp
765 07fa9365 2023-03-10 stsp echo "modified alpha" >> $testroot/wt/alpha
766 07fa9365 2023-03-10 stsp cp $testroot/wt/alpha $testroot/wt/content.expected
767 07fa9365 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
768 07fa9365 2023-03-10 stsp ret=$?
769 07fa9365 2023-03-10 stsp if [ $ret -eq 0 ]; then
770 07fa9365 2023-03-10 stsp echo "update succeeded unexpectedly" >&2
771 07fa9365 2023-03-10 stsp test_done "$testroot" "1"
772 07fa9365 2023-03-10 stsp return 1
773 07fa9365 2023-03-10 stsp fi
774 07fa9365 2023-03-10 stsp
775 07fa9365 2023-03-10 stsp echo "d alpha" > $testroot/stdout.expected
776 07fa9365 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
777 07fa9365 2023-03-10 stsp ret=$?
778 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
779 07fa9365 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
780 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
781 07fa9365 2023-03-10 stsp return 1
782 07fa9365 2023-03-10 stsp fi
783 07fa9365 2023-03-10 stsp
784 07fa9365 2023-03-10 stsp echo "got: alpha/eta: file is obstructed" > $testroot/stderr.expected
785 07fa9365 2023-03-10 stsp cmp -s $testroot/stderr.expected $testroot/stderr
786 07fa9365 2023-03-10 stsp ret=$?
787 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
788 07fa9365 2023-03-10 stsp diff -u $testroot/stderr.expected $testroot/stderr
789 07fa9365 2023-03-10 stsp fi
790 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
791 07fa9365 2023-03-10 stsp }
792 07fa9365 2023-03-10 stsp
793 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
794 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
795 6353ad76 2019-02-08 stsp
796 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
797 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
798 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
799 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
800 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
801 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
802 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
803 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
804 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
805 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
806 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
807 21908da4 2019-01-13 stsp
808 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
809 49c543a6 2022-03-31 naddy ret=$?
810 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
811 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
812 6353ad76 2019-02-08 stsp return 1
813 6353ad76 2019-02-08 stsp fi
814 6353ad76 2019-02-08 stsp
815 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
816 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
817 885e96df 2023-03-06 naddy ed -s $testroot/repo/numbers <<-\EOF
818 885e96df 2023-03-06 naddy ,s/2/22/
819 885e96df 2023-03-06 naddy w
820 885e96df 2023-03-06 naddy EOF
821 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
822 6353ad76 2019-02-08 stsp
823 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
824 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
825 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
826 885e96df 2023-03-06 naddy ,s/7/77/
827 885e96df 2023-03-06 naddy w
828 885e96df 2023-03-06 naddy EOF
829 6353ad76 2019-02-08 stsp
830 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
831 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
832 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
833 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
834 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
835 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
836 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
837 6353ad76 2019-02-08 stsp
838 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
839 6353ad76 2019-02-08 stsp
840 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
841 49c543a6 2022-03-31 naddy ret=$?
842 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
843 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
844 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
845 6353ad76 2019-02-08 stsp return 1
846 6353ad76 2019-02-08 stsp fi
847 6353ad76 2019-02-08 stsp
848 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
849 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
850 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
851 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
852 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
853 f69721c3 2019-10-21 stsp >> $testroot/content.expected
854 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
855 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
856 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
857 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
858 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
859 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
860 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
861 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
862 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
863 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
864 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
865 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
866 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
867 6353ad76 2019-02-08 stsp
868 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
869 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
870 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
871 6353ad76 2019-02-08 stsp
872 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
873 49c543a6 2022-03-31 naddy ret=$?
874 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
875 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
876 68ed9ba5 2019-02-10 stsp fi
877 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
878 68ed9ba5 2019-02-10 stsp }
879 68ed9ba5 2019-02-10 stsp
880 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
881 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
882 68ed9ba5 2019-02-10 stsp
883 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
884 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
885 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
886 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
887 68ed9ba5 2019-02-10 stsp
888 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
889 49c543a6 2022-03-31 naddy ret=$?
890 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
891 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
892 68ed9ba5 2019-02-10 stsp return 1
893 68ed9ba5 2019-02-10 stsp fi
894 68ed9ba5 2019-02-10 stsp
895 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
896 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
897 68ed9ba5 2019-02-10 stsp
898 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
899 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
900 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
901 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
902 68ed9ba5 2019-02-10 stsp
903 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
904 49c543a6 2022-03-31 naddy ret=$?
905 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
906 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
907 68ed9ba5 2019-02-10 stsp return 1
908 6353ad76 2019-02-08 stsp fi
909 68ed9ba5 2019-02-10 stsp
910 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
911 49c543a6 2022-03-31 naddy ret=$?
912 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
913 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
914 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
915 68ed9ba5 2019-02-10 stsp return 1
916 68ed9ba5 2019-02-10 stsp fi
917 68ed9ba5 2019-02-10 stsp
918 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
919 49c543a6 2022-03-31 naddy ret=$?
920 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
921 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
922 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
923 68ed9ba5 2019-02-10 stsp fi
924 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
925 6353ad76 2019-02-08 stsp }
926 ba8a0d4d 2019-02-10 stsp
927 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
928 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
929 ba8a0d4d 2019-02-10 stsp
930 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
931 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
932 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
933 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
934 6353ad76 2019-02-08 stsp
935 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
936 49c543a6 2022-03-31 naddy ret=$?
937 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
938 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
939 ba8a0d4d 2019-02-10 stsp return 1
940 ba8a0d4d 2019-02-10 stsp fi
941 ba8a0d4d 2019-02-10 stsp
942 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
943 49c543a6 2022-03-31 naddy ret=$?
944 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
945 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
946 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
947 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
948 ba8a0d4d 2019-02-10 stsp return 1
949 ba8a0d4d 2019-02-10 stsp fi
950 ba8a0d4d 2019-02-10 stsp
951 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
952 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
953 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
954 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
955 ba8a0d4d 2019-02-10 stsp
956 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
957 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
958 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
959 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
960 ba8a0d4d 2019-02-10 stsp
961 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
962 49c543a6 2022-03-31 naddy ret=$?
963 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
964 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
965 ba8a0d4d 2019-02-10 stsp return 1
966 ba8a0d4d 2019-02-10 stsp fi
967 ba8a0d4d 2019-02-10 stsp
968 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
969 49c543a6 2022-03-31 naddy ret=$?
970 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
971 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
972 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
973 ba8a0d4d 2019-02-10 stsp return 1
974 ba8a0d4d 2019-02-10 stsp fi
975 ba8a0d4d 2019-02-10 stsp
976 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
977 49c543a6 2022-03-31 naddy ret=$?
978 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
979 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
980 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
981 ba8a0d4d 2019-02-10 stsp fi
982 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
983 ba8a0d4d 2019-02-10 stsp }
984 a378724f 2019-02-10 stsp
985 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
986 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
987 a378724f 2019-02-10 stsp
988 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
989 49c543a6 2022-03-31 naddy ret=$?
990 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
991 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
992 a378724f 2019-02-10 stsp return 1
993 a378724f 2019-02-10 stsp fi
994 ba8a0d4d 2019-02-10 stsp
995 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
996 a378724f 2019-02-10 stsp
997 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
998 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
999 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1000 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
1001 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
1002 a378724f 2019-02-10 stsp
1003 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1004 49c543a6 2022-03-31 naddy ret=$?
1005 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1006 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
1007 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
1008 a378724f 2019-02-10 stsp return 1
1009 a378724f 2019-02-10 stsp fi
1010 a378724f 2019-02-10 stsp
1011 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
1012 a378724f 2019-02-10 stsp
1013 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
1014 1430b4e0 2019-03-27 stsp
1015 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1016 49c543a6 2022-03-31 naddy ret=$?
1017 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1018 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
1019 1430b4e0 2019-03-27 stsp fi
1020 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
1021 1430b4e0 2019-03-27 stsp }
1022 1430b4e0 2019-03-27 stsp
1023 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
1024 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
1025 1430b4e0 2019-03-27 stsp
1026 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1027 49c543a6 2022-03-31 naddy ret=$?
1028 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1029 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
1030 1430b4e0 2019-03-27 stsp return 1
1031 1430b4e0 2019-03-27 stsp fi
1032 1430b4e0 2019-03-27 stsp
1033 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
1034 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
1035 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
1036 1430b4e0 2019-03-27 stsp
1037 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
1038 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
1039 1430b4e0 2019-03-27 stsp
1040 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1041 a378724f 2019-02-10 stsp
1042 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
1043 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1044 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1045 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
1046 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1047 9627c110 2020-04-18 stsp
1048 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1049 49c543a6 2022-03-31 naddy ret=$?
1050 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1051 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1052 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
1053 1430b4e0 2019-03-27 stsp return 1
1054 1430b4e0 2019-03-27 stsp fi
1055 1430b4e0 2019-03-27 stsp
1056 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1057 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
1058 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
1059 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
1060 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
1061 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
1062 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1063 1430b4e0 2019-03-27 stsp
1064 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
1065 1430b4e0 2019-03-27 stsp
1066 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1067 49c543a6 2022-03-31 naddy ret=$?
1068 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1069 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
1070 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
1071 3165301c 2019-03-27 stsp return 1
1072 3165301c 2019-03-27 stsp fi
1073 3165301c 2019-03-27 stsp
1074 3165301c 2019-03-27 stsp # resolve the conflict
1075 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
1076 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
1077 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1078 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1079 49c543a6 2022-03-31 naddy ret=$?
1080 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1081 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1082 a378724f 2019-02-10 stsp fi
1083 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
1084 a378724f 2019-02-10 stsp }
1085 708d8e67 2019-03-27 stsp
1086 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
1087 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
1088 708d8e67 2019-03-27 stsp
1089 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1090 49c543a6 2022-03-31 naddy ret=$?
1091 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1092 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1093 708d8e67 2019-03-27 stsp return 1
1094 708d8e67 2019-03-27 stsp fi
1095 708d8e67 2019-03-27 stsp
1096 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1097 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1098 708d8e67 2019-03-27 stsp
1099 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
1100 a378724f 2019-02-10 stsp
1101 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1102 708d8e67 2019-03-27 stsp
1103 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1104 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1105 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1106 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
1107 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1108 49c543a6 2022-03-31 naddy ret=$?
1109 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1110 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1111 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1112 708d8e67 2019-03-27 stsp return 1
1113 708d8e67 2019-03-27 stsp fi
1114 708d8e67 2019-03-27 stsp
1115 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
1116 708d8e67 2019-03-27 stsp
1117 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
1118 708d8e67 2019-03-27 stsp
1119 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1120 49c543a6 2022-03-31 naddy ret=$?
1121 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1122 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
1123 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1124 708d8e67 2019-03-27 stsp return 1
1125 708d8e67 2019-03-27 stsp fi
1126 708d8e67 2019-03-27 stsp
1127 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
1128 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
1129 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1130 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1131 49c543a6 2022-03-31 naddy ret=$?
1132 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1133 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1134 13d9040b 2019-03-27 stsp fi
1135 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1136 13d9040b 2019-03-27 stsp }
1137 13d9040b 2019-03-27 stsp
1138 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
1139 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
1140 13d9040b 2019-03-27 stsp
1141 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1142 49c543a6 2022-03-31 naddy ret=$?
1143 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1144 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1145 13d9040b 2019-03-27 stsp return 1
1146 13d9040b 2019-03-27 stsp fi
1147 13d9040b 2019-03-27 stsp
1148 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
1149 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
1150 13d9040b 2019-03-27 stsp
1151 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1152 13d9040b 2019-03-27 stsp
1153 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1154 13d9040b 2019-03-27 stsp
1155 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1156 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1157 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1158 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
1159 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1160 49c543a6 2022-03-31 naddy ret=$?
1161 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1162 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1163 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1164 13d9040b 2019-03-27 stsp return 1
1165 13d9040b 2019-03-27 stsp fi
1166 13d9040b 2019-03-27 stsp
1167 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1168 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1169 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1170 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1171 49c543a6 2022-03-31 naddy ret=$?
1172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1173 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1174 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1175 13d9040b 2019-03-27 stsp return 1
1176 708d8e67 2019-03-27 stsp fi
1177 13d9040b 2019-03-27 stsp
1178 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1179 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1180 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1181 8469d821 2022-06-25 stsp echo "commit - $head_rev" >> $testroot/stdout.expected
1182 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1183 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1184 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1185 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1186 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1187 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1188 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1189 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1190 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1191 13d9040b 2019-03-27 stsp
1192 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1193 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1194 49c543a6 2022-03-31 naddy ret=$?
1195 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1196 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1197 13d9040b 2019-03-27 stsp fi
1198 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1199 66b11bf5 2019-03-27 stsp }
1200 66b11bf5 2019-03-27 stsp
1201 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1202 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1203 66b11bf5 2019-03-27 stsp
1204 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1205 49c543a6 2022-03-31 naddy ret=$?
1206 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1207 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1208 66b11bf5 2019-03-27 stsp return 1
1209 66b11bf5 2019-03-27 stsp fi
1210 66b11bf5 2019-03-27 stsp
1211 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1212 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1213 66b11bf5 2019-03-27 stsp
1214 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1215 66b11bf5 2019-03-27 stsp
1216 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1217 66b11bf5 2019-03-27 stsp
1218 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1219 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1220 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1221 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1222 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1223 49c543a6 2022-03-31 naddy ret=$?
1224 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1225 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1226 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1227 66b11bf5 2019-03-27 stsp return 1
1228 66b11bf5 2019-03-27 stsp fi
1229 66b11bf5 2019-03-27 stsp
1230 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1231 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1232 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1233 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1234 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1235 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1236 49c543a6 2022-03-31 naddy ret=$?
1237 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1238 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1239 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1240 54817d72 2019-07-27 stsp return 1
1241 54817d72 2019-07-27 stsp fi
1242 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1243 49c543a6 2022-03-31 naddy ret=$?
1244 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1245 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1246 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1247 66b11bf5 2019-03-27 stsp return 1
1248 66b11bf5 2019-03-27 stsp fi
1249 66b11bf5 2019-03-27 stsp
1250 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1251 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1252 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1253 66b11bf5 2019-03-27 stsp return 1
1254 66b11bf5 2019-03-27 stsp fi
1255 66b11bf5 2019-03-27 stsp
1256 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1257 708d8e67 2019-03-27 stsp }
1258 c4cdcb68 2019-04-03 stsp
1259 f6cae3ed 2020-09-13 naddy test_update_partial() {
1260 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1261 c4cdcb68 2019-04-03 stsp
1262 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1263 49c543a6 2022-03-31 naddy ret=$?
1264 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1265 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1266 c4cdcb68 2019-04-03 stsp return 1
1267 c4cdcb68 2019-04-03 stsp fi
1268 708d8e67 2019-03-27 stsp
1269 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1270 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1271 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1272 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1273 c4cdcb68 2019-04-03 stsp
1274 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1275 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1276 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1277 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1278 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1279 c4cdcb68 2019-04-03 stsp
1280 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1281 c4cdcb68 2019-04-03 stsp
1282 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1283 49c543a6 2022-03-31 naddy ret=$?
1284 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1285 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1286 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1287 f2ea84fa 2019-07-27 stsp return 1
1288 f2ea84fa 2019-07-27 stsp fi
1289 c4cdcb68 2019-04-03 stsp
1290 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1291 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1292 f2ea84fa 2019-07-27 stsp
1293 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1294 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1295 49c543a6 2022-03-31 naddy ret=$?
1296 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1297 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1298 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1299 f2ea84fa 2019-07-27 stsp return 1
1300 f2ea84fa 2019-07-27 stsp fi
1301 e4d984c2 2019-05-22 stsp
1302 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1303 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1304 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1305 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1306 e4d984c2 2019-05-22 stsp
1307 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1308 e4d984c2 2019-05-22 stsp
1309 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1310 49c543a6 2022-03-31 naddy ret=$?
1311 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1312 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1313 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1314 e4d984c2 2019-05-22 stsp return 1
1315 e4d984c2 2019-05-22 stsp fi
1316 e4d984c2 2019-05-22 stsp
1317 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1318 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1319 e4d984c2 2019-05-22 stsp
1320 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1321 49c543a6 2022-03-31 naddy ret=$?
1322 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1323 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1324 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1325 e4d984c2 2019-05-22 stsp return 1
1326 e4d984c2 2019-05-22 stsp fi
1327 e4d984c2 2019-05-22 stsp
1328 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1329 c4cdcb68 2019-04-03 stsp }
1330 c4cdcb68 2019-04-03 stsp
1331 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1332 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1333 c4cdcb68 2019-04-03 stsp
1334 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1335 49c543a6 2022-03-31 naddy ret=$?
1336 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1337 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1338 c4cdcb68 2019-04-03 stsp return 1
1339 c4cdcb68 2019-04-03 stsp fi
1340 c4cdcb68 2019-04-03 stsp
1341 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1342 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1343 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1344 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1345 c4cdcb68 2019-04-03 stsp
1346 10a623df 2021-10-11 stsp echo "A epsilon/new2" > $testroot/stdout.expected
1347 10a623df 2021-10-11 stsp echo "A new" >> $testroot/stdout.expected
1348 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1349 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1350 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1351 c4cdcb68 2019-04-03 stsp
1352 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1353 c4cdcb68 2019-04-03 stsp
1354 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1355 49c543a6 2022-03-31 naddy ret=$?
1356 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1357 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1358 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1359 f2ea84fa 2019-07-27 stsp return 1
1360 f2ea84fa 2019-07-27 stsp fi
1361 c4cdcb68 2019-04-03 stsp
1362 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1363 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1364 c4cdcb68 2019-04-03 stsp
1365 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1366 f2ea84fa 2019-07-27 stsp
1367 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1368 49c543a6 2022-03-31 naddy ret=$?
1369 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1370 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1371 f2ea84fa 2019-07-27 stsp fi
1372 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1373 c4cdcb68 2019-04-03 stsp }
1374 c4cdcb68 2019-04-03 stsp
1375 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1376 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1377 c4cdcb68 2019-04-03 stsp
1378 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1379 49c543a6 2022-03-31 naddy ret=$?
1380 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1381 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1382 c4cdcb68 2019-04-03 stsp return 1
1383 c4cdcb68 2019-04-03 stsp fi
1384 c4cdcb68 2019-04-03 stsp
1385 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1386 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1387 c4cdcb68 2019-04-03 stsp
1388 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1389 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1390 f2ea84fa 2019-07-27 stsp
1391 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1392 49c543a6 2022-03-31 naddy ret=$?
1393 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1394 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1395 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1396 f2ea84fa 2019-07-27 stsp return 1
1397 f2ea84fa 2019-07-27 stsp fi
1398 c4cdcb68 2019-04-03 stsp
1399 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1400 49c543a6 2022-03-31 naddy ret=$?
1401 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1402 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1403 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1404 f2ea84fa 2019-07-27 stsp return 1
1405 f2ea84fa 2019-07-27 stsp fi
1406 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1407 c4cdcb68 2019-04-03 stsp }
1408 c4cdcb68 2019-04-03 stsp
1409 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1410 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1411 c4cdcb68 2019-04-03 stsp
1412 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1413 49c543a6 2022-03-31 naddy ret=$?
1414 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1415 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1416 c4cdcb68 2019-04-03 stsp return 1
1417 c4cdcb68 2019-04-03 stsp fi
1418 c4cdcb68 2019-04-03 stsp
1419 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1420 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1421 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1422 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1423 c4cdcb68 2019-04-03 stsp
1424 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1425 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1426 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1427 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1428 c4cdcb68 2019-04-03 stsp
1429 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1430 c4cdcb68 2019-04-03 stsp
1431 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1432 49c543a6 2022-03-31 naddy ret=$?
1433 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1434 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1435 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1436 c4cdcb68 2019-04-03 stsp return 1
1437 c4cdcb68 2019-04-03 stsp fi
1438 c4cdcb68 2019-04-03 stsp
1439 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1440 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1441 c4cdcb68 2019-04-03 stsp
1442 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1443 49c543a6 2022-03-31 naddy ret=$?
1444 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1445 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1446 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1447 c4cdcb68 2019-04-03 stsp return 1
1448 c4cdcb68 2019-04-03 stsp fi
1449 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1450 d5bea539 2019-05-13 stsp
1451 d5bea539 2019-05-13 stsp }
1452 d5bea539 2019-05-13 stsp
1453 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1454 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1455 d5bea539 2019-05-13 stsp
1456 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1457 d5bea539 2019-05-13 stsp
1458 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1459 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1460 d5bea539 2019-05-13 stsp
1461 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1462 49c543a6 2022-03-31 naddy ret=$?
1463 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1464 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1465 d5bea539 2019-05-13 stsp return 1
1466 d5bea539 2019-05-13 stsp fi
1467 d5bea539 2019-05-13 stsp
1468 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1469 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1470 d5bea539 2019-05-13 stsp
1471 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1472 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1473 c4cdcb68 2019-04-03 stsp
1474 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1475 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1476 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1477 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1478 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1479 d5bea539 2019-05-13 stsp
1480 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1481 d5bea539 2019-05-13 stsp
1482 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1483 49c543a6 2022-03-31 naddy ret=$?
1484 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1485 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1486 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1487 d5bea539 2019-05-13 stsp return 1
1488 d5bea539 2019-05-13 stsp fi
1489 d5bea539 2019-05-13 stsp
1490 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1491 49c543a6 2022-03-31 naddy ret=$?
1492 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1493 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1494 d5bea539 2019-05-13 stsp fi
1495 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1496 c4cdcb68 2019-04-03 stsp }
1497 024e9686 2019-05-14 stsp
1498 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1499 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1500 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1501 024e9686 2019-05-14 stsp
1502 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1503 49c543a6 2022-03-31 naddy ret=$?
1504 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1505 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1506 024e9686 2019-05-14 stsp return 1
1507 024e9686 2019-05-14 stsp fi
1508 024e9686 2019-05-14 stsp
1509 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1510 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1511 49c543a6 2022-03-31 naddy ret=$?
1512 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1513 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1514 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1515 024e9686 2019-05-14 stsp return 1
1516 024e9686 2019-05-14 stsp fi
1517 024e9686 2019-05-14 stsp
1518 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1519 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1520 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1521 024e9686 2019-05-14 stsp
1522 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1523 024e9686 2019-05-14 stsp
1524 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1525 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1526 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/newbranch: " >> $testroot/stdout.expected
1527 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1528 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1529 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1530 024e9686 2019-05-14 stsp
1531 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1532 024e9686 2019-05-14 stsp
1533 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1534 49c543a6 2022-03-31 naddy ret=$?
1535 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1536 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1537 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1538 024e9686 2019-05-14 stsp return 1
1539 024e9686 2019-05-14 stsp fi
1540 c4cdcb68 2019-04-03 stsp
1541 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1542 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1543 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1544 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1545 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1546 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1547 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1548 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1549 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1550 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1551 d5bea539 2019-05-13 stsp
1552 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1553 024e9686 2019-05-14 stsp
1554 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1555 49c543a6 2022-03-31 naddy ret=$?
1556 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1557 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1558 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1559 024e9686 2019-05-14 stsp return 1
1560 024e9686 2019-05-14 stsp fi
1561 024e9686 2019-05-14 stsp
1562 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1563 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1564 49c543a6 2022-03-31 naddy ret=$?
1565 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1566 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1567 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1568 a367ff0f 2019-05-14 stsp return 1
1569 a367ff0f 2019-05-14 stsp fi
1570 a367ff0f 2019-05-14 stsp
1571 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1572 a367ff0f 2019-05-14 stsp }
1573 a367ff0f 2019-05-14 stsp
1574 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1575 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1576 a367ff0f 2019-05-14 stsp
1577 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1578 49c543a6 2022-03-31 naddy ret=$?
1579 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1580 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1581 a367ff0f 2019-05-14 stsp return 1
1582 a367ff0f 2019-05-14 stsp fi
1583 a367ff0f 2019-05-14 stsp
1584 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1585 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1586 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1587 a367ff0f 2019-05-14 stsp
1588 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1589 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1590 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1591 a367ff0f 2019-05-14 stsp
1592 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1593 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1594 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1595 a367ff0f 2019-05-14 stsp
1596 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1597 49c543a6 2022-03-31 naddy ret=$?
1598 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1599 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1600 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1601 024e9686 2019-05-14 stsp return 1
1602 024e9686 2019-05-14 stsp fi
1603 024e9686 2019-05-14 stsp
1604 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1605 49c543a6 2022-03-31 naddy ret=$?
1606 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1607 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1608 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1609 a367ff0f 2019-05-14 stsp return 1
1610 a367ff0f 2019-05-14 stsp fi
1611 a367ff0f 2019-05-14 stsp
1612 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1613 024e9686 2019-05-14 stsp }
1614 c932eeeb 2019-05-22 stsp
1615 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1616 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1617 c932eeeb 2019-05-22 stsp
1618 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1619 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1620 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1621 1a36436d 2019-06-10 stsp
1622 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1623 49c543a6 2022-03-31 naddy ret=$?
1624 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1625 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1626 c932eeeb 2019-05-22 stsp return 1
1627 c932eeeb 2019-05-22 stsp fi
1628 024e9686 2019-05-14 stsp
1629 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1630 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1631 c932eeeb 2019-05-22 stsp
1632 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1633 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1634 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1635 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1636 49c543a6 2022-03-31 naddy ret=$?
1637 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1638 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1639 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1640 c932eeeb 2019-05-22 stsp return 1
1641 c932eeeb 2019-05-22 stsp fi
1642 9bead371 2019-07-28 stsp
1643 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1644 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1645 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1646 c932eeeb 2019-05-22 stsp
1647 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1648 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1649 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1650 c932eeeb 2019-05-22 stsp
1651 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1652 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1653 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1654 49c543a6 2022-03-31 naddy ret=$?
1655 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1656 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1657 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1658 c932eeeb 2019-05-22 stsp return 1
1659 c932eeeb 2019-05-22 stsp fi
1660 c932eeeb 2019-05-22 stsp
1661 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1662 c932eeeb 2019-05-22 stsp
1663 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1664 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1665 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1666 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1667 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1668 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1669 9627c110 2020-04-18 stsp
1670 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1671 49c543a6 2022-03-31 naddy ret=$?
1672 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1673 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1674 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1675 c932eeeb 2019-05-22 stsp return 1
1676 c932eeeb 2019-05-22 stsp fi
1677 c932eeeb 2019-05-22 stsp
1678 9bead371 2019-07-28 stsp # resolve conflict
1679 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1680 9bead371 2019-07-28 stsp
1681 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1682 c932eeeb 2019-05-22 stsp
1683 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1684 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1685 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1686 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1687 49c543a6 2022-03-31 naddy ret=$?
1688 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1689 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1690 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1691 303e2782 2019-08-09 stsp return 1
1692 303e2782 2019-08-09 stsp fi
1693 303e2782 2019-08-09 stsp
1694 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1695 303e2782 2019-08-09 stsp }
1696 303e2782 2019-08-09 stsp
1697 f6cae3ed 2020-09-13 naddy test_update_tag() {
1698 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1699 303e2782 2019-08-09 stsp local tag="1.0.0"
1700 303e2782 2019-08-09 stsp
1701 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1702 49c543a6 2022-03-31 naddy ret=$?
1703 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1704 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1705 303e2782 2019-08-09 stsp return 1
1706 303e2782 2019-08-09 stsp fi
1707 303e2782 2019-08-09 stsp
1708 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1709 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1710 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1711 303e2782 2019-08-09 stsp
1712 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1713 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1714 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1715 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1716 303e2782 2019-08-09 stsp
1717 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1718 303e2782 2019-08-09 stsp
1719 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1720 49c543a6 2022-03-31 naddy ret=$?
1721 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1722 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1723 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1724 c932eeeb 2019-05-22 stsp return 1
1725 c932eeeb 2019-05-22 stsp fi
1726 c932eeeb 2019-05-22 stsp
1727 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1728 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1729 303e2782 2019-08-09 stsp
1730 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1731 49c543a6 2022-03-31 naddy ret=$?
1732 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1733 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1734 523b8417 2019-10-19 stsp fi
1735 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1736 523b8417 2019-10-19 stsp }
1737 523b8417 2019-10-19 stsp
1738 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1739 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1740 523b8417 2019-10-19 stsp
1741 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1742 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1743 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1744 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1745 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1746 523b8417 2019-10-19 stsp
1747 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1748 49c543a6 2022-03-31 naddy ret=$?
1749 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1750 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1751 523b8417 2019-10-19 stsp return 1
1752 523b8417 2019-10-19 stsp fi
1753 523b8417 2019-10-19 stsp
1754 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1755 49c543a6 2022-03-31 naddy ret=$?
1756 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1757 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1758 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1759 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1760 523b8417 2019-10-19 stsp return 1
1761 523b8417 2019-10-19 stsp fi
1762 523b8417 2019-10-19 stsp
1763 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1764 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1765 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1766 523b8417 2019-10-19 stsp
1767 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1768 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1769 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1770 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1771 523b8417 2019-10-19 stsp
1772 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1773 49c543a6 2022-03-31 naddy ret=$?
1774 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1775 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1776 523b8417 2019-10-19 stsp return 1
1777 523b8417 2019-10-19 stsp fi
1778 523b8417 2019-10-19 stsp
1779 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1780 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
1781 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1782 49c543a6 2022-03-31 naddy ret=$?
1783 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1784 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1785 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1786 523b8417 2019-10-19 stsp return 1
1787 303e2782 2019-08-09 stsp fi
1788 523b8417 2019-10-19 stsp
1789 523b8417 2019-10-19 stsp
1790 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1791 49c543a6 2022-03-31 naddy ret=$?
1792 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1793 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1794 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1795 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1796 523b8417 2019-10-19 stsp return 1
1797 523b8417 2019-10-19 stsp fi
1798 523b8417 2019-10-19 stsp
1799 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1800 49c543a6 2022-03-31 naddy ret=$?
1801 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1802 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1803 523b8417 2019-10-19 stsp return 1
1804 523b8417 2019-10-19 stsp fi
1805 523b8417 2019-10-19 stsp
1806 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1807 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
1808 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
1809 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1810 49c543a6 2022-03-31 naddy ret=$?
1811 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1812 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1813 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1814 523b8417 2019-10-19 stsp return 1
1815 523b8417 2019-10-19 stsp fi
1816 523b8417 2019-10-19 stsp
1817 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1818 49c543a6 2022-03-31 naddy ret=$?
1819 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1820 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1821 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1822 5036ab18 2020-04-18 stsp fi
1823 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1824 5036ab18 2020-04-18 stsp }
1825 5036ab18 2020-04-18 stsp
1826 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1827 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1828 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1829 5036ab18 2020-04-18 stsp
1830 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1831 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1832 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1833 5036ab18 2020-04-18 stsp
1834 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1835 49c543a6 2022-03-31 naddy ret=$?
1836 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1837 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1838 5036ab18 2020-04-18 stsp return 1
1839 5036ab18 2020-04-18 stsp fi
1840 5036ab18 2020-04-18 stsp
1841 5036ab18 2020-04-18 stsp # fake a merge conflict
1842 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1843 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1844 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1845 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1846 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1847 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1848 5036ab18 2020-04-18 stsp
1849 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1850 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1851 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1852 49c543a6 2022-03-31 naddy ret=$?
1853 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1854 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1855 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1856 5036ab18 2020-04-18 stsp return 1
1857 523b8417 2019-10-19 stsp fi
1858 5036ab18 2020-04-18 stsp
1859 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1860 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1861 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1862 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1863 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1864 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1865 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1866 5036ab18 2020-04-18 stsp
1867 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1868 49c543a6 2022-03-31 naddy ret=$?
1869 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1870 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1871 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1872 5036ab18 2020-04-18 stsp return 1
1873 5036ab18 2020-04-18 stsp fi
1874 5036ab18 2020-04-18 stsp
1875 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1876 49c543a6 2022-03-31 naddy ret=$?
1877 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1878 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1879 5036ab18 2020-04-18 stsp fi
1880 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1881 c932eeeb 2019-05-22 stsp }
1882 e7303626 2020-05-14 stsp
1883 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1884 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1885 e7303626 2020-05-14 stsp
1886 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1887 e7303626 2020-05-14 stsp
1888 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1889 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1890 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1891 c932eeeb 2019-05-22 stsp
1892 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1893 e7303626 2020-05-14 stsp
1894 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1895 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1896 e7303626 2020-05-14 stsp
1897 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1898 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1899 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1900 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1901 e7303626 2020-05-14 stsp
1902 fd785a9a 2023-04-12 stsp echo "Already up-to-date" > $testroot/stdout.expected
1903 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1904 e7303626 2020-05-14 stsp
1905 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1906 49c543a6 2022-03-31 naddy ret=$?
1907 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1908 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1909 e7303626 2020-05-14 stsp fi
1910 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1911 e7303626 2020-05-14 stsp }
1912 e7303626 2020-05-14 stsp
1913 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1914 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1915 e7303626 2020-05-14 stsp
1916 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1917 e7303626 2020-05-14 stsp
1918 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1919 e7303626 2020-05-14 stsp
1920 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1921 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1922 e7303626 2020-05-14 stsp
1923 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1924 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1925 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1926 e7303626 2020-05-14 stsp
1927 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1928 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1929 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1930 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1931 e7303626 2020-05-14 stsp
1932 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1933 e7303626 2020-05-14 stsp
1934 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1935 49c543a6 2022-03-31 naddy ret=$?
1936 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1937 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1938 e7303626 2020-05-14 stsp fi
1939 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1940 e7303626 2020-05-14 stsp }
1941 e7303626 2020-05-14 stsp
1942 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1943 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1944 e7303626 2020-05-14 stsp
1945 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1946 e7303626 2020-05-14 stsp
1947 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1948 e7303626 2020-05-14 stsp
1949 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1950 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1951 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1952 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1953 49c543a6 2022-03-31 naddy ret=$?
1954 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1955 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1956 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1957 e7303626 2020-05-14 stsp return 1
1958 e7303626 2020-05-14 stsp fi
1959 e7303626 2020-05-14 stsp
1960 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1961 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1962 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1963 e7303626 2020-05-14 stsp
1964 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1965 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1966 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1967 e7303626 2020-05-14 stsp
1968 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1969 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1970 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1971 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1972 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1973 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1974 e7303626 2020-05-14 stsp
1975 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1976 e7303626 2020-05-14 stsp
1977 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1978 49c543a6 2022-03-31 naddy ret=$?
1979 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1980 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1981 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1982 e7303626 2020-05-14 stsp return 1
1983 e7303626 2020-05-14 stsp fi
1984 e7303626 2020-05-14 stsp
1985 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1986 e7303626 2020-05-14 stsp
1987 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1988 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1989 49c543a6 2022-03-31 naddy ret=$?
1990 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1991 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1992 e7303626 2020-05-14 stsp fi
1993 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1994 e7303626 2020-05-14 stsp }
1995 f35fa46a 2020-07-23 stsp
1996 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1997 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1998 f35fa46a 2020-07-23 stsp
1999 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2000 49c543a6 2022-03-31 naddy ret=$?
2001 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2002 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2003 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2004 f35fa46a 2020-07-23 stsp return 1
2005 f35fa46a 2020-07-23 stsp fi
2006 f35fa46a 2020-07-23 stsp
2007 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2008 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2009 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2010 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2011 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2012 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
2013 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2014 f35fa46a 2020-07-23 stsp
2015 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
2016 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
2017 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
2018 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
2019 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
2020 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2021 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2022 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
2023 f35fa46a 2020-07-23 stsp
2024 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2025 f35fa46a 2020-07-23 stsp
2026 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2027 49c543a6 2022-03-31 naddy ret=$?
2028 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2029 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2030 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2031 f35fa46a 2020-07-23 stsp return 1
2032 f35fa46a 2020-07-23 stsp fi
2033 f35fa46a 2020-07-23 stsp
2034 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
2035 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
2036 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2037 f35fa46a 2020-07-23 stsp return 1
2038 f35fa46a 2020-07-23 stsp fi
2039 f35fa46a 2020-07-23 stsp
2040 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
2041 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
2042 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2043 49c543a6 2022-03-31 naddy ret=$?
2044 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2045 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2046 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2047 f35fa46a 2020-07-23 stsp return 1
2048 f35fa46a 2020-07-23 stsp fi
2049 f35fa46a 2020-07-23 stsp
2050 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
2051 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
2052 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2053 f35fa46a 2020-07-23 stsp return 1
2054 f35fa46a 2020-07-23 stsp fi
2055 e7303626 2020-05-14 stsp
2056 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
2057 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
2058 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2059 49c543a6 2022-03-31 naddy ret=$?
2060 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2061 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2062 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2063 f35fa46a 2020-07-23 stsp return 1
2064 f35fa46a 2020-07-23 stsp fi
2065 e7303626 2020-05-14 stsp
2066 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2067 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2068 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2069 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2070 f35fa46a 2020-07-23 stsp return 1
2071 f35fa46a 2020-07-23 stsp fi
2072 f35fa46a 2020-07-23 stsp
2073 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2074 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2075 f35fa46a 2020-07-23 stsp
2076 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2077 49c543a6 2022-03-31 naddy ret=$?
2078 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2079 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2080 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2081 f35fa46a 2020-07-23 stsp return 1
2082 f35fa46a 2020-07-23 stsp fi
2083 f35fa46a 2020-07-23 stsp
2084 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
2085 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
2086 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2087 49c543a6 2022-03-31 naddy ret=$?
2088 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2089 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2090 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2091 f35fa46a 2020-07-23 stsp return 1
2092 f35fa46a 2020-07-23 stsp fi
2093 f35fa46a 2020-07-23 stsp
2094 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
2095 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
2096 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2097 49c543a6 2022-03-31 naddy ret=$?
2098 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2099 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2100 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
2101 c6e8a826 2021-04-05 stsp return 1
2102 f35fa46a 2020-07-23 stsp fi
2103 c6e8a826 2021-04-05 stsp
2104 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
2105 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
2106 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
2107 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2108 49c543a6 2022-03-31 naddy ret=$?
2109 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2110 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
2111 c6e8a826 2021-04-05 stsp fi
2112 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2113 993e2a1b 2020-07-23 stsp }
2114 993e2a1b 2020-07-23 stsp
2115 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
2116 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
2117 993e2a1b 2020-07-23 stsp
2118 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2119 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2120 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
2121 993e2a1b 2020-07-23 stsp
2122 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2123 49c543a6 2022-03-31 naddy ret=$?
2124 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2125 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2126 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2127 993e2a1b 2020-07-23 stsp return 1
2128 993e2a1b 2020-07-23 stsp fi
2129 993e2a1b 2020-07-23 stsp
2130 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
2131 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
2132 993e2a1b 2020-07-23 stsp
2133 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
2134 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2135 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2136 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2137 993e2a1b 2020-07-23 stsp
2138 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2139 993e2a1b 2020-07-23 stsp
2140 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2141 49c543a6 2022-03-31 naddy ret=$?
2142 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2143 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2144 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2145 993e2a1b 2020-07-23 stsp return 1
2146 993e2a1b 2020-07-23 stsp fi
2147 993e2a1b 2020-07-23 stsp
2148 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
2149 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
2150 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2151 993e2a1b 2020-07-23 stsp return 1
2152 993e2a1b 2020-07-23 stsp fi
2153 993e2a1b 2020-07-23 stsp
2154 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2155 993e2a1b 2020-07-23 stsp }
2156 993e2a1b 2020-07-23 stsp
2157 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
2158 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
2159 993e2a1b 2020-07-23 stsp
2160 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2161 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2162 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2163 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2164 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2165 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2166 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2167 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2168 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2169 993e2a1b 2020-07-23 stsp
2170 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2171 49c543a6 2022-03-31 naddy ret=$?
2172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2173 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2174 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2175 993e2a1b 2020-07-23 stsp return 1
2176 993e2a1b 2020-07-23 stsp fi
2177 993e2a1b 2020-07-23 stsp
2178 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2179 f55db25a 2023-03-03 naddy (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link)
2180 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2181 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2182 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2183 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2184 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2185 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2186 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2187 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2188 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2189 993e2a1b 2020-07-23 stsp
2190 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2191 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2192 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2193 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s beta epsilon.link)
2194 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2195 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon/beta.link && ln -s ../gamma \
2196 f55db25a 2023-03-03 naddy epsilon/beta.link)
2197 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2198 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2199 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2200 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2201 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2202 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2203 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2204 993e2a1b 2020-07-23 stsp # to nonexistent file B
2205 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2206 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2207 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2208 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2209 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2210 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2211 993e2a1b 2020-07-23 stsp
2212 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2213 993e2a1b 2020-07-23 stsp
2214 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2215 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2216 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2217 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2218 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2219 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2220 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2221 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2222 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2223 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2224 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2225 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2226 993e2a1b 2020-07-23 stsp
2227 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2228 49c543a6 2022-03-31 naddy ret=$?
2229 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2230 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2231 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2232 993e2a1b 2020-07-23 stsp return 1
2233 993e2a1b 2020-07-23 stsp fi
2234 993e2a1b 2020-07-23 stsp
2235 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2236 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2237 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2238 993e2a1b 2020-07-23 stsp return 1
2239 993e2a1b 2020-07-23 stsp fi
2240 993e2a1b 2020-07-23 stsp
2241 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2242 283102fc 2020-07-23 stsp > $testroot/content.expected
2243 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2244 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2245 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2246 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2247 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2248 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2249 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2250 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2251 993e2a1b 2020-07-23 stsp
2252 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2253 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2254 49c543a6 2022-03-31 naddy ret=$?
2255 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2256 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2257 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2258 993e2a1b 2020-07-23 stsp return 1
2259 993e2a1b 2020-07-23 stsp fi
2260 993e2a1b 2020-07-23 stsp
2261 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2262 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2263 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2264 993e2a1b 2020-07-23 stsp return 1
2265 993e2a1b 2020-07-23 stsp fi
2266 993e2a1b 2020-07-23 stsp
2267 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2268 283102fc 2020-07-23 stsp > $testroot/content.expected
2269 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2270 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2271 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2272 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2273 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2274 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2275 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2276 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2277 993e2a1b 2020-07-23 stsp
2278 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2279 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2280 49c543a6 2022-03-31 naddy ret=$?
2281 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2282 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2283 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2284 993e2a1b 2020-07-23 stsp return 1
2285 993e2a1b 2020-07-23 stsp fi
2286 993e2a1b 2020-07-23 stsp
2287 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2288 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2289 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2290 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2291 993e2a1b 2020-07-23 stsp return 1
2292 993e2a1b 2020-07-23 stsp fi
2293 993e2a1b 2020-07-23 stsp
2294 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2295 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2296 993e2a1b 2020-07-23 stsp
2297 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2298 49c543a6 2022-03-31 naddy ret=$?
2299 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2300 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2301 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2302 993e2a1b 2020-07-23 stsp return 1
2303 993e2a1b 2020-07-23 stsp fi
2304 993e2a1b 2020-07-23 stsp
2305 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2306 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2307 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2308 993e2a1b 2020-07-23 stsp return 1
2309 993e2a1b 2020-07-23 stsp fi
2310 993e2a1b 2020-07-23 stsp
2311 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2312 283102fc 2020-07-23 stsp > $testroot/content.expected
2313 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2314 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2315 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2316 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2317 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2318 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2319 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2320 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2321 993e2a1b 2020-07-23 stsp
2322 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2323 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2324 49c543a6 2022-03-31 naddy ret=$?
2325 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2326 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2327 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2328 993e2a1b 2020-07-23 stsp return 1
2329 993e2a1b 2020-07-23 stsp fi
2330 993e2a1b 2020-07-23 stsp
2331 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2332 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2333 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2334 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2335 993e2a1b 2020-07-23 stsp return 1
2336 993e2a1b 2020-07-23 stsp fi
2337 993e2a1b 2020-07-23 stsp
2338 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2339 283102fc 2020-07-23 stsp > $testroot/content.expected
2340 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2341 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2342 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2343 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2344 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2345 993e2a1b 2020-07-23 stsp
2346 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2347 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2348 49c543a6 2022-03-31 naddy ret=$?
2349 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2350 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2351 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2352 993e2a1b 2020-07-23 stsp return 1
2353 993e2a1b 2020-07-23 stsp fi
2354 993e2a1b 2020-07-23 stsp
2355 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2356 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
2357 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2358 993e2a1b 2020-07-23 stsp return 1
2359 993e2a1b 2020-07-23 stsp fi
2360 993e2a1b 2020-07-23 stsp
2361 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2362 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2363 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2364 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2365 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2366 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2367 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2368 3b9f0f87 2020-07-23 stsp
2369 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2370 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2371 49c543a6 2022-03-31 naddy ret=$?
2372 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2373 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2374 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2375 993e2a1b 2020-07-23 stsp return 1
2376 993e2a1b 2020-07-23 stsp fi
2377 993e2a1b 2020-07-23 stsp
2378 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotbar.link ]; then
2379 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2380 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2381 993e2a1b 2020-07-23 stsp return 1
2382 993e2a1b 2020-07-23 stsp fi
2383 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2384 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2385 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2386 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2387 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2388 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2389 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2390 3b9f0f87 2020-07-23 stsp
2391 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2392 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2393 49c543a6 2022-03-31 naddy ret=$?
2394 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2395 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2396 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2397 993e2a1b 2020-07-23 stsp return 1
2398 993e2a1b 2020-07-23 stsp fi
2399 993e2a1b 2020-07-23 stsp
2400 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2401 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2402 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2403 993e2a1b 2020-07-23 stsp return 1
2404 993e2a1b 2020-07-23 stsp fi
2405 993e2a1b 2020-07-23 stsp
2406 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2407 283102fc 2020-07-23 stsp > $testroot/content.expected
2408 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2409 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2410 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2411 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2412 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2413 993e2a1b 2020-07-23 stsp
2414 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2415 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2416 49c543a6 2022-03-31 naddy ret=$?
2417 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2418 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2419 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2420 993e2a1b 2020-07-23 stsp return 1
2421 993e2a1b 2020-07-23 stsp fi
2422 993e2a1b 2020-07-23 stsp
2423 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2424 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2425 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2426 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2427 84246752 2022-06-03 op ret=$?
2428 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2429 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2430 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2431 993e2a1b 2020-07-23 stsp return 1
2432 993e2a1b 2020-07-23 stsp fi
2433 993e2a1b 2020-07-23 stsp
2434 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2435 993e2a1b 2020-07-23 stsp
2436 f35fa46a 2020-07-23 stsp }
2437 194cb7cb 2021-01-19 stsp
2438 194cb7cb 2021-01-19 stsp test_update_single_file() {
2439 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2440 194cb7cb 2021-01-19 stsp
2441 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2442 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2443 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2444 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2445 194cb7cb 2021-01-19 stsp
2446 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2447 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2448 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2449 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2450 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2451 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2452 f35fa46a 2020-07-23 stsp
2453 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2454 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2455 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2456 d51387a0 2021-01-19 stsp
2457 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2458 49c543a6 2022-03-31 naddy ret=$?
2459 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2460 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2461 194cb7cb 2021-01-19 stsp return 1
2462 194cb7cb 2021-01-19 stsp fi
2463 194cb7cb 2021-01-19 stsp
2464 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2465 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2466 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2467 194cb7cb 2021-01-19 stsp
2468 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2469 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2470 194cb7cb 2021-01-19 stsp
2471 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2472 49c543a6 2022-03-31 naddy ret=$?
2473 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2474 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2475 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2476 194cb7cb 2021-01-19 stsp return 1
2477 194cb7cb 2021-01-19 stsp fi
2478 194cb7cb 2021-01-19 stsp
2479 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2480 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2481 194cb7cb 2021-01-19 stsp
2482 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2483 49c543a6 2022-03-31 naddy ret=$?
2484 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2485 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2486 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2487 194cb7cb 2021-01-19 stsp return 1
2488 194cb7cb 2021-01-19 stsp fi
2489 194cb7cb 2021-01-19 stsp
2490 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2491 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
2492 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2493 194cb7cb 2021-01-19 stsp
2494 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2495 194cb7cb 2021-01-19 stsp
2496 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2497 49c543a6 2022-03-31 naddy ret=$?
2498 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2499 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2500 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2501 194cb7cb 2021-01-19 stsp return 1
2502 194cb7cb 2021-01-19 stsp fi
2503 194cb7cb 2021-01-19 stsp
2504 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2505 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2506 194cb7cb 2021-01-19 stsp
2507 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2508 49c543a6 2022-03-31 naddy ret=$?
2509 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2510 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2511 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2512 d51387a0 2021-01-19 stsp return 1
2513 194cb7cb 2021-01-19 stsp fi
2514 d51387a0 2021-01-19 stsp
2515 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2516 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2517 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2518 d51387a0 2021-01-19 stsp
2519 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2520 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2521 d51387a0 2021-01-19 stsp
2522 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2523 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2524 49c543a6 2022-03-31 naddy ret=$?
2525 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2526 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2527 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2528 d51387a0 2021-01-19 stsp return 1
2529 d51387a0 2021-01-19 stsp fi
2530 d51387a0 2021-01-19 stsp
2531 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2532 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2533 49c543a6 2022-03-31 naddy ret=$?
2534 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2535 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2536 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2537 d51387a0 2021-01-19 stsp return 1
2538 d51387a0 2021-01-19 stsp fi
2539 d51387a0 2021-01-19 stsp
2540 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2541 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2542 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2543 d51387a0 2021-01-19 stsp
2544 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2545 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2546 49c543a6 2022-03-31 naddy ret=$?
2547 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2548 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2549 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2550 d51387a0 2021-01-19 stsp return 1
2551 d51387a0 2021-01-19 stsp fi
2552 d51387a0 2021-01-19 stsp
2553 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2554 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2555 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2556 d51387a0 2021-01-19 stsp return 1
2557 d51387a0 2021-01-19 stsp fi
2558 d51387a0 2021-01-19 stsp
2559 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2560 d51387a0 2021-01-19 stsp return 0
2561 a769b60b 2021-06-27 stsp }
2562 a769b60b 2021-06-27 stsp
2563 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2564 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2565 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2566 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2567 a769b60b 2021-06-27 stsp
2568 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2569 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2570 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2571 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2572 a769b60b 2021-06-27 stsp
2573 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2574 49c543a6 2022-03-31 naddy ret=$?
2575 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2576 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2577 a769b60b 2021-06-27 stsp return 1
2578 a769b60b 2021-06-27 stsp fi
2579 a769b60b 2021-06-27 stsp
2580 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2581 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2582 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2583 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2584 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2585 a769b60b 2021-06-27 stsp return 1
2586 a769b60b 2021-06-27 stsp fi
2587 a769b60b 2021-06-27 stsp
2588 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2589 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2590 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2591 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2592 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2593 a769b60b 2021-06-27 stsp return 1
2594 a769b60b 2021-06-27 stsp fi
2595 a769b60b 2021-06-27 stsp
2596 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2597 a769b60b 2021-06-27 stsp
2598 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2599 a769b60b 2021-06-27 stsp
2600 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2601 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id0" \
2602 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2603 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2604 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2605 49c543a6 2022-03-31 naddy ret=$?
2606 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2607 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2608 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2609 a769b60b 2021-06-27 stsp return 1
2610 a769b60b 2021-06-27 stsp fi
2611 a769b60b 2021-06-27 stsp
2612 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2613 a769b60b 2021-06-27 stsp > $testroot/content.expected
2614 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2615 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2616 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2617 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2618 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2619 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2620 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2621 a769b60b 2021-06-27 stsp
2622 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2623 a769b60b 2021-06-27 stsp
2624 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2625 49c543a6 2022-03-31 naddy ret=$?
2626 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2627 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2628 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2629 a769b60b 2021-06-27 stsp return 1
2630 a769b60b 2021-06-27 stsp fi
2631 a769b60b 2021-06-27 stsp
2632 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2633 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2634 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2635 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2636 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2637 a769b60b 2021-06-27 stsp return 1
2638 a769b60b 2021-06-27 stsp fi
2639 a769b60b 2021-06-27 stsp
2640 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2641 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2642 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2643 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2644 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2645 a769b60b 2021-06-27 stsp return 1
2646 a769b60b 2021-06-27 stsp fi
2647 a769b60b 2021-06-27 stsp
2648 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2649 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2650 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2651 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2652 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2653 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2654 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2655 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2656 49c543a6 2022-03-31 naddy ret=$?
2657 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2658 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2659 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2660 a769b60b 2021-06-27 stsp return 1
2661 a769b60b 2021-06-27 stsp fi
2662 a769b60b 2021-06-27 stsp
2663 a769b60b 2021-06-27 stsp # blob ID of beta should not have changed
2664 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2665 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2666 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2667 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2668 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2669 a769b60b 2021-06-27 stsp return 1
2670 a769b60b 2021-06-27 stsp fi
2671 a769b60b 2021-06-27 stsp
2672 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2673 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2674 a769b60b 2021-06-27 stsp # file was not updated.
2675 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2676 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2677 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2678 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2679 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2680 a769b60b 2021-06-27 stsp return 1
2681 a769b60b 2021-06-27 stsp fi
2682 a769b60b 2021-06-27 stsp
2683 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2684 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2685 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2686 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2687 49c543a6 2022-03-31 naddy ret=$?
2688 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2689 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2690 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2691 a769b60b 2021-06-27 stsp return 1
2692 a769b60b 2021-06-27 stsp fi
2693 a769b60b 2021-06-27 stsp
2694 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2695 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2696 a769b60b 2021-06-27 stsp
2697 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2698 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2699 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2700 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2701 49c543a6 2022-03-31 naddy ret=$?
2702 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2703 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2704 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2705 a769b60b 2021-06-27 stsp return 1
2706 a769b60b 2021-06-27 stsp fi
2707 a769b60b 2021-06-27 stsp
2708 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2709 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2710 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2711 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2712 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2713 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2714 49c543a6 2022-03-31 naddy ret=$?
2715 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2716 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2717 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2718 2c41dce7 2021-06-27 stsp return 1
2719 2c41dce7 2021-06-27 stsp fi
2720 2c41dce7 2021-06-27 stsp
2721 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2722 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2723 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2724 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2725 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2726 2c41dce7 2021-06-27 stsp return 1
2727 2c41dce7 2021-06-27 stsp fi
2728 2c41dce7 2021-06-27 stsp
2729 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2730 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2731 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2732 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2733 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2734 2c41dce7 2021-06-27 stsp return 1
2735 2c41dce7 2021-06-27 stsp fi
2736 2c41dce7 2021-06-27 stsp
2737 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2738 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2739 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2740 49c543a6 2022-03-31 naddy ret=$?
2741 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2742 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2743 2c41dce7 2021-06-27 stsp fi
2744 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2745 2c41dce7 2021-06-27 stsp }
2746 2c41dce7 2021-06-27 stsp
2747 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2748 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2749 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2750 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2751 2c41dce7 2021-06-27 stsp
2752 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2753 f6764181 2021-09-24 stsp echo "new file" > $testroot/repo/new
2754 f6764181 2021-09-24 stsp (cd $testroot/repo && git add new)
2755 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2756 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2757 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2758 2c41dce7 2021-06-27 stsp
2759 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2760 49c543a6 2022-03-31 naddy ret=$?
2761 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2762 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2763 2c41dce7 2021-06-27 stsp return 1
2764 2c41dce7 2021-06-27 stsp fi
2765 2c41dce7 2021-06-27 stsp
2766 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2767 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2768 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2769 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2770 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2771 2c41dce7 2021-06-27 stsp return 1
2772 2c41dce7 2021-06-27 stsp fi
2773 2c41dce7 2021-06-27 stsp
2774 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2775 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2776 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2777 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2778 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2779 2c41dce7 2021-06-27 stsp return 1
2780 2c41dce7 2021-06-27 stsp fi
2781 2c41dce7 2021-06-27 stsp
2782 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2783 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2784 f6764181 2021-09-24 stsp mkdir -p $testroot/wt/new
2785 2c41dce7 2021-06-27 stsp
2786 f6764181 2021-09-24 stsp # update to the latest commit; this skips beta and the new file
2787 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2788 49c543a6 2022-03-31 naddy ret=$?
2789 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2790 f6764181 2021-09-24 stsp echo "update failed unexpectedly" >&2
2791 f6764181 2021-09-24 stsp test_done "$testroot" "1"
2792 f6764181 2021-09-24 stsp return 1
2793 f6764181 2021-09-24 stsp fi
2794 2c41dce7 2021-06-27 stsp
2795 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2796 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2797 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2798 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2799 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 2" \
2800 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2801 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2802 49c543a6 2022-03-31 naddy ret=$?
2803 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2804 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2805 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2806 a769b60b 2021-06-27 stsp return 1
2807 a769b60b 2021-06-27 stsp fi
2808 a769b60b 2021-06-27 stsp
2809 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2810 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2811 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2812 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2813 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2814 2c41dce7 2021-06-27 stsp return 1
2815 2c41dce7 2021-06-27 stsp fi
2816 2c41dce7 2021-06-27 stsp
2817 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2818 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2819 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2820 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2821 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2822 2c41dce7 2021-06-27 stsp return 1
2823 2c41dce7 2021-06-27 stsp fi
2824 2c41dce7 2021-06-27 stsp
2825 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2826 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2827 2c41dce7 2021-06-27 stsp
2828 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2829 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2830 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2831 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2832 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2833 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2834 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 1" \
2835 f6764181 2021-09-24 stsp >> $testroot/stdout.expected
2836 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2837 49c543a6 2022-03-31 naddy ret=$?
2838 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2839 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2840 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2841 2c41dce7 2021-06-27 stsp return 1
2842 2c41dce7 2021-06-27 stsp fi
2843 2c41dce7 2021-06-27 stsp
2844 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2845 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2846 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2847 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2848 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2849 a769b60b 2021-06-27 stsp return 1
2850 a769b60b 2021-06-27 stsp fi
2851 a769b60b 2021-06-27 stsp
2852 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2853 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2854 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2855 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2856 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2857 a769b60b 2021-06-27 stsp return 1
2858 a769b60b 2021-06-27 stsp fi
2859 a769b60b 2021-06-27 stsp
2860 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2861 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2862 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2863 49c543a6 2022-03-31 naddy ret=$?
2864 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2865 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2866 a769b60b 2021-06-27 stsp fi
2867 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2868 194cb7cb 2021-01-19 stsp }
2869 67c65ed7 2021-09-14 tracey
2870 67c65ed7 2021-09-14 tracey test_update_quiet() {
2871 67c65ed7 2021-09-14 tracey local testroot=`test_init update_quiet`
2872 67c65ed7 2021-09-14 tracey
2873 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
2874 49c543a6 2022-03-31 naddy ret=$?
2875 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2876 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2877 67c65ed7 2021-09-14 tracey return 1
2878 67c65ed7 2021-09-14 tracey fi
2879 67c65ed7 2021-09-14 tracey
2880 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/repo/alpha
2881 67c65ed7 2021-09-14 tracey git_commit $testroot/repo -m "modified alpha"
2882 67c65ed7 2021-09-14 tracey
2883 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2884 67c65ed7 2021-09-14 tracey git_show_head $testroot/repo >> $testroot/stdout.expected
2885 67c65ed7 2021-09-14 tracey echo >> $testroot/stdout.expected
2886 67c65ed7 2021-09-14 tracey
2887 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got update -q > $testroot/stdout)
2888 67c65ed7 2021-09-14 tracey
2889 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
2890 49c543a6 2022-03-31 naddy ret=$?
2891 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2892 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
2893 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2894 67c65ed7 2021-09-14 tracey return 1
2895 67c65ed7 2021-09-14 tracey fi
2896 194cb7cb 2021-01-19 stsp
2897 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/content.expected
2898 67c65ed7 2021-09-14 tracey cat $testroot/wt/alpha > $testroot/content
2899 194cb7cb 2021-01-19 stsp
2900 67c65ed7 2021-09-14 tracey cmp -s $testroot/content.expected $testroot/content
2901 49c543a6 2022-03-31 naddy ret=$?
2902 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2903 67c65ed7 2021-09-14 tracey diff -u $testroot/content.expected $testroot/content
2904 67c65ed7 2021-09-14 tracey fi
2905 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2906 0e039681 2021-11-15 stsp }
2907 0e039681 2021-11-15 stsp
2908 0e039681 2021-11-15 stsp test_update_binary_file() {
2909 0e039681 2021-11-15 stsp local testroot=`test_init update_binary_file`
2910 0e039681 2021-11-15 stsp local commit_id0=`git_show_head $testroot/repo`
2911 0e039681 2021-11-15 stsp
2912 0e039681 2021-11-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2913 49c543a6 2022-03-31 naddy ret=$?
2914 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2915 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2916 0e039681 2021-11-15 stsp return 1
2917 0e039681 2021-11-15 stsp fi
2918 0e039681 2021-11-15 stsp
2919 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
2920 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2921 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo >/dev/null)
2922 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
2923 0e039681 2021-11-15 stsp local commit_id1=`git_show_head $testroot/repo`
2924 0e039681 2021-11-15 stsp
2925 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2926 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2927 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2928 0e039681 2021-11-15 stsp local commit_id2=`git_show_head $testroot/repo`
2929 0e039681 2021-11-15 stsp
2930 0e039681 2021-11-15 stsp cp /bin/cp $testroot/wt/foo
2931 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2932 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2933 0e039681 2021-11-15 stsp local commit_id3=`git_show_head $testroot/repo`
2934 0e039681 2021-11-15 stsp
2935 0e039681 2021-11-15 stsp (cd $testroot/wt && got rm foo >/dev/null)
2936 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'remove binary file' > /dev/null)
2937 0e039681 2021-11-15 stsp local commit_id4=`git_show_head $testroot/repo`
2938 0e039681 2021-11-15 stsp
2939 0e039681 2021-11-15 stsp # backdate the work tree to make it usable for updating
2940 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2941 0e039681 2021-11-15 stsp
2942 0e039681 2021-11-15 stsp # update which adds a binary file
2943 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2944 0e039681 2021-11-15 stsp
2945 0e039681 2021-11-15 stsp echo "A foo" > $testroot/stdout.expected
2946 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id1" \
2947 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2948 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2949 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2950 49c543a6 2022-03-31 naddy ret=$?
2951 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2952 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2953 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2954 0e039681 2021-11-15 stsp return 1
2955 0e039681 2021-11-15 stsp fi
2956 0e039681 2021-11-15 stsp
2957 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2958 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2959 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2960 0e039681 2021-11-15 stsp
2961 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2962 49c543a6 2022-03-31 naddy ret=$?
2963 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2964 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2965 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2966 0e039681 2021-11-15 stsp return 1
2967 0e039681 2021-11-15 stsp fi
2968 0e039681 2021-11-15 stsp
2969 0e039681 2021-11-15 stsp # update which adds a conflicting binary file
2970 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2971 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2972 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2973 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo > /dev/null)
2974 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2975 0e039681 2021-11-15 stsp
2976 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
2977 0e039681 2021-11-15 stsp echo "Updated to refs/heads/master: $commit_id1" \
2978 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2979 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2980 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2981 49c543a6 2022-03-31 naddy ret=$?
2982 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2983 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2984 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2985 0e039681 2021-11-15 stsp return 1
2986 0e039681 2021-11-15 stsp fi
2987 0e039681 2021-11-15 stsp
2988 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
2989 0e039681 2021-11-15 stsp > $testroot/content.expected
2990 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id1" \
2991 0e039681 2021-11-15 stsp >> $testroot/content.expected
2992 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2993 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
2994 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
2995 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2996 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
2997 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
2998 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2999 0e039681 2021-11-15 stsp
3000 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3001 49c543a6 2022-03-31 naddy ret=$?
3002 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3003 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3004 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3005 0e039681 2021-11-15 stsp return 1
3006 0e039681 2021-11-15 stsp fi
3007 0e039681 2021-11-15 stsp
3008 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
3009 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3010 0e039681 2021-11-15 stsp cat $testroot/wt/foo-1-* > $testroot/content
3011 0e039681 2021-11-15 stsp
3012 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3013 49c543a6 2022-03-31 naddy ret=$?
3014 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3015 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3016 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3017 0e039681 2021-11-15 stsp return 1
3018 0e039681 2021-11-15 stsp fi
3019 0e039681 2021-11-15 stsp
3020 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
3021 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3022 0e039681 2021-11-15 stsp cat $testroot/wt/foo-2-* > $testroot/content
3023 0e039681 2021-11-15 stsp
3024 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3025 49c543a6 2022-03-31 naddy ret=$?
3026 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3027 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3028 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3029 0e039681 2021-11-15 stsp return 1
3030 0e039681 2021-11-15 stsp fi
3031 0e039681 2021-11-15 stsp
3032 0e039681 2021-11-15 stsp # tidy up
3033 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . >/dev/null)
3034 0e039681 2021-11-15 stsp rm $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3035 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > /dev/null)
3036 0e039681 2021-11-15 stsp
3037 0e039681 2021-11-15 stsp # update which changes a binary file
3038 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id2 > $testroot/stdout)
3039 0e039681 2021-11-15 stsp
3040 0e039681 2021-11-15 stsp echo "U foo" > $testroot/stdout.expected
3041 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id2" \
3042 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3043 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3044 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3045 49c543a6 2022-03-31 naddy ret=$?
3046 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3047 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3048 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3049 0e039681 2021-11-15 stsp return 1
3050 0e039681 2021-11-15 stsp fi
3051 0e039681 2021-11-15 stsp
3052 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
3053 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3054 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
3055 0e039681 2021-11-15 stsp
3056 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3057 49c543a6 2022-03-31 naddy ret=$?
3058 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3059 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3060 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3061 0e039681 2021-11-15 stsp return 1
3062 0e039681 2021-11-15 stsp fi
3063 0e039681 2021-11-15 stsp
3064 0e039681 2021-11-15 stsp # update which changes a locally modified binary file
3065 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
3066 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
3067 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id3 > $testroot/stdout)
3068 0e039681 2021-11-15 stsp
3069 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
3070 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id3" \
3071 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3072 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3073 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
3074 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3075 49c543a6 2022-03-31 naddy ret=$?
3076 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3077 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3078 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3079 0e039681 2021-11-15 stsp return 1
3080 0e039681 2021-11-15 stsp fi
3081 0e039681 2021-11-15 stsp
3082 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
3083 0e039681 2021-11-15 stsp > $testroot/content.expected
3084 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id3" \
3085 0e039681 2021-11-15 stsp >> $testroot/content.expected
3086 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3087 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
3088 0e039681 2021-11-15 stsp echo "||||||| 3-way merge base: commit $commit_id2" \
3089 0e039681 2021-11-15 stsp >> $testroot/content.expected
3090 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3091 0e039681 2021-11-15 stsp ls $testroot/wt/foo-orig-* >> $testroot/content.expected
3092 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
3093 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3094 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
3095 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
3096 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
3097 0e039681 2021-11-15 stsp
3098 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3099 49c543a6 2022-03-31 naddy ret=$?
3100 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3101 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3102 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3103 0e039681 2021-11-15 stsp return 1
3104 0e039681 2021-11-15 stsp fi
3105 0e039681 2021-11-15 stsp
3106 0e039681 2021-11-15 stsp cp /bin/cp $testroot/content.expected
3107 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3108 0e039681 2021-11-15 stsp cp $testroot/wt/foo-1-* $testroot/content
3109 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3110 49c543a6 2022-03-31 naddy ret=$?
3111 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3112 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3113 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3114 0e039681 2021-11-15 stsp return 1
3115 0e039681 2021-11-15 stsp fi
3116 0e039681 2021-11-15 stsp
3117 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
3118 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3119 0e039681 2021-11-15 stsp cp $testroot/wt/foo-2-* $testroot/content
3120 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3121 49c543a6 2022-03-31 naddy ret=$?
3122 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3123 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3124 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3125 0e039681 2021-11-15 stsp return 1
3126 0e039681 2021-11-15 stsp fi
3127 0e039681 2021-11-15 stsp
3128 0e039681 2021-11-15 stsp (cd $testroot/wt && got status > $testroot/stdout)
3129 d952957d 2023-02-19 mark echo 'C foo' > $testroot/stdout.expected
3130 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3131 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-1-* >> $testroot/stdout.expected)
3132 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3133 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
3134 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3135 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
3136 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3137 49c543a6 2022-03-31 naddy ret=$?
3138 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3139 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3140 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3141 0e039681 2021-11-15 stsp return 1
3142 0e039681 2021-11-15 stsp fi
3143 0e039681 2021-11-15 stsp
3144 0e039681 2021-11-15 stsp # tidy up
3145 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . > /dev/null)
3146 0e039681 2021-11-15 stsp rm $testroot/wt/foo-orig-* $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3147 0e039681 2021-11-15 stsp
3148 0e039681 2021-11-15 stsp # update which deletes a binary file
3149 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id4 > $testroot/stdout)
3150 0e039681 2021-11-15 stsp echo "D foo" > $testroot/stdout.expected
3151 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id4" \
3152 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3153 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3154 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3155 49c543a6 2022-03-31 naddy ret=$?
3156 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3157 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3158 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3159 0e039681 2021-11-15 stsp fi
3160 0e039681 2021-11-15 stsp
3161 0e039681 2021-11-15 stsp if [ -e $testroot/wt/foo ]; then
3162 0e039681 2021-11-15 stsp echo "removed file foo still exists on disk" >&2
3163 0e039681 2021-11-15 stsp test_done "$testroot" "1"
3164 0e039681 2021-11-15 stsp return 1
3165 0e039681 2021-11-15 stsp fi
3166 0e039681 2021-11-15 stsp test_done "$testroot" "0"
3167 67c65ed7 2021-09-14 tracey }
3168 b2b3fce1 2022-10-29 op
3169 b2b3fce1 2022-10-29 op test_update_umask() {
3170 b2b3fce1 2022-10-29 op local testroot=`test_init update_binary_file`
3171 b2b3fce1 2022-10-29 op
3172 b2b3fce1 2022-10-29 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
3173 b2b3fce1 2022-10-29 op ret=$?
3174 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3175 b2b3fce1 2022-10-29 op test_done "$testroot" "$ret"
3176 b2b3fce1 2022-10-29 op return 1
3177 b2b3fce1 2022-10-29 op fi
3178 b2b3fce1 2022-10-29 op
3179 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3180 b2b3fce1 2022-10-29 op
3181 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3182 b2b3fce1 2022-10-29 op (umask 022 && cd "$testroot/wt" && got update alpha) \
3183 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3184 b2b3fce1 2022-10-29 op ret=$?
3185 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3186 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3187 b2b3fce1 2022-10-29 op return 1
3188 b2b3fce1 2022-10-29 op fi
3189 67c65ed7 2021-09-14 tracey
3190 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-r--r--; then
3191 b2b3fce1 2022-10-29 op echo "alpha is not 0644" >&2
3192 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3193 b2b3fce1 2022-10-29 op return 1
3194 b2b3fce1 2022-10-29 op fi
3195 b2b3fce1 2022-10-29 op
3196 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3197 b2b3fce1 2022-10-29 op
3198 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3199 b2b3fce1 2022-10-29 op (umask 044 && cd "$testroot/wt" && got update alpha) \
3200 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3201 b2b3fce1 2022-10-29 op ret=$?
3202 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3203 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3204 b2b3fce1 2022-10-29 op return 1
3205 b2b3fce1 2022-10-29 op fi
3206 b2b3fce1 2022-10-29 op
3207 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
3208 b2b3fce1 2022-10-29 op echo "alpha is not 0600" >&2
3209 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3210 b2b3fce1 2022-10-29 op return 1
3211 b2b3fce1 2022-10-29 op fi
3212 b2b3fce1 2022-10-29 op
3213 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3214 b2b3fce1 2022-10-29 op
3215 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3216 b2b3fce1 2022-10-29 op (umask 222 && cd "$testroot/wt" && got update alpha) \
3217 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3218 b2b3fce1 2022-10-29 op ret=$?
3219 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3220 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3221 b2b3fce1 2022-10-29 op return 1
3222 b2b3fce1 2022-10-29 op fi
3223 b2b3fce1 2022-10-29 op
3224 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-r--r--r--; then
3225 b2b3fce1 2022-10-29 op echo "alpha is not 0444" >&2
3226 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3227 b2b3fce1 2022-10-29 op return 1;
3228 b2b3fce1 2022-10-29 op fi
3229 b2b3fce1 2022-10-29 op
3230 b2b3fce1 2022-10-29 op test_done "$testroot" 0
3231 b2b3fce1 2022-10-29 op }
3232 b2b3fce1 2022-10-29 op
3233 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3234 c84d8c75 2019-01-02 stsp run_test test_update_basic
3235 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
3236 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
3237 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
3238 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
3239 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
3240 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
3241 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
3242 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
3243 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
3244 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
3245 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
3246 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
3247 c3b9af18 2023-02-26 naddy run_test test_update_changes_file_to_dir
3248 d48a8086 2023-03-10 stsp run_test test_update_changes_dir_to_file
3249 07fa9365 2023-03-10 stsp run_test test_update_changes_modified_file_to_dir
3250 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
3251 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
3252 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
3253 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
3254 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
3255 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
3256 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
3257 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
3258 c4cdcb68 2019-04-03 stsp run_test test_update_partial
3259 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
3260 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
3261 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
3262 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
3263 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
3264 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
3265 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
3266 303e2782 2019-08-09 stsp run_test test_update_tag
3267 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
3268 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
3269 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
3270 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
3271 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
3272 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
3273 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
3274 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
3275 194cb7cb 2021-01-19 stsp run_test test_update_single_file
3276 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
3277 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction
3278 67c65ed7 2021-09-14 tracey run_test test_update_quiet
3279 0e039681 2021-11-15 stsp run_test test_update_binary_file
3280 b2b3fce1 2022-10-29 op run_test test_update_umask