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 c3b9af18 2023-02-26 naddy
677 07fa9365 2023-03-10 stsp test_update_changes_modified_file_to_dir() {
678 07fa9365 2023-03-10 stsp local testroot=`test_init update_changes_modified_file_to_dir`
679 07fa9365 2023-03-10 stsp
680 07fa9365 2023-03-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
681 07fa9365 2023-03-10 stsp ret=$?
682 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
683 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
684 07fa9365 2023-03-10 stsp return 1
685 07fa9365 2023-03-10 stsp fi
686 07fa9365 2023-03-10 stsp
687 07fa9365 2023-03-10 stsp git_rm $testroot/repo alpha
688 07fa9365 2023-03-10 stsp mkdir $testroot/repo/alpha
689 07fa9365 2023-03-10 stsp echo eta > $testroot/repo/alpha/eta
690 07fa9365 2023-03-10 stsp (cd $testroot/repo && git add alpha/eta)
691 07fa9365 2023-03-10 stsp git_commit $testroot/repo -m "changed alpha into directory"
692 07fa9365 2023-03-10 stsp
693 07fa9365 2023-03-10 stsp echo "modified alpha" >> $testroot/wt/alpha
694 07fa9365 2023-03-10 stsp cp $testroot/wt/alpha $testroot/wt/content.expected
695 07fa9365 2023-03-10 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
696 07fa9365 2023-03-10 stsp ret=$?
697 07fa9365 2023-03-10 stsp if [ $ret -eq 0 ]; then
698 07fa9365 2023-03-10 stsp echo "update succeeded unexpectedly" >&2
699 07fa9365 2023-03-10 stsp test_done "$testroot" "1"
700 07fa9365 2023-03-10 stsp return 1
701 07fa9365 2023-03-10 stsp fi
702 07fa9365 2023-03-10 stsp
703 07fa9365 2023-03-10 stsp echo "d alpha" > $testroot/stdout.expected
704 07fa9365 2023-03-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
705 07fa9365 2023-03-10 stsp ret=$?
706 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
707 07fa9365 2023-03-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
708 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
709 07fa9365 2023-03-10 stsp return 1
710 07fa9365 2023-03-10 stsp fi
711 07fa9365 2023-03-10 stsp
712 07fa9365 2023-03-10 stsp echo "got: alpha/eta: file is obstructed" > $testroot/stderr.expected
713 07fa9365 2023-03-10 stsp cmp -s $testroot/stderr.expected $testroot/stderr
714 07fa9365 2023-03-10 stsp ret=$?
715 07fa9365 2023-03-10 stsp if [ $ret -ne 0 ]; then
716 07fa9365 2023-03-10 stsp diff -u $testroot/stderr.expected $testroot/stderr
717 07fa9365 2023-03-10 stsp fi
718 07fa9365 2023-03-10 stsp test_done "$testroot" "$ret"
719 07fa9365 2023-03-10 stsp }
720 07fa9365 2023-03-10 stsp
721 f6cae3ed 2020-09-13 naddy test_update_merges_file_edits() {
722 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
723 6353ad76 2019-02-08 stsp
724 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
725 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
726 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
727 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
728 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
729 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
730 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
731 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
732 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
733 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
734 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
735 21908da4 2019-01-13 stsp
736 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
737 49c543a6 2022-03-31 naddy ret=$?
738 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
739 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
740 6353ad76 2019-02-08 stsp return 1
741 6353ad76 2019-02-08 stsp fi
742 6353ad76 2019-02-08 stsp
743 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
744 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
745 885e96df 2023-03-06 naddy ed -s $testroot/repo/numbers <<-\EOF
746 885e96df 2023-03-06 naddy ,s/2/22/
747 885e96df 2023-03-06 naddy w
748 885e96df 2023-03-06 naddy EOF
749 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
750 6353ad76 2019-02-08 stsp
751 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
752 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
753 885e96df 2023-03-06 naddy ed -s $testroot/wt/numbers <<-\EOF
754 885e96df 2023-03-06 naddy ,s/7/77/
755 885e96df 2023-03-06 naddy w
756 885e96df 2023-03-06 naddy EOF
757 6353ad76 2019-02-08 stsp
758 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
759 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
760 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
761 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
762 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
763 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
764 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
765 6353ad76 2019-02-08 stsp
766 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
767 6353ad76 2019-02-08 stsp
768 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
769 49c543a6 2022-03-31 naddy ret=$?
770 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
771 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
772 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
773 6353ad76 2019-02-08 stsp return 1
774 6353ad76 2019-02-08 stsp fi
775 6353ad76 2019-02-08 stsp
776 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
777 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
778 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
779 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
780 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
781 f69721c3 2019-10-21 stsp >> $testroot/content.expected
782 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
783 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
784 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
785 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
786 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
787 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
788 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
789 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
790 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
791 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
792 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
793 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
794 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
795 6353ad76 2019-02-08 stsp
796 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
797 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
798 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
799 6353ad76 2019-02-08 stsp
800 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
801 49c543a6 2022-03-31 naddy ret=$?
802 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
803 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
804 68ed9ba5 2019-02-10 stsp fi
805 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
806 68ed9ba5 2019-02-10 stsp }
807 68ed9ba5 2019-02-10 stsp
808 f6cae3ed 2020-09-13 naddy test_update_keeps_xbit() {
809 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
810 68ed9ba5 2019-02-10 stsp
811 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
812 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
813 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
814 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
815 68ed9ba5 2019-02-10 stsp
816 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
817 49c543a6 2022-03-31 naddy ret=$?
818 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
819 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
820 68ed9ba5 2019-02-10 stsp return 1
821 68ed9ba5 2019-02-10 stsp fi
822 68ed9ba5 2019-02-10 stsp
823 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
824 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
825 68ed9ba5 2019-02-10 stsp
826 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
827 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
828 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
829 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
830 68ed9ba5 2019-02-10 stsp
831 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
832 49c543a6 2022-03-31 naddy ret=$?
833 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
834 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
835 68ed9ba5 2019-02-10 stsp return 1
836 6353ad76 2019-02-08 stsp fi
837 68ed9ba5 2019-02-10 stsp
838 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
839 49c543a6 2022-03-31 naddy ret=$?
840 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
841 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
842 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
843 68ed9ba5 2019-02-10 stsp return 1
844 68ed9ba5 2019-02-10 stsp fi
845 68ed9ba5 2019-02-10 stsp
846 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
847 49c543a6 2022-03-31 naddy ret=$?
848 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
849 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
850 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
851 68ed9ba5 2019-02-10 stsp fi
852 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
853 6353ad76 2019-02-08 stsp }
854 ba8a0d4d 2019-02-10 stsp
855 f6cae3ed 2020-09-13 naddy test_update_clears_xbit() {
856 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
857 ba8a0d4d 2019-02-10 stsp
858 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
859 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
860 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
861 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
862 6353ad76 2019-02-08 stsp
863 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
864 49c543a6 2022-03-31 naddy ret=$?
865 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
866 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
867 ba8a0d4d 2019-02-10 stsp return 1
868 ba8a0d4d 2019-02-10 stsp fi
869 ba8a0d4d 2019-02-10 stsp
870 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
871 49c543a6 2022-03-31 naddy ret=$?
872 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
873 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
874 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
875 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
876 ba8a0d4d 2019-02-10 stsp return 1
877 ba8a0d4d 2019-02-10 stsp fi
878 ba8a0d4d 2019-02-10 stsp
879 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
880 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
881 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
882 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
883 ba8a0d4d 2019-02-10 stsp
884 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
885 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
886 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
887 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
888 ba8a0d4d 2019-02-10 stsp
889 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
890 49c543a6 2022-03-31 naddy ret=$?
891 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
892 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
893 ba8a0d4d 2019-02-10 stsp return 1
894 ba8a0d4d 2019-02-10 stsp fi
895 ba8a0d4d 2019-02-10 stsp
896 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
897 49c543a6 2022-03-31 naddy ret=$?
898 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
899 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
900 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
901 ba8a0d4d 2019-02-10 stsp return 1
902 ba8a0d4d 2019-02-10 stsp fi
903 ba8a0d4d 2019-02-10 stsp
904 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
905 49c543a6 2022-03-31 naddy ret=$?
906 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
907 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
908 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
909 ba8a0d4d 2019-02-10 stsp fi
910 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
911 ba8a0d4d 2019-02-10 stsp }
912 a378724f 2019-02-10 stsp
913 f6cae3ed 2020-09-13 naddy test_update_restores_missing_file() {
914 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
915 a378724f 2019-02-10 stsp
916 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
917 49c543a6 2022-03-31 naddy ret=$?
918 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
919 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
920 a378724f 2019-02-10 stsp return 1
921 a378724f 2019-02-10 stsp fi
922 ba8a0d4d 2019-02-10 stsp
923 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
924 a378724f 2019-02-10 stsp
925 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
926 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
927 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
928 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
929 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
930 a378724f 2019-02-10 stsp
931 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
932 49c543a6 2022-03-31 naddy ret=$?
933 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
934 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
935 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
936 a378724f 2019-02-10 stsp return 1
937 a378724f 2019-02-10 stsp fi
938 a378724f 2019-02-10 stsp
939 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
940 a378724f 2019-02-10 stsp
941 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
942 1430b4e0 2019-03-27 stsp
943 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
944 49c543a6 2022-03-31 naddy ret=$?
945 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
946 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
947 1430b4e0 2019-03-27 stsp fi
948 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
949 1430b4e0 2019-03-27 stsp }
950 1430b4e0 2019-03-27 stsp
951 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_add_vs_repo_add() {
952 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
953 1430b4e0 2019-03-27 stsp
954 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
955 49c543a6 2022-03-31 naddy ret=$?
956 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
957 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
958 1430b4e0 2019-03-27 stsp return 1
959 1430b4e0 2019-03-27 stsp fi
960 1430b4e0 2019-03-27 stsp
961 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
962 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
963 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
964 1430b4e0 2019-03-27 stsp
965 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
966 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
967 1430b4e0 2019-03-27 stsp
968 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
969 a378724f 2019-02-10 stsp
970 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
971 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
972 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
973 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
974 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
975 9627c110 2020-04-18 stsp
976 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
977 49c543a6 2022-03-31 naddy ret=$?
978 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
979 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
980 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
981 1430b4e0 2019-03-27 stsp return 1
982 1430b4e0 2019-03-27 stsp fi
983 1430b4e0 2019-03-27 stsp
984 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
985 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
986 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
987 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
988 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
989 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
990 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
991 1430b4e0 2019-03-27 stsp
992 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
993 1430b4e0 2019-03-27 stsp
994 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
995 49c543a6 2022-03-31 naddy ret=$?
996 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
997 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
998 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
999 3165301c 2019-03-27 stsp return 1
1000 3165301c 2019-03-27 stsp fi
1001 3165301c 2019-03-27 stsp
1002 3165301c 2019-03-27 stsp # resolve the conflict
1003 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
1004 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
1005 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1006 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1007 49c543a6 2022-03-31 naddy ret=$?
1008 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1009 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1010 a378724f 2019-02-10 stsp fi
1011 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
1012 a378724f 2019-02-10 stsp }
1013 708d8e67 2019-03-27 stsp
1014 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_edit_vs_repo_rm() {
1015 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
1016 708d8e67 2019-03-27 stsp
1017 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1018 49c543a6 2022-03-31 naddy ret=$?
1019 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1020 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1021 708d8e67 2019-03-27 stsp return 1
1022 708d8e67 2019-03-27 stsp fi
1023 708d8e67 2019-03-27 stsp
1024 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1025 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1026 708d8e67 2019-03-27 stsp
1027 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
1028 a378724f 2019-02-10 stsp
1029 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1030 708d8e67 2019-03-27 stsp
1031 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1032 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1033 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1034 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
1035 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1036 49c543a6 2022-03-31 naddy ret=$?
1037 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1038 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1039 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1040 708d8e67 2019-03-27 stsp return 1
1041 708d8e67 2019-03-27 stsp fi
1042 708d8e67 2019-03-27 stsp
1043 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
1044 708d8e67 2019-03-27 stsp
1045 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
1046 708d8e67 2019-03-27 stsp
1047 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1048 49c543a6 2022-03-31 naddy ret=$?
1049 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1050 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
1051 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1052 708d8e67 2019-03-27 stsp return 1
1053 708d8e67 2019-03-27 stsp fi
1054 708d8e67 2019-03-27 stsp
1055 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
1056 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
1057 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1058 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1059 49c543a6 2022-03-31 naddy ret=$?
1060 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1061 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1062 13d9040b 2019-03-27 stsp fi
1063 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1064 13d9040b 2019-03-27 stsp }
1065 13d9040b 2019-03-27 stsp
1066 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_edit() {
1067 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
1068 13d9040b 2019-03-27 stsp
1069 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1070 49c543a6 2022-03-31 naddy ret=$?
1071 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1072 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1073 13d9040b 2019-03-27 stsp return 1
1074 13d9040b 2019-03-27 stsp fi
1075 13d9040b 2019-03-27 stsp
1076 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
1077 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
1078 13d9040b 2019-03-27 stsp
1079 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1080 13d9040b 2019-03-27 stsp
1081 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1082 13d9040b 2019-03-27 stsp
1083 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
1084 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1085 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1086 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
1087 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1088 49c543a6 2022-03-31 naddy ret=$?
1089 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1090 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1091 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1092 13d9040b 2019-03-27 stsp return 1
1093 13d9040b 2019-03-27 stsp fi
1094 13d9040b 2019-03-27 stsp
1095 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1096 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1097 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1098 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1099 49c543a6 2022-03-31 naddy ret=$?
1100 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1101 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1102 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1103 13d9040b 2019-03-27 stsp return 1
1104 708d8e67 2019-03-27 stsp fi
1105 13d9040b 2019-03-27 stsp
1106 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1107 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1108 8469d821 2022-06-25 stsp echo "diff $testroot/wt" > $testroot/stdout.expected
1109 8469d821 2022-06-25 stsp echo "commit - $head_rev" >> $testroot/stdout.expected
1110 8469d821 2022-06-25 stsp echo "path + $testroot/wt" >> $testroot/stdout.expected
1111 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1112 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1113 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1114 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1115 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1116 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
1117 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1118 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1119 13d9040b 2019-03-27 stsp
1120 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1121 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1122 49c543a6 2022-03-31 naddy ret=$?
1123 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1124 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1125 13d9040b 2019-03-27 stsp fi
1126 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1127 66b11bf5 2019-03-27 stsp }
1128 66b11bf5 2019-03-27 stsp
1129 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_rm_vs_repo_rm() {
1130 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1131 66b11bf5 2019-03-27 stsp
1132 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1133 49c543a6 2022-03-31 naddy ret=$?
1134 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1135 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1136 66b11bf5 2019-03-27 stsp return 1
1137 66b11bf5 2019-03-27 stsp fi
1138 66b11bf5 2019-03-27 stsp
1139 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1140 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1141 66b11bf5 2019-03-27 stsp
1142 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1143 66b11bf5 2019-03-27 stsp
1144 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1145 66b11bf5 2019-03-27 stsp
1146 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1147 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1148 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1149 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1150 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1151 49c543a6 2022-03-31 naddy ret=$?
1152 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1153 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1154 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1155 66b11bf5 2019-03-27 stsp return 1
1156 66b11bf5 2019-03-27 stsp fi
1157 66b11bf5 2019-03-27 stsp
1158 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1159 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1160 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1161 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1162 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1163 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1164 49c543a6 2022-03-31 naddy ret=$?
1165 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1166 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1167 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1168 54817d72 2019-07-27 stsp return 1
1169 54817d72 2019-07-27 stsp fi
1170 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1171 49c543a6 2022-03-31 naddy ret=$?
1172 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1173 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1174 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1175 66b11bf5 2019-03-27 stsp return 1
1176 66b11bf5 2019-03-27 stsp fi
1177 66b11bf5 2019-03-27 stsp
1178 66b11bf5 2019-03-27 stsp if [ -e $testroot/wt/beta ]; then
1179 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1180 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1181 66b11bf5 2019-03-27 stsp return 1
1182 66b11bf5 2019-03-27 stsp fi
1183 66b11bf5 2019-03-27 stsp
1184 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1185 708d8e67 2019-03-27 stsp }
1186 c4cdcb68 2019-04-03 stsp
1187 f6cae3ed 2020-09-13 naddy test_update_partial() {
1188 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1189 c4cdcb68 2019-04-03 stsp
1190 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1191 49c543a6 2022-03-31 naddy ret=$?
1192 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1193 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1194 c4cdcb68 2019-04-03 stsp return 1
1195 c4cdcb68 2019-04-03 stsp fi
1196 708d8e67 2019-03-27 stsp
1197 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1198 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1199 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1200 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1201 c4cdcb68 2019-04-03 stsp
1202 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1203 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1204 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1205 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1206 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1207 c4cdcb68 2019-04-03 stsp
1208 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1209 c4cdcb68 2019-04-03 stsp
1210 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1211 49c543a6 2022-03-31 naddy ret=$?
1212 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1213 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1214 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1215 f2ea84fa 2019-07-27 stsp return 1
1216 f2ea84fa 2019-07-27 stsp fi
1217 c4cdcb68 2019-04-03 stsp
1218 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1219 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1220 f2ea84fa 2019-07-27 stsp
1221 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1222 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1223 49c543a6 2022-03-31 naddy ret=$?
1224 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1225 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1226 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1227 f2ea84fa 2019-07-27 stsp return 1
1228 f2ea84fa 2019-07-27 stsp fi
1229 e4d984c2 2019-05-22 stsp
1230 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1231 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1232 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1233 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1234 e4d984c2 2019-05-22 stsp
1235 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1236 e4d984c2 2019-05-22 stsp
1237 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1238 49c543a6 2022-03-31 naddy ret=$?
1239 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1240 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1241 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1242 e4d984c2 2019-05-22 stsp return 1
1243 e4d984c2 2019-05-22 stsp fi
1244 e4d984c2 2019-05-22 stsp
1245 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1246 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1247 e4d984c2 2019-05-22 stsp
1248 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1249 49c543a6 2022-03-31 naddy ret=$?
1250 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1251 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1252 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1253 e4d984c2 2019-05-22 stsp return 1
1254 e4d984c2 2019-05-22 stsp fi
1255 e4d984c2 2019-05-22 stsp
1256 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1257 c4cdcb68 2019-04-03 stsp }
1258 c4cdcb68 2019-04-03 stsp
1259 f6cae3ed 2020-09-13 naddy test_update_partial_add() {
1260 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
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 c4cdcb68 2019-04-03 stsp
1269 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1270 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1271 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1272 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1273 c4cdcb68 2019-04-03 stsp
1274 10a623df 2021-10-11 stsp echo "A epsilon/new2" > $testroot/stdout.expected
1275 10a623df 2021-10-11 stsp echo "A new" >> $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 new epsilon/new2 > $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 "new" > $testroot/content.expected
1291 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1292 c4cdcb68 2019-04-03 stsp
1293 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1294 f2ea84fa 2019-07-27 stsp
1295 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1296 49c543a6 2022-03-31 naddy ret=$?
1297 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1298 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1299 f2ea84fa 2019-07-27 stsp fi
1300 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1301 c4cdcb68 2019-04-03 stsp }
1302 c4cdcb68 2019-04-03 stsp
1303 f6cae3ed 2020-09-13 naddy test_update_partial_rm() {
1304 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1305 c4cdcb68 2019-04-03 stsp
1306 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1307 49c543a6 2022-03-31 naddy ret=$?
1308 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1309 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1310 c4cdcb68 2019-04-03 stsp return 1
1311 c4cdcb68 2019-04-03 stsp fi
1312 c4cdcb68 2019-04-03 stsp
1313 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1314 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1315 c4cdcb68 2019-04-03 stsp
1316 b66cd6f3 2020-07-31 stsp echo "got: /alpha: no such entry found in tree" \
1317 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1318 f2ea84fa 2019-07-27 stsp
1319 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1320 49c543a6 2022-03-31 naddy ret=$?
1321 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
1322 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1323 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1324 f2ea84fa 2019-07-27 stsp return 1
1325 f2ea84fa 2019-07-27 stsp fi
1326 c4cdcb68 2019-04-03 stsp
1327 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1328 49c543a6 2022-03-31 naddy ret=$?
1329 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1330 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1331 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1332 f2ea84fa 2019-07-27 stsp return 1
1333 f2ea84fa 2019-07-27 stsp fi
1334 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1335 c4cdcb68 2019-04-03 stsp }
1336 c4cdcb68 2019-04-03 stsp
1337 f6cae3ed 2020-09-13 naddy test_update_partial_dir() {
1338 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1339 c4cdcb68 2019-04-03 stsp
1340 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1341 49c543a6 2022-03-31 naddy ret=$?
1342 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1343 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1344 c4cdcb68 2019-04-03 stsp return 1
1345 c4cdcb68 2019-04-03 stsp fi
1346 c4cdcb68 2019-04-03 stsp
1347 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1348 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1349 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1350 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1351 c4cdcb68 2019-04-03 stsp
1352 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1353 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1354 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1355 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1356 c4cdcb68 2019-04-03 stsp
1357 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1358 c4cdcb68 2019-04-03 stsp
1359 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1360 49c543a6 2022-03-31 naddy ret=$?
1361 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1362 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1363 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1364 c4cdcb68 2019-04-03 stsp return 1
1365 c4cdcb68 2019-04-03 stsp fi
1366 c4cdcb68 2019-04-03 stsp
1367 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1368 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1369 c4cdcb68 2019-04-03 stsp
1370 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1371 49c543a6 2022-03-31 naddy ret=$?
1372 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1373 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1374 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1375 c4cdcb68 2019-04-03 stsp return 1
1376 c4cdcb68 2019-04-03 stsp fi
1377 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1378 d5bea539 2019-05-13 stsp
1379 d5bea539 2019-05-13 stsp }
1380 d5bea539 2019-05-13 stsp
1381 f6cae3ed 2020-09-13 naddy test_update_moved_branch_ref() {
1382 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1383 d5bea539 2019-05-13 stsp
1384 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1385 d5bea539 2019-05-13 stsp
1386 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1387 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1388 d5bea539 2019-05-13 stsp
1389 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1390 49c543a6 2022-03-31 naddy ret=$?
1391 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1392 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1393 d5bea539 2019-05-13 stsp return 1
1394 d5bea539 2019-05-13 stsp fi
1395 d5bea539 2019-05-13 stsp
1396 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1397 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1398 d5bea539 2019-05-13 stsp
1399 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1400 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1401 c4cdcb68 2019-04-03 stsp
1402 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1403 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1404 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1405 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1406 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1407 d5bea539 2019-05-13 stsp
1408 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1409 d5bea539 2019-05-13 stsp
1410 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1411 49c543a6 2022-03-31 naddy ret=$?
1412 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1413 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1414 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1415 d5bea539 2019-05-13 stsp return 1
1416 d5bea539 2019-05-13 stsp fi
1417 d5bea539 2019-05-13 stsp
1418 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1419 49c543a6 2022-03-31 naddy ret=$?
1420 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1421 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1422 d5bea539 2019-05-13 stsp fi
1423 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1424 c4cdcb68 2019-04-03 stsp }
1425 024e9686 2019-05-14 stsp
1426 f6cae3ed 2020-09-13 naddy test_update_to_another_branch() {
1427 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1428 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1429 024e9686 2019-05-14 stsp
1430 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1431 49c543a6 2022-03-31 naddy ret=$?
1432 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1433 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1434 024e9686 2019-05-14 stsp return 1
1435 024e9686 2019-05-14 stsp fi
1436 024e9686 2019-05-14 stsp
1437 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1438 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1439 49c543a6 2022-03-31 naddy ret=$?
1440 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1441 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1442 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1443 024e9686 2019-05-14 stsp return 1
1444 024e9686 2019-05-14 stsp fi
1445 024e9686 2019-05-14 stsp
1446 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1447 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1448 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1449 024e9686 2019-05-14 stsp
1450 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1451 024e9686 2019-05-14 stsp
1452 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1453 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1454 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/newbranch: " >> $testroot/stdout.expected
1455 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1456 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1457 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1458 024e9686 2019-05-14 stsp
1459 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1460 024e9686 2019-05-14 stsp
1461 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1462 49c543a6 2022-03-31 naddy ret=$?
1463 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1464 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1465 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1466 024e9686 2019-05-14 stsp return 1
1467 024e9686 2019-05-14 stsp fi
1468 c4cdcb68 2019-04-03 stsp
1469 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1470 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1471 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1472 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1473 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1474 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1475 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1476 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1477 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1478 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1479 d5bea539 2019-05-13 stsp
1480 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1481 024e9686 2019-05-14 stsp
1482 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1483 49c543a6 2022-03-31 naddy ret=$?
1484 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1485 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1486 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1487 024e9686 2019-05-14 stsp return 1
1488 024e9686 2019-05-14 stsp fi
1489 024e9686 2019-05-14 stsp
1490 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1491 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1492 49c543a6 2022-03-31 naddy ret=$?
1493 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1494 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1495 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1496 a367ff0f 2019-05-14 stsp return 1
1497 a367ff0f 2019-05-14 stsp fi
1498 a367ff0f 2019-05-14 stsp
1499 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1500 a367ff0f 2019-05-14 stsp }
1501 a367ff0f 2019-05-14 stsp
1502 f6cae3ed 2020-09-13 naddy test_update_to_commit_on_wrong_branch() {
1503 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1504 a367ff0f 2019-05-14 stsp
1505 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1506 49c543a6 2022-03-31 naddy ret=$?
1507 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1508 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1509 a367ff0f 2019-05-14 stsp return 1
1510 a367ff0f 2019-05-14 stsp fi
1511 a367ff0f 2019-05-14 stsp
1512 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1513 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1514 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1515 a367ff0f 2019-05-14 stsp
1516 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1517 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1518 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1519 a367ff0f 2019-05-14 stsp
1520 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1521 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1522 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1523 a367ff0f 2019-05-14 stsp
1524 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1525 49c543a6 2022-03-31 naddy ret=$?
1526 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1527 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1528 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1529 024e9686 2019-05-14 stsp return 1
1530 024e9686 2019-05-14 stsp fi
1531 024e9686 2019-05-14 stsp
1532 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1533 49c543a6 2022-03-31 naddy ret=$?
1534 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1535 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1536 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1537 a367ff0f 2019-05-14 stsp return 1
1538 a367ff0f 2019-05-14 stsp fi
1539 a367ff0f 2019-05-14 stsp
1540 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1541 024e9686 2019-05-14 stsp }
1542 c932eeeb 2019-05-22 stsp
1543 f6cae3ed 2020-09-13 naddy test_update_bumps_base_commit_id() {
1544 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1545 c932eeeb 2019-05-22 stsp
1546 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1547 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1548 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1549 1a36436d 2019-06-10 stsp
1550 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1551 49c543a6 2022-03-31 naddy ret=$?
1552 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1553 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1554 c932eeeb 2019-05-22 stsp return 1
1555 c932eeeb 2019-05-22 stsp fi
1556 024e9686 2019-05-14 stsp
1557 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1558 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1559 c932eeeb 2019-05-22 stsp
1560 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1561 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1562 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1563 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1564 49c543a6 2022-03-31 naddy ret=$?
1565 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1566 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1567 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1568 c932eeeb 2019-05-22 stsp return 1
1569 c932eeeb 2019-05-22 stsp fi
1570 9bead371 2019-07-28 stsp
1571 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1572 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1573 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1574 c932eeeb 2019-05-22 stsp
1575 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1576 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1577 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1578 c932eeeb 2019-05-22 stsp
1579 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1580 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1581 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1582 49c543a6 2022-03-31 naddy ret=$?
1583 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1584 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1585 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1586 c932eeeb 2019-05-22 stsp return 1
1587 c932eeeb 2019-05-22 stsp fi
1588 c932eeeb 2019-05-22 stsp
1589 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1590 c932eeeb 2019-05-22 stsp
1591 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1592 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1593 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1594 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1595 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1596 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1597 9627c110 2020-04-18 stsp
1598 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1599 49c543a6 2022-03-31 naddy ret=$?
1600 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1601 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1602 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1603 c932eeeb 2019-05-22 stsp return 1
1604 c932eeeb 2019-05-22 stsp fi
1605 c932eeeb 2019-05-22 stsp
1606 9bead371 2019-07-28 stsp # resolve conflict
1607 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1608 9bead371 2019-07-28 stsp
1609 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1610 c932eeeb 2019-05-22 stsp
1611 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1612 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1613 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1614 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1615 49c543a6 2022-03-31 naddy ret=$?
1616 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1617 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1618 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1619 303e2782 2019-08-09 stsp return 1
1620 303e2782 2019-08-09 stsp fi
1621 303e2782 2019-08-09 stsp
1622 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1623 303e2782 2019-08-09 stsp }
1624 303e2782 2019-08-09 stsp
1625 f6cae3ed 2020-09-13 naddy test_update_tag() {
1626 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1627 303e2782 2019-08-09 stsp local tag="1.0.0"
1628 303e2782 2019-08-09 stsp
1629 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1630 49c543a6 2022-03-31 naddy ret=$?
1631 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1632 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1633 303e2782 2019-08-09 stsp return 1
1634 303e2782 2019-08-09 stsp fi
1635 303e2782 2019-08-09 stsp
1636 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1637 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1638 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1639 303e2782 2019-08-09 stsp
1640 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1641 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1642 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1643 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1644 303e2782 2019-08-09 stsp
1645 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1646 303e2782 2019-08-09 stsp
1647 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1648 49c543a6 2022-03-31 naddy ret=$?
1649 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1650 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1651 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1652 c932eeeb 2019-05-22 stsp return 1
1653 c932eeeb 2019-05-22 stsp fi
1654 c932eeeb 2019-05-22 stsp
1655 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1656 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1657 303e2782 2019-08-09 stsp
1658 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1659 49c543a6 2022-03-31 naddy ret=$?
1660 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1661 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1662 523b8417 2019-10-19 stsp fi
1663 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1664 523b8417 2019-10-19 stsp }
1665 523b8417 2019-10-19 stsp
1666 f6cae3ed 2020-09-13 naddy test_update_toggles_xbit() {
1667 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1668 523b8417 2019-10-19 stsp
1669 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1670 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1671 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1672 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1673 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1674 523b8417 2019-10-19 stsp
1675 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1676 49c543a6 2022-03-31 naddy ret=$?
1677 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1678 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1679 523b8417 2019-10-19 stsp return 1
1680 523b8417 2019-10-19 stsp fi
1681 523b8417 2019-10-19 stsp
1682 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1683 49c543a6 2022-03-31 naddy ret=$?
1684 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1685 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1686 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1687 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1688 523b8417 2019-10-19 stsp return 1
1689 523b8417 2019-10-19 stsp fi
1690 523b8417 2019-10-19 stsp
1691 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1692 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1693 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1694 523b8417 2019-10-19 stsp
1695 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1696 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1697 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1698 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1699 523b8417 2019-10-19 stsp
1700 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1701 49c543a6 2022-03-31 naddy ret=$?
1702 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1703 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1704 523b8417 2019-10-19 stsp return 1
1705 523b8417 2019-10-19 stsp fi
1706 523b8417 2019-10-19 stsp
1707 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1708 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
1709 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1710 49c543a6 2022-03-31 naddy ret=$?
1711 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1712 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1713 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1714 523b8417 2019-10-19 stsp return 1
1715 303e2782 2019-08-09 stsp fi
1716 523b8417 2019-10-19 stsp
1717 523b8417 2019-10-19 stsp
1718 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1719 49c543a6 2022-03-31 naddy ret=$?
1720 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1721 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1722 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1723 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1724 523b8417 2019-10-19 stsp return 1
1725 523b8417 2019-10-19 stsp fi
1726 523b8417 2019-10-19 stsp
1727 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1728 49c543a6 2022-03-31 naddy ret=$?
1729 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1730 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1731 523b8417 2019-10-19 stsp return 1
1732 523b8417 2019-10-19 stsp fi
1733 523b8417 2019-10-19 stsp
1734 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1735 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
1736 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
1737 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1738 49c543a6 2022-03-31 naddy ret=$?
1739 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1740 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1741 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1742 523b8417 2019-10-19 stsp return 1
1743 523b8417 2019-10-19 stsp fi
1744 523b8417 2019-10-19 stsp
1745 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1746 49c543a6 2022-03-31 naddy ret=$?
1747 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1748 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1749 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1750 5036ab18 2020-04-18 stsp fi
1751 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1752 5036ab18 2020-04-18 stsp }
1753 5036ab18 2020-04-18 stsp
1754 f6cae3ed 2020-09-13 naddy test_update_preserves_conflicted_file() {
1755 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1756 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1757 5036ab18 2020-04-18 stsp
1758 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1759 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1760 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1761 5036ab18 2020-04-18 stsp
1762 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1763 49c543a6 2022-03-31 naddy ret=$?
1764 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1765 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1766 5036ab18 2020-04-18 stsp return 1
1767 5036ab18 2020-04-18 stsp fi
1768 5036ab18 2020-04-18 stsp
1769 5036ab18 2020-04-18 stsp # fake a merge conflict
1770 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1771 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1772 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1773 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1774 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1775 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1776 5036ab18 2020-04-18 stsp
1777 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1778 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1779 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1780 49c543a6 2022-03-31 naddy ret=$?
1781 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1782 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1783 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1784 5036ab18 2020-04-18 stsp return 1
1785 523b8417 2019-10-19 stsp fi
1786 5036ab18 2020-04-18 stsp
1787 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1788 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1789 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1790 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1791 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1792 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1793 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1794 5036ab18 2020-04-18 stsp
1795 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1796 49c543a6 2022-03-31 naddy ret=$?
1797 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1798 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1799 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1800 5036ab18 2020-04-18 stsp return 1
1801 5036ab18 2020-04-18 stsp fi
1802 5036ab18 2020-04-18 stsp
1803 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1804 49c543a6 2022-03-31 naddy ret=$?
1805 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1806 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1807 5036ab18 2020-04-18 stsp fi
1808 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1809 c932eeeb 2019-05-22 stsp }
1810 e7303626 2020-05-14 stsp
1811 f6cae3ed 2020-09-13 naddy test_update_modified_submodules() {
1812 e7303626 2020-05-14 stsp local testroot=`test_init update_modified_submodules`
1813 e7303626 2020-05-14 stsp
1814 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1815 e7303626 2020-05-14 stsp
1816 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1817 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1818 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1819 c932eeeb 2019-05-22 stsp
1820 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1821 e7303626 2020-05-14 stsp
1822 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1823 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1824 e7303626 2020-05-14 stsp
1825 e7303626 2020-05-14 stsp # Update the repo/repo2 submodule link
1826 e7303626 2020-05-14 stsp (cd $testroot/repo && git -C repo2 pull -q)
1827 e7303626 2020-05-14 stsp (cd $testroot/repo && git add repo2)
1828 e7303626 2020-05-14 stsp git_commit $testroot/repo -m "modified submodule link"
1829 e7303626 2020-05-14 stsp
1830 e7303626 2020-05-14 stsp # This update only records the new base commit. Otherwise it is a
1831 e7303626 2020-05-14 stsp # no-op change because Got's file index does not track submodules.
1832 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " > $testroot/stdout.expected
1833 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1834 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1835 e7303626 2020-05-14 stsp
1836 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1837 e7303626 2020-05-14 stsp
1838 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1839 49c543a6 2022-03-31 naddy ret=$?
1840 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1841 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1842 e7303626 2020-05-14 stsp fi
1843 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1844 e7303626 2020-05-14 stsp }
1845 e7303626 2020-05-14 stsp
1846 f6cae3ed 2020-09-13 naddy test_update_adds_submodule() {
1847 e7303626 2020-05-14 stsp local testroot=`test_init update_adds_submodule`
1848 e7303626 2020-05-14 stsp
1849 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1850 e7303626 2020-05-14 stsp
1851 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1852 e7303626 2020-05-14 stsp
1853 e7303626 2020-05-14 stsp echo "modified foo" > $testroot/repo2/foo
1854 e7303626 2020-05-14 stsp (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule')
1855 e7303626 2020-05-14 stsp
1856 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1857 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1858 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1859 e7303626 2020-05-14 stsp
1860 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1861 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1862 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1863 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1864 e7303626 2020-05-14 stsp
1865 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1866 e7303626 2020-05-14 stsp
1867 e7303626 2020-05-14 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 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1871 e7303626 2020-05-14 stsp fi
1872 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1873 e7303626 2020-05-14 stsp }
1874 e7303626 2020-05-14 stsp
1875 f6cae3ed 2020-09-13 naddy test_update_conflict_wt_file_vs_repo_submodule() {
1876 e7303626 2020-05-14 stsp local testroot=`test_init update_conflict_wt_file_vs_repo_submodule`
1877 e7303626 2020-05-14 stsp
1878 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1879 e7303626 2020-05-14 stsp
1880 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1881 e7303626 2020-05-14 stsp
1882 e7303626 2020-05-14 stsp # Add a file which will clash with the submodule
1883 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
1884 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
1885 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' > /dev/null)
1886 49c543a6 2022-03-31 naddy ret=$?
1887 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1888 e7303626 2020-05-14 stsp echo "commit failed unexpectedly" >&2
1889 e7303626 2020-05-14 stsp test_done "$testroot" "1"
1890 e7303626 2020-05-14 stsp return 1
1891 e7303626 2020-05-14 stsp fi
1892 e7303626 2020-05-14 stsp
1893 f1aec6ed 2022-10-24 stsp (cd $testroot/repo && git -c protocol.file.allow=always \
1894 f1aec6ed 2022-10-24 stsp submodule -q add ../repo2)
1895 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1896 e7303626 2020-05-14 stsp
1897 e7303626 2020-05-14 stsp # Modify the clashing file such that any modifications brought
1898 e7303626 2020-05-14 stsp # in by 'got update' would require a merge.
1899 e7303626 2020-05-14 stsp echo "This file was changed" > $testroot/wt/repo2
1900 e7303626 2020-05-14 stsp
1901 e7303626 2020-05-14 stsp # No conflict occurs because 'got update' ignores the submodule
1902 e7303626 2020-05-14 stsp # and leaves the clashing file as it was.
1903 e7303626 2020-05-14 stsp echo "A .gitmodules" > $testroot/stdout.expected
1904 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1905 e7303626 2020-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1906 e7303626 2020-05-14 stsp echo >> $testroot/stdout.expected
1907 e7303626 2020-05-14 stsp
1908 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > $testroot/stdout)
1909 e7303626 2020-05-14 stsp
1910 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1911 49c543a6 2022-03-31 naddy ret=$?
1912 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1913 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1914 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1915 e7303626 2020-05-14 stsp return 1
1916 e7303626 2020-05-14 stsp fi
1917 e7303626 2020-05-14 stsp
1918 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
1919 e7303626 2020-05-14 stsp
1920 e7303626 2020-05-14 stsp echo "M repo2" > $testroot/stdout.expected
1921 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1922 49c543a6 2022-03-31 naddy ret=$?
1923 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1924 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1925 e7303626 2020-05-14 stsp fi
1926 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1927 e7303626 2020-05-14 stsp }
1928 f35fa46a 2020-07-23 stsp
1929 f6cae3ed 2020-09-13 naddy test_update_adds_symlink() {
1930 f35fa46a 2020-07-23 stsp local testroot=`test_init update_adds_symlink`
1931 f35fa46a 2020-07-23 stsp
1932 f35fa46a 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1933 49c543a6 2022-03-31 naddy ret=$?
1934 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1935 f35fa46a 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
1936 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1937 f35fa46a 2020-07-23 stsp return 1
1938 f35fa46a 2020-07-23 stsp fi
1939 f35fa46a 2020-07-23 stsp
1940 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1941 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1942 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1943 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1944 f35fa46a 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1945 f35fa46a 2020-07-23 stsp (cd $testroot/repo && git add .)
1946 f35fa46a 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1947 f35fa46a 2020-07-23 stsp
1948 f35fa46a 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
1949 f35fa46a 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
1950 f35fa46a 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
1951 f35fa46a 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
1952 f35fa46a 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
1953 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
1954 f35fa46a 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1955 f35fa46a 2020-07-23 stsp echo >> $testroot/stdout.expected
1956 f35fa46a 2020-07-23 stsp
1957 f35fa46a 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
1958 f35fa46a 2020-07-23 stsp
1959 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1960 49c543a6 2022-03-31 naddy ret=$?
1961 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1962 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1963 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1964 f35fa46a 2020-07-23 stsp return 1
1965 f35fa46a 2020-07-23 stsp fi
1966 f35fa46a 2020-07-23 stsp
1967 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1968 f35fa46a 2020-07-23 stsp echo "alpha.link is not a symlink"
1969 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1970 f35fa46a 2020-07-23 stsp return 1
1971 f35fa46a 2020-07-23 stsp fi
1972 f35fa46a 2020-07-23 stsp
1973 f35fa46a 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1974 f35fa46a 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1975 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1976 49c543a6 2022-03-31 naddy ret=$?
1977 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1978 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1979 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1980 f35fa46a 2020-07-23 stsp return 1
1981 f35fa46a 2020-07-23 stsp fi
1982 f35fa46a 2020-07-23 stsp
1983 f35fa46a 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1984 f35fa46a 2020-07-23 stsp echo "epsilon.link is not a symlink"
1985 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
1986 f35fa46a 2020-07-23 stsp return 1
1987 f35fa46a 2020-07-23 stsp fi
1988 e7303626 2020-05-14 stsp
1989 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1990 f35fa46a 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1991 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1992 49c543a6 2022-03-31 naddy ret=$?
1993 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1994 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1995 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
1996 f35fa46a 2020-07-23 stsp return 1
1997 f35fa46a 2020-07-23 stsp fi
1998 e7303626 2020-05-14 stsp
1999 f35fa46a 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2000 f35fa46a 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2001 f35fa46a 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2002 f35fa46a 2020-07-23 stsp test_done "$testroot" "1"
2003 f35fa46a 2020-07-23 stsp return 1
2004 f35fa46a 2020-07-23 stsp fi
2005 f35fa46a 2020-07-23 stsp
2006 f35fa46a 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2007 f35fa46a 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2008 f35fa46a 2020-07-23 stsp
2009 f35fa46a 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2010 49c543a6 2022-03-31 naddy ret=$?
2011 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2012 f35fa46a 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2013 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2014 f35fa46a 2020-07-23 stsp return 1
2015 f35fa46a 2020-07-23 stsp fi
2016 f35fa46a 2020-07-23 stsp
2017 f35fa46a 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
2018 f35fa46a 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
2019 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2020 49c543a6 2022-03-31 naddy ret=$?
2021 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2022 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2023 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2024 f35fa46a 2020-07-23 stsp return 1
2025 f35fa46a 2020-07-23 stsp fi
2026 f35fa46a 2020-07-23 stsp
2027 f35fa46a 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
2028 f35fa46a 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
2029 f35fa46a 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2030 49c543a6 2022-03-31 naddy ret=$?
2031 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2032 f35fa46a 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2033 c6e8a826 2021-04-05 stsp test_done "$testroot" "$ret"
2034 c6e8a826 2021-04-05 stsp return 1
2035 f35fa46a 2020-07-23 stsp fi
2036 c6e8a826 2021-04-05 stsp
2037 c6e8a826 2021-04-05 stsp # Updating an up-to-date symlink should be a no-op.
2038 c6e8a826 2021-04-05 stsp echo 'Already up-to-date' > $testroot/stdout.expected
2039 c6e8a826 2021-04-05 stsp (cd $testroot/wt && got update > $testroot/stdout)
2040 c6e8a826 2021-04-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2041 49c543a6 2022-03-31 naddy ret=$?
2042 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2043 c6e8a826 2021-04-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
2044 c6e8a826 2021-04-05 stsp fi
2045 f35fa46a 2020-07-23 stsp test_done "$testroot" "$ret"
2046 993e2a1b 2020-07-23 stsp }
2047 993e2a1b 2020-07-23 stsp
2048 f6cae3ed 2020-09-13 naddy test_update_deletes_symlink() {
2049 993e2a1b 2020-07-23 stsp local testroot=`test_init update_deletes_symlink`
2050 993e2a1b 2020-07-23 stsp
2051 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2052 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2053 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlink"
2054 993e2a1b 2020-07-23 stsp
2055 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2056 49c543a6 2022-03-31 naddy ret=$?
2057 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2058 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2059 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2060 993e2a1b 2020-07-23 stsp return 1
2061 993e2a1b 2020-07-23 stsp fi
2062 993e2a1b 2020-07-23 stsp
2063 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q alpha.link)
2064 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "delete symlink"
2065 993e2a1b 2020-07-23 stsp
2066 993e2a1b 2020-07-23 stsp echo "D alpha.link" > $testroot/stdout.expected
2067 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2068 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2069 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2070 993e2a1b 2020-07-23 stsp
2071 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2072 993e2a1b 2020-07-23 stsp
2073 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2074 49c543a6 2022-03-31 naddy ret=$?
2075 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2076 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2077 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2078 993e2a1b 2020-07-23 stsp return 1
2079 993e2a1b 2020-07-23 stsp fi
2080 993e2a1b 2020-07-23 stsp
2081 993e2a1b 2020-07-23 stsp if [ -e $testroot/wt/alpha.link ]; then
2082 993e2a1b 2020-07-23 stsp echo "alpha.link still exists on disk"
2083 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2084 993e2a1b 2020-07-23 stsp return 1
2085 993e2a1b 2020-07-23 stsp fi
2086 993e2a1b 2020-07-23 stsp
2087 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2088 993e2a1b 2020-07-23 stsp }
2089 993e2a1b 2020-07-23 stsp
2090 f6cae3ed 2020-09-13 naddy test_update_symlink_conflicts() {
2091 993e2a1b 2020-07-23 stsp local testroot=`test_init update_symlink_conflicts`
2092 993e2a1b 2020-07-23 stsp
2093 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
2094 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
2095 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
2096 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
2097 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
2098 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
2099 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2100 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
2101 993e2a1b 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
2102 993e2a1b 2020-07-23 stsp
2103 993e2a1b 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2104 49c543a6 2022-03-31 naddy ret=$?
2105 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2106 993e2a1b 2020-07-23 stsp echo "checkout failed unexpectedly" >&2
2107 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2108 993e2a1b 2020-07-23 stsp return 1
2109 993e2a1b 2020-07-23 stsp fi
2110 993e2a1b 2020-07-23 stsp
2111 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
2112 f55db25a 2023-03-03 naddy (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link)
2113 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
2114 993e2a1b 2020-07-23 stsp echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
2115 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar dotgotbar.link)
2116 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git rm -q nonexistent.link)
2117 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf gamma/delta zeta.link)
2118 993e2a1b 2020-07-23 stsp (cd $testroot/repo && ln -sf alpha new.link)
2119 993e2a1b 2020-07-23 stsp (cd $testroot/repo && git add .)
2120 993e2a1b 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
2121 993e2a1b 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
2122 993e2a1b 2020-07-23 stsp
2123 993e2a1b 2020-07-23 stsp # modified symlink to file A vs modified symlink to file B
2124 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
2125 993e2a1b 2020-07-23 stsp # modified symlink to dir A vs modified symlink to file B
2126 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s beta epsilon.link)
2127 993e2a1b 2020-07-23 stsp # modeified symlink to file A vs modified symlink to dir B
2128 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon/beta.link && ln -s ../gamma \
2129 f55db25a 2023-03-03 naddy epsilon/beta.link)
2130 993e2a1b 2020-07-23 stsp # added regular file A vs added bad symlink to file A
2131 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link)
2132 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotfoo.link > /dev/null)
2133 993e2a1b 2020-07-23 stsp # added bad symlink to file A vs added regular file A
2134 993e2a1b 2020-07-23 stsp echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
2135 3b9f0f87 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
2136 993e2a1b 2020-07-23 stsp # removed symlink to non-existent file A vs modified symlink
2137 993e2a1b 2020-07-23 stsp # to nonexistent file B
2138 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
2139 993e2a1b 2020-07-23 stsp # modified symlink to file A vs removed symlink to file A
2140 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
2141 993e2a1b 2020-07-23 stsp # added symlink to file A vs added symlink to file B
2142 993e2a1b 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
2143 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
2144 993e2a1b 2020-07-23 stsp
2145 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
2146 993e2a1b 2020-07-23 stsp
2147 993e2a1b 2020-07-23 stsp echo "C alpha.link" >> $testroot/stdout.expected
2148 3b9f0f87 2020-07-23 stsp echo "C dotgotbar.link" >> $testroot/stdout.expected
2149 3b9f0f87 2020-07-23 stsp echo "C dotgotfoo.link" >> $testroot/stdout.expected
2150 993e2a1b 2020-07-23 stsp echo "C epsilon/beta.link" >> $testroot/stdout.expected
2151 993e2a1b 2020-07-23 stsp echo "C epsilon.link" >> $testroot/stdout.expected
2152 993e2a1b 2020-07-23 stsp echo "C new.link" >> $testroot/stdout.expected
2153 993e2a1b 2020-07-23 stsp echo "C nonexistent.link" >> $testroot/stdout.expected
2154 993e2a1b 2020-07-23 stsp echo "G zeta.link" >> $testroot/stdout.expected
2155 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2156 993e2a1b 2020-07-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
2157 993e2a1b 2020-07-23 stsp echo >> $testroot/stdout.expected
2158 3b9f0f87 2020-07-23 stsp echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
2159 993e2a1b 2020-07-23 stsp
2160 993e2a1b 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2161 49c543a6 2022-03-31 naddy ret=$?
2162 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2163 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2164 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2165 993e2a1b 2020-07-23 stsp return 1
2166 993e2a1b 2020-07-23 stsp fi
2167 993e2a1b 2020-07-23 stsp
2168 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/alpha.link ]; then
2169 993e2a1b 2020-07-23 stsp echo "alpha.link is a symlink"
2170 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2171 993e2a1b 2020-07-23 stsp return 1
2172 993e2a1b 2020-07-23 stsp fi
2173 993e2a1b 2020-07-23 stsp
2174 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2175 283102fc 2020-07-23 stsp > $testroot/content.expected
2176 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2177 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2178 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2179 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2180 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2181 993e2a1b 2020-07-23 stsp echo "gamma/delta" >> $testroot/content.expected
2182 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2183 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2184 993e2a1b 2020-07-23 stsp
2185 993e2a1b 2020-07-23 stsp cp $testroot/wt/alpha.link $testroot/content
2186 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2187 49c543a6 2022-03-31 naddy ret=$?
2188 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2189 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2190 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2191 993e2a1b 2020-07-23 stsp return 1
2192 993e2a1b 2020-07-23 stsp fi
2193 993e2a1b 2020-07-23 stsp
2194 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon.link ]; then
2195 993e2a1b 2020-07-23 stsp echo "epsilon.link is a symlink"
2196 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2197 993e2a1b 2020-07-23 stsp return 1
2198 993e2a1b 2020-07-23 stsp fi
2199 993e2a1b 2020-07-23 stsp
2200 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2201 283102fc 2020-07-23 stsp > $testroot/content.expected
2202 993e2a1b 2020-07-23 stsp echo "gamma" >> $testroot/content.expected
2203 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2204 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2205 993e2a1b 2020-07-23 stsp echo "epsilon" >> $testroot/content.expected
2206 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2207 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2208 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2209 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2210 993e2a1b 2020-07-23 stsp
2211 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon.link $testroot/content
2212 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2213 49c543a6 2022-03-31 naddy ret=$?
2214 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2215 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2216 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2217 993e2a1b 2020-07-23 stsp return 1
2218 993e2a1b 2020-07-23 stsp fi
2219 993e2a1b 2020-07-23 stsp
2220 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
2221 993e2a1b 2020-07-23 stsp echo -n "passwd.link symlink points outside of work tree: " >&2
2222 993e2a1b 2020-07-23 stsp readlink $testroot/wt/passwd.link >&2
2223 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2224 993e2a1b 2020-07-23 stsp return 1
2225 993e2a1b 2020-07-23 stsp fi
2226 993e2a1b 2020-07-23 stsp
2227 993e2a1b 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
2228 993e2a1b 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
2229 993e2a1b 2020-07-23 stsp
2230 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2231 49c543a6 2022-03-31 naddy ret=$?
2232 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2233 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2234 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2235 993e2a1b 2020-07-23 stsp return 1
2236 993e2a1b 2020-07-23 stsp fi
2237 993e2a1b 2020-07-23 stsp
2238 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/epsilon/beta.link ]; then
2239 993e2a1b 2020-07-23 stsp echo "epsilon/beta.link is a symlink"
2240 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2241 993e2a1b 2020-07-23 stsp return 1
2242 993e2a1b 2020-07-23 stsp fi
2243 993e2a1b 2020-07-23 stsp
2244 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2245 283102fc 2020-07-23 stsp > $testroot/content.expected
2246 993e2a1b 2020-07-23 stsp echo "../gamma/delta" >> $testroot/content.expected
2247 993e2a1b 2020-07-23 stsp echo "3-way merge base: commit $commit_id1" \
2248 993e2a1b 2020-07-23 stsp >> $testroot/content.expected
2249 993e2a1b 2020-07-23 stsp echo "../beta" >> $testroot/content.expected
2250 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2251 993e2a1b 2020-07-23 stsp echo "../gamma" >> $testroot/content.expected
2252 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2253 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2254 993e2a1b 2020-07-23 stsp
2255 993e2a1b 2020-07-23 stsp cp $testroot/wt/epsilon/beta.link $testroot/content
2256 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2257 49c543a6 2022-03-31 naddy ret=$?
2258 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2259 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2260 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2261 993e2a1b 2020-07-23 stsp return 1
2262 993e2a1b 2020-07-23 stsp fi
2263 993e2a1b 2020-07-23 stsp
2264 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/nonexistent.link ]; then
2265 993e2a1b 2020-07-23 stsp echo -n "nonexistent.link still exists on disk: " >&2
2266 993e2a1b 2020-07-23 stsp readlink $testroot/wt/nonexistent.link >&2
2267 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2268 993e2a1b 2020-07-23 stsp return 1
2269 993e2a1b 2020-07-23 stsp fi
2270 993e2a1b 2020-07-23 stsp
2271 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2272 283102fc 2020-07-23 stsp > $testroot/content.expected
2273 993e2a1b 2020-07-23 stsp echo "(symlink was deleted)" >> $testroot/content.expected
2274 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2275 993e2a1b 2020-07-23 stsp echo "nonexistent2" >> $testroot/content.expected
2276 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2277 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2278 993e2a1b 2020-07-23 stsp
2279 993e2a1b 2020-07-23 stsp cp $testroot/wt/nonexistent.link $testroot/content
2280 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2281 49c543a6 2022-03-31 naddy ret=$?
2282 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2283 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2284 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2285 993e2a1b 2020-07-23 stsp return 1
2286 993e2a1b 2020-07-23 stsp fi
2287 993e2a1b 2020-07-23 stsp
2288 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/dotgotfoo.link ]; then
2289 993e2a1b 2020-07-23 stsp echo "dotgotfoo.link is a symlink"
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 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2295 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2296 3b9f0f87 2020-07-23 stsp echo "this is regular file foo" >> $testroot/content.expected
2297 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2298 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2299 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2300 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2301 3b9f0f87 2020-07-23 stsp
2302 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotfoo.link $testroot/content
2303 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2304 49c543a6 2022-03-31 naddy ret=$?
2305 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2306 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2307 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
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 if [ -h $testroot/wt/dotgotbar.link ]; then
2312 993e2a1b 2020-07-23 stsp echo "dotgotbar.link is a symlink"
2313 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2314 993e2a1b 2020-07-23 stsp return 1
2315 993e2a1b 2020-07-23 stsp fi
2316 3b9f0f87 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2317 3b9f0f87 2020-07-23 stsp > $testroot/content.expected
2318 3b9f0f87 2020-07-23 stsp echo -n ".got/bar" >> $testroot/content.expected
2319 3b9f0f87 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2320 3b9f0f87 2020-07-23 stsp echo "this is regular file bar" >> $testroot/content.expected
2321 3b9f0f87 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2322 3b9f0f87 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2323 3b9f0f87 2020-07-23 stsp
2324 993e2a1b 2020-07-23 stsp cp $testroot/wt/dotgotbar.link $testroot/content
2325 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2326 49c543a6 2022-03-31 naddy ret=$?
2327 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2328 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2329 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2330 993e2a1b 2020-07-23 stsp return 1
2331 993e2a1b 2020-07-23 stsp fi
2332 993e2a1b 2020-07-23 stsp
2333 993e2a1b 2020-07-23 stsp if [ -h $testroot/wt/new.link ]; then
2334 993e2a1b 2020-07-23 stsp echo "new.link is a symlink"
2335 993e2a1b 2020-07-23 stsp test_done "$testroot" "1"
2336 993e2a1b 2020-07-23 stsp return 1
2337 993e2a1b 2020-07-23 stsp fi
2338 993e2a1b 2020-07-23 stsp
2339 993e2a1b 2020-07-23 stsp echo "<<<<<<< merged change: commit $commit_id2" \
2340 283102fc 2020-07-23 stsp > $testroot/content.expected
2341 993e2a1b 2020-07-23 stsp echo "alpha" >> $testroot/content.expected
2342 993e2a1b 2020-07-23 stsp echo "=======" >> $testroot/content.expected
2343 993e2a1b 2020-07-23 stsp echo "beta" >> $testroot/content.expected
2344 993e2a1b 2020-07-23 stsp echo '>>>>>>>' >> $testroot/content.expected
2345 993e2a1b 2020-07-23 stsp echo -n "" >> $testroot/content.expected
2346 993e2a1b 2020-07-23 stsp
2347 993e2a1b 2020-07-23 stsp cp $testroot/wt/new.link $testroot/content
2348 993e2a1b 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
2349 49c543a6 2022-03-31 naddy ret=$?
2350 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2351 993e2a1b 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
2352 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2353 993e2a1b 2020-07-23 stsp return 1
2354 993e2a1b 2020-07-23 stsp fi
2355 993e2a1b 2020-07-23 stsp
2356 993e2a1b 2020-07-23 stsp echo "A dotgotfoo.link" > $testroot/stdout.expected
2357 993e2a1b 2020-07-23 stsp echo "M new.link" >> $testroot/stdout.expected
2358 993e2a1b 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
2359 993e2a1b 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
2360 84246752 2022-06-03 op ret=$?
2361 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2362 993e2a1b 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
2363 993e2a1b 2020-07-23 stsp test_done "$testroot" "$ret"
2364 993e2a1b 2020-07-23 stsp return 1
2365 993e2a1b 2020-07-23 stsp fi
2366 993e2a1b 2020-07-23 stsp
2367 993e2a1b 2020-07-23 stsp test_done "$testroot" "0"
2368 993e2a1b 2020-07-23 stsp
2369 f35fa46a 2020-07-23 stsp }
2370 194cb7cb 2021-01-19 stsp
2371 194cb7cb 2021-01-19 stsp test_update_single_file() {
2372 194cb7cb 2021-01-19 stsp local testroot=`test_init update_single_file 1`
2373 194cb7cb 2021-01-19 stsp
2374 194cb7cb 2021-01-19 stsp echo c1 > $testroot/repo/c
2375 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2376 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "adding file c"
2377 194cb7cb 2021-01-19 stsp local commit_id1=`git_show_head $testroot/repo`
2378 194cb7cb 2021-01-19 stsp
2379 194cb7cb 2021-01-19 stsp echo a > $testroot/repo/a
2380 194cb7cb 2021-01-19 stsp echo b > $testroot/repo/b
2381 194cb7cb 2021-01-19 stsp echo c2 > $testroot/repo/c
2382 194cb7cb 2021-01-19 stsp (cd $testroot/repo && git add .)
2383 79775c2f 2021-01-19 stsp git_commit $testroot/repo -m "add files a and b, change c"
2384 194cb7cb 2021-01-19 stsp local commit_id2=`git_show_head $testroot/repo`
2385 f35fa46a 2020-07-23 stsp
2386 d51387a0 2021-01-19 stsp (cd $testroot/repo && git rm -qf c)
2387 d51387a0 2021-01-19 stsp git_commit $testroot/repo -m "remove file c"
2388 d51387a0 2021-01-19 stsp local commit_id3=`git_show_head $testroot/repo`
2389 d51387a0 2021-01-19 stsp
2390 d51387a0 2021-01-19 stsp got checkout -c $commit_id2 $testroot/repo $testroot/wt > /dev/null
2391 49c543a6 2022-03-31 naddy ret=$?
2392 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2393 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2394 194cb7cb 2021-01-19 stsp return 1
2395 194cb7cb 2021-01-19 stsp fi
2396 194cb7cb 2021-01-19 stsp
2397 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2398 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2399 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2400 194cb7cb 2021-01-19 stsp
2401 194cb7cb 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id1 c \
2402 194cb7cb 2021-01-19 stsp > $testroot/stdout)
2403 194cb7cb 2021-01-19 stsp
2404 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2405 49c543a6 2022-03-31 naddy ret=$?
2406 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2407 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2408 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2409 194cb7cb 2021-01-19 stsp return 1
2410 194cb7cb 2021-01-19 stsp fi
2411 194cb7cb 2021-01-19 stsp
2412 194cb7cb 2021-01-19 stsp echo c1 > $testroot/content.expected
2413 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2414 194cb7cb 2021-01-19 stsp
2415 194cb7cb 2021-01-19 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 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2419 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2420 194cb7cb 2021-01-19 stsp return 1
2421 194cb7cb 2021-01-19 stsp fi
2422 194cb7cb 2021-01-19 stsp
2423 194cb7cb 2021-01-19 stsp echo "U c" > $testroot/stdout.expected
2424 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id2" \
2425 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2426 194cb7cb 2021-01-19 stsp
2427 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
2428 194cb7cb 2021-01-19 stsp
2429 194cb7cb 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2430 49c543a6 2022-03-31 naddy ret=$?
2431 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2432 194cb7cb 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2433 194cb7cb 2021-01-19 stsp test_done "$testroot" "$ret"
2434 194cb7cb 2021-01-19 stsp return 1
2435 194cb7cb 2021-01-19 stsp fi
2436 194cb7cb 2021-01-19 stsp
2437 194cb7cb 2021-01-19 stsp echo c2 > $testroot/content.expected
2438 194cb7cb 2021-01-19 stsp cat $testroot/wt/c > $testroot/content
2439 194cb7cb 2021-01-19 stsp
2440 194cb7cb 2021-01-19 stsp cmp -s $testroot/content.expected $testroot/content
2441 49c543a6 2022-03-31 naddy ret=$?
2442 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2443 194cb7cb 2021-01-19 stsp diff -u $testroot/content.expected $testroot/content
2444 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2445 d51387a0 2021-01-19 stsp return 1
2446 194cb7cb 2021-01-19 stsp fi
2447 d51387a0 2021-01-19 stsp
2448 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2449 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2450 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2451 d51387a0 2021-01-19 stsp
2452 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 c \
2453 d51387a0 2021-01-19 stsp > $testroot/stdout 2> $testroot/stderr)
2454 d51387a0 2021-01-19 stsp
2455 d51387a0 2021-01-19 stsp echo "got: /c: no such entry found in tree" > $testroot/stderr.expected
2456 d51387a0 2021-01-19 stsp cmp -s $testroot/stderr.expected $testroot/stderr
2457 49c543a6 2022-03-31 naddy ret=$?
2458 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2459 d51387a0 2021-01-19 stsp diff -u $testroot/stderr.expected $testroot/stderr
2460 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2461 d51387a0 2021-01-19 stsp return 1
2462 d51387a0 2021-01-19 stsp fi
2463 d51387a0 2021-01-19 stsp
2464 d51387a0 2021-01-19 stsp echo -n > $testroot/stdout.expected
2465 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2466 49c543a6 2022-03-31 naddy ret=$?
2467 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2468 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2469 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2470 d51387a0 2021-01-19 stsp return 1
2471 d51387a0 2021-01-19 stsp fi
2472 d51387a0 2021-01-19 stsp
2473 d51387a0 2021-01-19 stsp echo "D c" > $testroot/stdout.expected
2474 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id3" \
2475 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2476 d51387a0 2021-01-19 stsp
2477 d51387a0 2021-01-19 stsp (cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
2478 d51387a0 2021-01-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2479 49c543a6 2022-03-31 naddy ret=$?
2480 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2481 d51387a0 2021-01-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
2482 d51387a0 2021-01-19 stsp test_done "$testroot" "$ret"
2483 d51387a0 2021-01-19 stsp return 1
2484 d51387a0 2021-01-19 stsp fi
2485 d51387a0 2021-01-19 stsp
2486 d51387a0 2021-01-19 stsp if [ -e $testroot/wt/c ]; then
2487 d51387a0 2021-01-19 stsp echo "removed file c still exists on disk" >&2
2488 d51387a0 2021-01-19 stsp test_done "$testroot" "1"
2489 d51387a0 2021-01-19 stsp return 1
2490 d51387a0 2021-01-19 stsp fi
2491 d51387a0 2021-01-19 stsp
2492 d51387a0 2021-01-19 stsp test_done "$testroot" "0"
2493 d51387a0 2021-01-19 stsp return 0
2494 a769b60b 2021-06-27 stsp }
2495 a769b60b 2021-06-27 stsp
2496 a769b60b 2021-06-27 stsp test_update_file_skipped_due_to_conflict() {
2497 a769b60b 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_conflict`
2498 a769b60b 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2499 a769b60b 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2500 a769b60b 2021-06-27 stsp
2501 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2502 a769b60b 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2503 a769b60b 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2504 a769b60b 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2505 a769b60b 2021-06-27 stsp
2506 a769b60b 2021-06-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2507 49c543a6 2022-03-31 naddy ret=$?
2508 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2509 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2510 a769b60b 2021-06-27 stsp return 1
2511 a769b60b 2021-06-27 stsp fi
2512 a769b60b 2021-06-27 stsp
2513 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2514 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2515 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2516 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2517 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2518 a769b60b 2021-06-27 stsp return 1
2519 a769b60b 2021-06-27 stsp fi
2520 a769b60b 2021-06-27 stsp
2521 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2522 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2523 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2524 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2525 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2526 a769b60b 2021-06-27 stsp return 1
2527 a769b60b 2021-06-27 stsp fi
2528 a769b60b 2021-06-27 stsp
2529 a769b60b 2021-06-27 stsp echo "modified beta" > $testroot/wt/beta
2530 a769b60b 2021-06-27 stsp
2531 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
2532 a769b60b 2021-06-27 stsp
2533 a769b60b 2021-06-27 stsp echo "C beta" > $testroot/stdout.expected
2534 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id0" \
2535 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2536 a769b60b 2021-06-27 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2537 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2538 49c543a6 2022-03-31 naddy ret=$?
2539 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2540 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2541 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2542 a769b60b 2021-06-27 stsp return 1
2543 a769b60b 2021-06-27 stsp fi
2544 a769b60b 2021-06-27 stsp
2545 a769b60b 2021-06-27 stsp echo "<<<<<<< merged change: commit $commit_id0" \
2546 a769b60b 2021-06-27 stsp > $testroot/content.expected
2547 a769b60b 2021-06-27 stsp echo "beta" >> $testroot/content.expected
2548 a769b60b 2021-06-27 stsp echo "||||||| 3-way merge base: commit $commit_id1" \
2549 a769b60b 2021-06-27 stsp >> $testroot/content.expected
2550 a769b60b 2021-06-27 stsp echo "changed beta" >> $testroot/content.expected
2551 a769b60b 2021-06-27 stsp echo "=======" >> $testroot/content.expected
2552 a769b60b 2021-06-27 stsp echo "modified beta" >> $testroot/content.expected
2553 a769b60b 2021-06-27 stsp echo ">>>>>>>" >> $testroot/content.expected
2554 a769b60b 2021-06-27 stsp
2555 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2556 a769b60b 2021-06-27 stsp
2557 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2558 49c543a6 2022-03-31 naddy ret=$?
2559 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2560 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2561 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2562 a769b60b 2021-06-27 stsp return 1
2563 a769b60b 2021-06-27 stsp fi
2564 a769b60b 2021-06-27 stsp
2565 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2566 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2567 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2568 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2569 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2570 a769b60b 2021-06-27 stsp return 1
2571 a769b60b 2021-06-27 stsp fi
2572 a769b60b 2021-06-27 stsp
2573 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2574 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2575 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2576 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2577 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2578 a769b60b 2021-06-27 stsp return 1
2579 a769b60b 2021-06-27 stsp fi
2580 a769b60b 2021-06-27 stsp
2581 a769b60b 2021-06-27 stsp # update to the latest commit again; this skips beta
2582 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2583 a769b60b 2021-06-27 stsp echo "# beta" > $testroot/stdout.expected
2584 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2585 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2586 a769b60b 2021-06-27 stsp echo "Files not updated because of existing merge conflicts: 1" \
2587 a769b60b 2021-06-27 stsp >> $testroot/stdout.expected
2588 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2589 49c543a6 2022-03-31 naddy ret=$?
2590 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2591 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2592 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
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 # blob ID of beta should not have changed
2597 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2598 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2599 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2600 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2601 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2602 a769b60b 2021-06-27 stsp return 1
2603 a769b60b 2021-06-27 stsp fi
2604 a769b60b 2021-06-27 stsp
2605 a769b60b 2021-06-27 stsp # commit ID of beta should not have changed; There was a bug
2606 a769b60b 2021-06-27 stsp # here where the commit ID had been changed even though the
2607 a769b60b 2021-06-27 stsp # file was not updated.
2608 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2609 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2610 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2611 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2612 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2613 a769b60b 2021-06-27 stsp return 1
2614 a769b60b 2021-06-27 stsp fi
2615 a769b60b 2021-06-27 stsp
2616 a769b60b 2021-06-27 stsp # beta is still conflicted and based on commit 0
2617 a769b60b 2021-06-27 stsp echo 'C beta' > $testroot/stdout.expected
2618 a769b60b 2021-06-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
2619 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2620 49c543a6 2022-03-31 naddy ret=$?
2621 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2622 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2623 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2624 a769b60b 2021-06-27 stsp return 1
2625 a769b60b 2021-06-27 stsp fi
2626 a769b60b 2021-06-27 stsp
2627 a769b60b 2021-06-27 stsp # resolve the conflict via revert
2628 a769b60b 2021-06-27 stsp (cd $testroot/wt && got revert beta >/dev/null)
2629 a769b60b 2021-06-27 stsp
2630 a769b60b 2021-06-27 stsp # beta now matches its base blob which is still from commit 0
2631 a769b60b 2021-06-27 stsp echo "beta" > $testroot/content.expected
2632 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2633 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2634 49c543a6 2022-03-31 naddy ret=$?
2635 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2636 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2637 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2638 a769b60b 2021-06-27 stsp return 1
2639 a769b60b 2021-06-27 stsp fi
2640 a769b60b 2021-06-27 stsp
2641 a769b60b 2021-06-27 stsp # updating to the latest commit should now update beta
2642 a769b60b 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2643 a769b60b 2021-06-27 stsp echo "U beta" > $testroot/stdout.expected
2644 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2645 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2646 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2647 49c543a6 2022-03-31 naddy ret=$?
2648 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2649 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2650 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2651 2c41dce7 2021-06-27 stsp return 1
2652 2c41dce7 2021-06-27 stsp fi
2653 2c41dce7 2021-06-27 stsp
2654 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2655 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2656 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2657 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2658 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2659 2c41dce7 2021-06-27 stsp return 1
2660 2c41dce7 2021-06-27 stsp fi
2661 2c41dce7 2021-06-27 stsp
2662 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2663 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2664 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2665 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2666 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2667 2c41dce7 2021-06-27 stsp return 1
2668 2c41dce7 2021-06-27 stsp fi
2669 2c41dce7 2021-06-27 stsp
2670 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2671 2c41dce7 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2672 2c41dce7 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2673 49c543a6 2022-03-31 naddy ret=$?
2674 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2675 2c41dce7 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2676 2c41dce7 2021-06-27 stsp fi
2677 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2678 2c41dce7 2021-06-27 stsp }
2679 2c41dce7 2021-06-27 stsp
2680 2c41dce7 2021-06-27 stsp test_update_file_skipped_due_to_obstruction() {
2681 2c41dce7 2021-06-27 stsp local testroot=`test_init update_file_skipped_due_to_obstruction`
2682 2c41dce7 2021-06-27 stsp local commit_id0=`git_show_head $testroot/repo`
2683 2c41dce7 2021-06-27 stsp blob_id0=`get_blob_id $testroot/repo "" beta`
2684 2c41dce7 2021-06-27 stsp
2685 2c41dce7 2021-06-27 stsp echo "changed beta" > $testroot/repo/beta
2686 f6764181 2021-09-24 stsp echo "new file" > $testroot/repo/new
2687 f6764181 2021-09-24 stsp (cd $testroot/repo && git add new)
2688 2c41dce7 2021-06-27 stsp git_commit $testroot/repo -m "changed beta"
2689 2c41dce7 2021-06-27 stsp local commit_id1=`git_show_head $testroot/repo`
2690 2c41dce7 2021-06-27 stsp blob_id1=`get_blob_id $testroot/repo "" beta`
2691 2c41dce7 2021-06-27 stsp
2692 2c41dce7 2021-06-27 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
2693 49c543a6 2022-03-31 naddy ret=$?
2694 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2695 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2696 2c41dce7 2021-06-27 stsp return 1
2697 2c41dce7 2021-06-27 stsp fi
2698 2c41dce7 2021-06-27 stsp
2699 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2700 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2701 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2702 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2703 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2704 2c41dce7 2021-06-27 stsp return 1
2705 2c41dce7 2021-06-27 stsp fi
2706 2c41dce7 2021-06-27 stsp
2707 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2708 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2709 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2710 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2711 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2712 2c41dce7 2021-06-27 stsp return 1
2713 2c41dce7 2021-06-27 stsp fi
2714 2c41dce7 2021-06-27 stsp
2715 2c41dce7 2021-06-27 stsp rm $testroot/wt/beta
2716 2c41dce7 2021-06-27 stsp mkdir -p $testroot/wt/beta/psi
2717 f6764181 2021-09-24 stsp mkdir -p $testroot/wt/new
2718 2c41dce7 2021-06-27 stsp
2719 f6764181 2021-09-24 stsp # update to the latest commit; this skips beta and the new file
2720 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2721 49c543a6 2022-03-31 naddy ret=$?
2722 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2723 f6764181 2021-09-24 stsp echo "update failed unexpectedly" >&2
2724 f6764181 2021-09-24 stsp test_done "$testroot" "1"
2725 f6764181 2021-09-24 stsp return 1
2726 f6764181 2021-09-24 stsp fi
2727 2c41dce7 2021-06-27 stsp
2728 2c41dce7 2021-06-27 stsp echo "~ beta" > $testroot/stdout.expected
2729 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2730 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2731 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2732 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 2" \
2733 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2734 a769b60b 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2735 49c543a6 2022-03-31 naddy ret=$?
2736 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2737 a769b60b 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2738 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2739 a769b60b 2021-06-27 stsp return 1
2740 a769b60b 2021-06-27 stsp fi
2741 a769b60b 2021-06-27 stsp
2742 a769b60b 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2743 a769b60b 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2744 2c41dce7 2021-06-27 stsp if [ "$blob_id" != "$blob_id0" ]; then
2745 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2746 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2747 2c41dce7 2021-06-27 stsp return 1
2748 2c41dce7 2021-06-27 stsp fi
2749 2c41dce7 2021-06-27 stsp
2750 2c41dce7 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2751 2c41dce7 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2752 2c41dce7 2021-06-27 stsp if [ "$commit_id" != "$commit_id0" ]; then
2753 2c41dce7 2021-06-27 stsp echo "file beta has the wrong base commit ID" >&2
2754 2c41dce7 2021-06-27 stsp test_done "$testroot" "1"
2755 2c41dce7 2021-06-27 stsp return 1
2756 2c41dce7 2021-06-27 stsp fi
2757 2c41dce7 2021-06-27 stsp
2758 2c41dce7 2021-06-27 stsp # remove the directory which obstructs file beta
2759 2c41dce7 2021-06-27 stsp rm -r $testroot/wt/beta
2760 2c41dce7 2021-06-27 stsp
2761 2c41dce7 2021-06-27 stsp # updating to the latest commit should now update beta
2762 2c41dce7 2021-06-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
2763 2c41dce7 2021-06-27 stsp echo "! beta" > $testroot/stdout.expected
2764 f6764181 2021-09-24 stsp echo "~ new" >> $testroot/stdout.expected
2765 4f3c844b 2021-09-14 stsp echo "Updated to refs/heads/master: $commit_id1" \
2766 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
2767 f6764181 2021-09-24 stsp echo "File paths obstructed by a non-regular file: 1" \
2768 f6764181 2021-09-24 stsp >> $testroot/stdout.expected
2769 2c41dce7 2021-06-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2770 49c543a6 2022-03-31 naddy ret=$?
2771 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2772 2c41dce7 2021-06-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
2773 2c41dce7 2021-06-27 stsp test_done "$testroot" "$ret"
2774 2c41dce7 2021-06-27 stsp return 1
2775 2c41dce7 2021-06-27 stsp fi
2776 2c41dce7 2021-06-27 stsp
2777 2c41dce7 2021-06-27 stsp blob_id=`(cd $testroot/wt && got info beta | grep 'blob:' | \
2778 2c41dce7 2021-06-27 stsp cut -d ':' -f 2 | tr -d ' ')`
2779 a769b60b 2021-06-27 stsp if [ "$blob_id" != "$blob_id1" ]; then
2780 a769b60b 2021-06-27 stsp echo "file beta has the wrong base blob ID" >&2
2781 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2782 a769b60b 2021-06-27 stsp return 1
2783 a769b60b 2021-06-27 stsp fi
2784 a769b60b 2021-06-27 stsp
2785 a769b60b 2021-06-27 stsp commit_id=`(cd $testroot/wt && got info beta | \
2786 a769b60b 2021-06-27 stsp grep 'based on commit:' | cut -d ':' -f 2 | tr -d ' ')`
2787 a769b60b 2021-06-27 stsp if [ "$commit_id" != "$commit_id1" ]; then
2788 a769b60b 2021-06-27 stsp echo "file beta has the wrong base commit ID: $commit_id" >&2
2789 a769b60b 2021-06-27 stsp test_done "$testroot" "1"
2790 a769b60b 2021-06-27 stsp return 1
2791 a769b60b 2021-06-27 stsp fi
2792 a769b60b 2021-06-27 stsp
2793 a769b60b 2021-06-27 stsp echo "changed beta" > $testroot/content.expected
2794 a769b60b 2021-06-27 stsp cat $testroot/wt/beta > $testroot/content
2795 a769b60b 2021-06-27 stsp cmp -s $testroot/content.expected $testroot/content
2796 49c543a6 2022-03-31 naddy ret=$?
2797 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2798 a769b60b 2021-06-27 stsp diff -u $testroot/content.expected $testroot/content
2799 a769b60b 2021-06-27 stsp fi
2800 a769b60b 2021-06-27 stsp test_done "$testroot" "$ret"
2801 194cb7cb 2021-01-19 stsp }
2802 67c65ed7 2021-09-14 tracey
2803 67c65ed7 2021-09-14 tracey test_update_quiet() {
2804 67c65ed7 2021-09-14 tracey local testroot=`test_init update_quiet`
2805 67c65ed7 2021-09-14 tracey
2806 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
2807 49c543a6 2022-03-31 naddy ret=$?
2808 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2809 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2810 67c65ed7 2021-09-14 tracey return 1
2811 67c65ed7 2021-09-14 tracey fi
2812 67c65ed7 2021-09-14 tracey
2813 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/repo/alpha
2814 67c65ed7 2021-09-14 tracey git_commit $testroot/repo -m "modified alpha"
2815 67c65ed7 2021-09-14 tracey
2816 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
2817 67c65ed7 2021-09-14 tracey git_show_head $testroot/repo >> $testroot/stdout.expected
2818 67c65ed7 2021-09-14 tracey echo >> $testroot/stdout.expected
2819 67c65ed7 2021-09-14 tracey
2820 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got update -q > $testroot/stdout)
2821 67c65ed7 2021-09-14 tracey
2822 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
2823 49c543a6 2022-03-31 naddy ret=$?
2824 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2825 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
2826 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2827 67c65ed7 2021-09-14 tracey return 1
2828 67c65ed7 2021-09-14 tracey fi
2829 194cb7cb 2021-01-19 stsp
2830 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/content.expected
2831 67c65ed7 2021-09-14 tracey cat $testroot/wt/alpha > $testroot/content
2832 194cb7cb 2021-01-19 stsp
2833 67c65ed7 2021-09-14 tracey cmp -s $testroot/content.expected $testroot/content
2834 49c543a6 2022-03-31 naddy ret=$?
2835 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2836 67c65ed7 2021-09-14 tracey diff -u $testroot/content.expected $testroot/content
2837 67c65ed7 2021-09-14 tracey fi
2838 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
2839 0e039681 2021-11-15 stsp }
2840 0e039681 2021-11-15 stsp
2841 0e039681 2021-11-15 stsp test_update_binary_file() {
2842 0e039681 2021-11-15 stsp local testroot=`test_init update_binary_file`
2843 0e039681 2021-11-15 stsp local commit_id0=`git_show_head $testroot/repo`
2844 0e039681 2021-11-15 stsp
2845 0e039681 2021-11-15 stsp got checkout $testroot/repo $testroot/wt > /dev/null
2846 49c543a6 2022-03-31 naddy ret=$?
2847 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2848 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2849 0e039681 2021-11-15 stsp return 1
2850 0e039681 2021-11-15 stsp fi
2851 0e039681 2021-11-15 stsp
2852 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
2853 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2854 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo >/dev/null)
2855 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
2856 0e039681 2021-11-15 stsp local commit_id1=`git_show_head $testroot/repo`
2857 0e039681 2021-11-15 stsp
2858 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2859 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2860 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2861 0e039681 2021-11-15 stsp local commit_id2=`git_show_head $testroot/repo`
2862 0e039681 2021-11-15 stsp
2863 0e039681 2021-11-15 stsp cp /bin/cp $testroot/wt/foo
2864 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2865 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'change binary file' > /dev/null)
2866 0e039681 2021-11-15 stsp local commit_id3=`git_show_head $testroot/repo`
2867 0e039681 2021-11-15 stsp
2868 0e039681 2021-11-15 stsp (cd $testroot/wt && got rm foo >/dev/null)
2869 0e039681 2021-11-15 stsp (cd $testroot/wt && got commit -m 'remove binary file' > /dev/null)
2870 0e039681 2021-11-15 stsp local commit_id4=`git_show_head $testroot/repo`
2871 0e039681 2021-11-15 stsp
2872 0e039681 2021-11-15 stsp # backdate the work tree to make it usable for updating
2873 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2874 0e039681 2021-11-15 stsp
2875 0e039681 2021-11-15 stsp # update which adds a binary file
2876 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2877 0e039681 2021-11-15 stsp
2878 0e039681 2021-11-15 stsp echo "A foo" > $testroot/stdout.expected
2879 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id1" \
2880 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2881 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2882 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2883 49c543a6 2022-03-31 naddy ret=$?
2884 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2885 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2886 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2887 0e039681 2021-11-15 stsp return 1
2888 0e039681 2021-11-15 stsp fi
2889 0e039681 2021-11-15 stsp
2890 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2891 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2892 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2893 0e039681 2021-11-15 stsp
2894 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2895 49c543a6 2022-03-31 naddy ret=$?
2896 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2897 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2898 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2899 0e039681 2021-11-15 stsp return 1
2900 0e039681 2021-11-15 stsp fi
2901 0e039681 2021-11-15 stsp
2902 0e039681 2021-11-15 stsp # update which adds a conflicting binary file
2903 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id0 > /dev/null)
2904 0e039681 2021-11-15 stsp cp /bin/cat $testroot/wt/foo
2905 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
2906 0e039681 2021-11-15 stsp (cd $testroot/wt && got add foo > /dev/null)
2907 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > $testroot/stdout)
2908 0e039681 2021-11-15 stsp
2909 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
2910 0e039681 2021-11-15 stsp echo "Updated to refs/heads/master: $commit_id1" \
2911 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2912 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
2913 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2914 49c543a6 2022-03-31 naddy ret=$?
2915 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2916 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2917 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2918 0e039681 2021-11-15 stsp return 1
2919 0e039681 2021-11-15 stsp fi
2920 0e039681 2021-11-15 stsp
2921 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
2922 0e039681 2021-11-15 stsp > $testroot/content.expected
2923 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id1" \
2924 0e039681 2021-11-15 stsp >> $testroot/content.expected
2925 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2926 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
2927 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
2928 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
2929 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
2930 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
2931 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2932 0e039681 2021-11-15 stsp
2933 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2934 49c543a6 2022-03-31 naddy ret=$?
2935 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2936 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2937 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2938 0e039681 2021-11-15 stsp return 1
2939 0e039681 2021-11-15 stsp fi
2940 0e039681 2021-11-15 stsp
2941 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
2942 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2943 0e039681 2021-11-15 stsp cat $testroot/wt/foo-1-* > $testroot/content
2944 0e039681 2021-11-15 stsp
2945 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2946 49c543a6 2022-03-31 naddy ret=$?
2947 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2948 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2949 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2950 0e039681 2021-11-15 stsp return 1
2951 0e039681 2021-11-15 stsp fi
2952 0e039681 2021-11-15 stsp
2953 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
2954 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2955 0e039681 2021-11-15 stsp cat $testroot/wt/foo-2-* > $testroot/content
2956 0e039681 2021-11-15 stsp
2957 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2958 49c543a6 2022-03-31 naddy ret=$?
2959 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2960 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2961 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2962 0e039681 2021-11-15 stsp return 1
2963 0e039681 2021-11-15 stsp fi
2964 0e039681 2021-11-15 stsp
2965 0e039681 2021-11-15 stsp # tidy up
2966 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . >/dev/null)
2967 0e039681 2021-11-15 stsp rm $testroot/wt/foo-1-* $testroot/wt/foo-2-*
2968 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id1 > /dev/null)
2969 0e039681 2021-11-15 stsp
2970 0e039681 2021-11-15 stsp # update which changes a binary file
2971 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id2 > $testroot/stdout)
2972 0e039681 2021-11-15 stsp
2973 0e039681 2021-11-15 stsp echo "U foo" > $testroot/stdout.expected
2974 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id2" \
2975 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
2976 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
2977 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
2978 49c543a6 2022-03-31 naddy ret=$?
2979 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2980 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
2981 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2982 0e039681 2021-11-15 stsp return 1
2983 0e039681 2021-11-15 stsp fi
2984 0e039681 2021-11-15 stsp
2985 0e039681 2021-11-15 stsp cp /bin/cat $testroot/content.expected
2986 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
2987 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
2988 0e039681 2021-11-15 stsp
2989 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
2990 49c543a6 2022-03-31 naddy ret=$?
2991 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
2992 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
2993 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
2994 0e039681 2021-11-15 stsp return 1
2995 0e039681 2021-11-15 stsp fi
2996 0e039681 2021-11-15 stsp
2997 0e039681 2021-11-15 stsp # update which changes a locally modified binary file
2998 0e039681 2021-11-15 stsp cp /bin/ls $testroot/wt/foo
2999 0e039681 2021-11-15 stsp chmod 755 $testroot/wt/foo
3000 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id3 > $testroot/stdout)
3001 0e039681 2021-11-15 stsp
3002 0e039681 2021-11-15 stsp echo "C foo" > $testroot/stdout.expected
3003 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id3" \
3004 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3005 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3006 0e039681 2021-11-15 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
3007 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3008 49c543a6 2022-03-31 naddy ret=$?
3009 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3010 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3011 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3012 0e039681 2021-11-15 stsp return 1
3013 0e039681 2021-11-15 stsp fi
3014 0e039681 2021-11-15 stsp
3015 0e039681 2021-11-15 stsp echo "Binary files differ and cannot be merged automatically:" \
3016 0e039681 2021-11-15 stsp > $testroot/content.expected
3017 0e039681 2021-11-15 stsp echo "<<<<<<< merged change: commit $commit_id3" \
3018 0e039681 2021-11-15 stsp >> $testroot/content.expected
3019 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3020 0e039681 2021-11-15 stsp ls $testroot/wt/foo-1-* >> $testroot/content.expected
3021 0e039681 2021-11-15 stsp echo "||||||| 3-way merge base: commit $commit_id2" \
3022 0e039681 2021-11-15 stsp >> $testroot/content.expected
3023 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3024 0e039681 2021-11-15 stsp ls $testroot/wt/foo-orig-* >> $testroot/content.expected
3025 0e039681 2021-11-15 stsp echo '=======' >> $testroot/content.expected
3026 0e039681 2021-11-15 stsp echo -n "file " >> $testroot/content.expected
3027 0e039681 2021-11-15 stsp ls $testroot/wt/foo-2-* >> $testroot/content.expected
3028 0e039681 2021-11-15 stsp echo ">>>>>>>" >> $testroot/content.expected
3029 0e039681 2021-11-15 stsp cat $testroot/wt/foo > $testroot/content
3030 0e039681 2021-11-15 stsp
3031 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3032 49c543a6 2022-03-31 naddy ret=$?
3033 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3034 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3035 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3036 0e039681 2021-11-15 stsp return 1
3037 0e039681 2021-11-15 stsp fi
3038 0e039681 2021-11-15 stsp
3039 0e039681 2021-11-15 stsp cp /bin/cp $testroot/content.expected
3040 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3041 0e039681 2021-11-15 stsp cp $testroot/wt/foo-1-* $testroot/content
3042 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3043 49c543a6 2022-03-31 naddy ret=$?
3044 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3045 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3046 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3047 0e039681 2021-11-15 stsp return 1
3048 0e039681 2021-11-15 stsp fi
3049 0e039681 2021-11-15 stsp
3050 0e039681 2021-11-15 stsp cp /bin/ls $testroot/content.expected
3051 0e039681 2021-11-15 stsp chmod 755 $testroot/content.expected
3052 0e039681 2021-11-15 stsp cp $testroot/wt/foo-2-* $testroot/content
3053 0e039681 2021-11-15 stsp cmp -s $testroot/content.expected $testroot/content
3054 49c543a6 2022-03-31 naddy ret=$?
3055 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3056 0e039681 2021-11-15 stsp diff -u $testroot/content.expected $testroot/content
3057 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3058 0e039681 2021-11-15 stsp return 1
3059 0e039681 2021-11-15 stsp fi
3060 0e039681 2021-11-15 stsp
3061 0e039681 2021-11-15 stsp (cd $testroot/wt && got status > $testroot/stdout)
3062 d952957d 2023-02-19 mark echo 'C foo' > $testroot/stdout.expected
3063 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3064 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-1-* >> $testroot/stdout.expected)
3065 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3066 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-2-* >> $testroot/stdout.expected)
3067 0e039681 2021-11-15 stsp echo -n '? ' >> $testroot/stdout.expected
3068 0e039681 2021-11-15 stsp (cd $testroot/wt && ls foo-orig-* >> $testroot/stdout.expected)
3069 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3070 49c543a6 2022-03-31 naddy ret=$?
3071 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3072 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3073 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3074 0e039681 2021-11-15 stsp return 1
3075 0e039681 2021-11-15 stsp fi
3076 0e039681 2021-11-15 stsp
3077 0e039681 2021-11-15 stsp # tidy up
3078 0e039681 2021-11-15 stsp (cd $testroot/wt && got revert -R . > /dev/null)
3079 0e039681 2021-11-15 stsp rm $testroot/wt/foo-orig-* $testroot/wt/foo-1-* $testroot/wt/foo-2-*
3080 0e039681 2021-11-15 stsp
3081 0e039681 2021-11-15 stsp # update which deletes a binary file
3082 0e039681 2021-11-15 stsp (cd $testroot/wt && got up -c $commit_id4 > $testroot/stdout)
3083 0e039681 2021-11-15 stsp echo "D foo" > $testroot/stdout.expected
3084 0e039681 2021-11-15 stsp echo -n "Updated to refs/heads/master: $commit_id4" \
3085 0e039681 2021-11-15 stsp >> $testroot/stdout.expected
3086 0e039681 2021-11-15 stsp echo >> $testroot/stdout.expected
3087 0e039681 2021-11-15 stsp cmp -s $testroot/stdout.expected $testroot/stdout
3088 49c543a6 2022-03-31 naddy ret=$?
3089 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
3090 0e039681 2021-11-15 stsp diff -u $testroot/stdout.expected $testroot/stdout
3091 0e039681 2021-11-15 stsp test_done "$testroot" "$ret"
3092 0e039681 2021-11-15 stsp fi
3093 0e039681 2021-11-15 stsp
3094 0e039681 2021-11-15 stsp if [ -e $testroot/wt/foo ]; then
3095 0e039681 2021-11-15 stsp echo "removed file foo still exists on disk" >&2
3096 0e039681 2021-11-15 stsp test_done "$testroot" "1"
3097 0e039681 2021-11-15 stsp return 1
3098 0e039681 2021-11-15 stsp fi
3099 0e039681 2021-11-15 stsp test_done "$testroot" "0"
3100 67c65ed7 2021-09-14 tracey }
3101 b2b3fce1 2022-10-29 op
3102 b2b3fce1 2022-10-29 op test_update_umask() {
3103 b2b3fce1 2022-10-29 op local testroot=`test_init update_binary_file`
3104 b2b3fce1 2022-10-29 op
3105 b2b3fce1 2022-10-29 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
3106 b2b3fce1 2022-10-29 op ret=$?
3107 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3108 b2b3fce1 2022-10-29 op test_done "$testroot" "$ret"
3109 b2b3fce1 2022-10-29 op return 1
3110 b2b3fce1 2022-10-29 op fi
3111 b2b3fce1 2022-10-29 op
3112 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3113 b2b3fce1 2022-10-29 op
3114 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3115 b2b3fce1 2022-10-29 op (umask 022 && cd "$testroot/wt" && got update alpha) \
3116 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3117 b2b3fce1 2022-10-29 op ret=$?
3118 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3119 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3120 b2b3fce1 2022-10-29 op return 1
3121 b2b3fce1 2022-10-29 op fi
3122 67c65ed7 2021-09-14 tracey
3123 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-r--r--; then
3124 b2b3fce1 2022-10-29 op echo "alpha is not 0644" >&2
3125 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3126 b2b3fce1 2022-10-29 op return 1
3127 b2b3fce1 2022-10-29 op fi
3128 b2b3fce1 2022-10-29 op
3129 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3130 b2b3fce1 2022-10-29 op
3131 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3132 b2b3fce1 2022-10-29 op (umask 044 && cd "$testroot/wt" && got update alpha) \
3133 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3134 b2b3fce1 2022-10-29 op ret=$?
3135 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3136 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3137 b2b3fce1 2022-10-29 op return 1
3138 b2b3fce1 2022-10-29 op fi
3139 b2b3fce1 2022-10-29 op
3140 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
3141 b2b3fce1 2022-10-29 op echo "alpha is not 0600" >&2
3142 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3143 b2b3fce1 2022-10-29 op return 1
3144 b2b3fce1 2022-10-29 op fi
3145 b2b3fce1 2022-10-29 op
3146 b2b3fce1 2022-10-29 op rm "$testroot/wt/alpha"
3147 b2b3fce1 2022-10-29 op
3148 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
3149 b2b3fce1 2022-10-29 op (umask 222 && cd "$testroot/wt" && got update alpha) \
3150 b2b3fce1 2022-10-29 op >/dev/null 2>/dev/null
3151 b2b3fce1 2022-10-29 op ret=$?
3152 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
3153 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
3154 b2b3fce1 2022-10-29 op return 1
3155 b2b3fce1 2022-10-29 op fi
3156 b2b3fce1 2022-10-29 op
3157 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-r--r--r--; then
3158 b2b3fce1 2022-10-29 op echo "alpha is not 0444" >&2
3159 b2b3fce1 2022-10-29 op test_done "$testroot" 1
3160 b2b3fce1 2022-10-29 op return 1;
3161 b2b3fce1 2022-10-29 op fi
3162 b2b3fce1 2022-10-29 op
3163 b2b3fce1 2022-10-29 op test_done "$testroot" 0
3164 b2b3fce1 2022-10-29 op }
3165 b2b3fce1 2022-10-29 op
3166 7fb414ae 2020-08-08 stsp test_parseargs "$@"
3167 c84d8c75 2019-01-02 stsp run_test test_update_basic
3168 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
3169 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
3170 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
3171 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
3172 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
3173 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
3174 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
3175 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
3176 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
3177 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
3178 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
3179 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
3180 c3b9af18 2023-02-26 naddy run_test test_update_changes_file_to_dir
3181 07fa9365 2023-03-10 stsp run_test test_update_changes_modified_file_to_dir
3182 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
3183 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
3184 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
3185 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
3186 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
3187 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
3188 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
3189 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
3190 c4cdcb68 2019-04-03 stsp run_test test_update_partial
3191 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
3192 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
3193 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
3194 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
3195 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
3196 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
3197 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
3198 303e2782 2019-08-09 stsp run_test test_update_tag
3199 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
3200 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file
3201 e7303626 2020-05-14 stsp run_test test_update_modified_submodules
3202 e7303626 2020-05-14 stsp run_test test_update_adds_submodule
3203 e7303626 2020-05-14 stsp run_test test_update_conflict_wt_file_vs_repo_submodule
3204 f35fa46a 2020-07-23 stsp run_test test_update_adds_symlink
3205 993e2a1b 2020-07-23 stsp run_test test_update_deletes_symlink
3206 993e2a1b 2020-07-23 stsp run_test test_update_symlink_conflicts
3207 194cb7cb 2021-01-19 stsp run_test test_update_single_file
3208 a769b60b 2021-06-27 stsp run_test test_update_file_skipped_due_to_conflict
3209 2c41dce7 2021-06-27 stsp run_test test_update_file_skipped_due_to_obstruction
3210 67c65ed7 2021-09-14 tracey run_test test_update_quiet
3211 0e039681 2021-11-15 stsp run_test test_update_binary_file
3212 b2b3fce1 2022-10-29 op run_test test_update_umask