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