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 c84d8c75 2019-01-02 stsp function 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 e60e7f5b 2019-02-10 stsp ret="$?"
24 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 9c4b8182 2019-01-02 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
34 9c4b8182 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
35 9c4b8182 2019-01-02 stsp echo >> $testroot/stdout.expected
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 e60e7f5b 2019-02-10 stsp ret="$?"
41 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
42 c84d8c75 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
43 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
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 693719bc 2019-01-03 stsp ret="$?"
52 693719bc 2019-01-03 stsp if [ "$ret" != "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 3b4d3732 2019-01-02 stsp function 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 e60e7f5b 2019-02-10 stsp ret="$?"
63 e60e7f5b 2019-02-10 stsp if [ "$ret" != "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 3b4d3732 2019-01-02 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
74 3b4d3732 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
75 3b4d3732 2019-01-02 stsp echo >> $testroot/stdout.expected
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 e60e7f5b 2019-02-10 stsp ret="$?"
81 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
82 3b4d3732 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
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 693719bc 2019-01-03 stsp ret="$?"
92 693719bc 2019-01-03 stsp if [ "$ret" != "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 512f0d0e 2019-01-02 stsp function test_update_deletes_file {
99 512f0d0e 2019-01-02 stsp local testroot=`test_init update_deletes_file`
100 512f0d0e 2019-01-02 stsp
101 512f0d0e 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > /dev/null
102 e60e7f5b 2019-02-10 stsp ret="$?"
103 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
104 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
105 512f0d0e 2019-01-02 stsp return 1
106 512f0d0e 2019-01-02 stsp fi
107 512f0d0e 2019-01-02 stsp
108 512f0d0e 2019-01-02 stsp (cd $testroot/repo && git_rm $testroot/repo beta)
109 512f0d0e 2019-01-02 stsp git_commit $testroot/repo -m "deleting a file"
110 512f0d0e 2019-01-02 stsp
111 512f0d0e 2019-01-02 stsp echo "D beta" > $testroot/stdout.expected
112 512f0d0e 2019-01-02 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
113 512f0d0e 2019-01-02 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
114 512f0d0e 2019-01-02 stsp echo >> $testroot/stdout.expected
115 512f0d0e 2019-01-02 stsp
116 512f0d0e 2019-01-02 stsp (cd $testroot/wt && got update > $testroot/stdout)
117 512f0d0e 2019-01-02 stsp
118 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
119 e60e7f5b 2019-02-10 stsp ret="$?"
120 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
121 512f0d0e 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
122 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
123 512f0d0e 2019-01-02 stsp return 1
124 512f0d0e 2019-01-02 stsp fi
125 512f0d0e 2019-01-02 stsp
126 512f0d0e 2019-01-02 stsp if [ -e $testroot/wt/beta ]; then
127 512f0d0e 2019-01-02 stsp echo "removed file beta still exists on disk" >&2
128 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
129 512f0d0e 2019-01-02 stsp return 1
130 512f0d0e 2019-01-02 stsp fi
131 512f0d0e 2019-01-02 stsp
132 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
133 512f0d0e 2019-01-02 stsp }
134 512f0d0e 2019-01-02 stsp
135 f5c49f82 2019-01-06 stsp function test_update_deletes_dir {
136 f5c49f82 2019-01-06 stsp local testroot=`test_init update_deletes_dir`
137 f5c49f82 2019-01-06 stsp
138 f5c49f82 2019-01-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
139 e60e7f5b 2019-02-10 stsp ret="$?"
140 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
141 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
142 f5c49f82 2019-01-06 stsp return 1
143 f5c49f82 2019-01-06 stsp fi
144 f5c49f82 2019-01-06 stsp
145 f5c49f82 2019-01-06 stsp (cd $testroot/repo && git_rm $testroot/repo -r epsilon)
146 f5c49f82 2019-01-06 stsp git_commit $testroot/repo -m "deleting a directory"
147 f5c49f82 2019-01-06 stsp
148 f5c49f82 2019-01-06 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
149 f5c49f82 2019-01-06 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
150 f5c49f82 2019-01-06 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
151 f5c49f82 2019-01-06 stsp echo >> $testroot/stdout.expected
152 f5c49f82 2019-01-06 stsp
153 f5c49f82 2019-01-06 stsp (cd $testroot/wt && got update > $testroot/stdout)
154 f5c49f82 2019-01-06 stsp
155 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
156 e60e7f5b 2019-02-10 stsp ret="$?"
157 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
158 f5c49f82 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
159 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
160 f5c49f82 2019-01-06 stsp return 1
161 f5c49f82 2019-01-06 stsp fi
162 f5c49f82 2019-01-06 stsp
163 f5c49f82 2019-01-06 stsp if [ -e $testroot/wt/epsilon ]; then
164 f5c49f82 2019-01-06 stsp echo "removed dir epsilon still exists on disk" >&2
165 52a3df9b 2019-01-06 stsp test_done "$testroot" "1"
166 f5c49f82 2019-01-06 stsp return 1
167 f5c49f82 2019-01-06 stsp fi
168 f5c49f82 2019-01-06 stsp
169 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
170 f5c49f82 2019-01-06 stsp }
171 f5c49f82 2019-01-06 stsp
172 5cc266ba 2019-01-06 stsp function test_update_deletes_dir_with_path_prefix {
173 5cc266ba 2019-01-06 stsp local testroot=`test_init update_deletes_dir_with_path_prefix`
174 5cc266ba 2019-01-06 stsp local first_rev=`git_show_head $testroot/repo`
175 5cc266ba 2019-01-06 stsp
176 5cc266ba 2019-01-06 stsp mkdir $testroot/repo/epsilon/psi
177 5cc266ba 2019-01-06 stsp echo mu > $testroot/repo/epsilon/psi/mu
178 5cc266ba 2019-01-06 stsp (cd $testroot/repo && git add .)
179 5cc266ba 2019-01-06 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
180 5cc266ba 2019-01-06 stsp
181 5cc266ba 2019-01-06 stsp # check out the epsilon/ sub-tree
182 5cc266ba 2019-01-06 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
183 e60e7f5b 2019-02-10 stsp ret="$?"
184 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
185 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
186 5cc266ba 2019-01-06 stsp return 1
187 5cc266ba 2019-01-06 stsp fi
188 5cc266ba 2019-01-06 stsp
189 5cc266ba 2019-01-06 stsp # update back to first commit and expect psi/mu to be deleted
190 5cc266ba 2019-01-06 stsp echo "D psi/mu" > $testroot/stdout.expected
191 5cc266ba 2019-01-06 stsp echo "Updated to commit $first_rev" >> $testroot/stdout.expected
192 5cc266ba 2019-01-06 stsp
193 5cc266ba 2019-01-06 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
194 5cc266ba 2019-01-06 stsp
195 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
196 e60e7f5b 2019-02-10 stsp ret="$?"
197 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
198 5cc266ba 2019-01-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
199 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
200 5cc266ba 2019-01-06 stsp return 1
201 5cc266ba 2019-01-06 stsp fi
202 5cc266ba 2019-01-06 stsp
203 5cc266ba 2019-01-06 stsp if [ -e $testroot/wt/psi ]; then
204 5cc266ba 2019-01-06 stsp echo "removed dir psi still exists on disk" >&2
205 5cc266ba 2019-01-06 stsp test_done "$testroot" "1"
206 5cc266ba 2019-01-06 stsp return 1
207 5cc266ba 2019-01-06 stsp fi
208 5cc266ba 2019-01-06 stsp
209 52a3df9b 2019-01-06 stsp test_done "$testroot" "0"
210 5cc266ba 2019-01-06 stsp }
211 5cc266ba 2019-01-06 stsp
212 90285c3b 2019-01-08 stsp function test_update_deletes_dir_recursively {
213 90285c3b 2019-01-08 stsp local testroot=`test_init update_deletes_dir_recursively`
214 90285c3b 2019-01-08 stsp local first_rev=`git_show_head $testroot/repo`
215 90285c3b 2019-01-08 stsp
216 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi
217 90285c3b 2019-01-08 stsp echo mu > $testroot/repo/epsilon/psi/mu
218 90285c3b 2019-01-08 stsp mkdir $testroot/repo/epsilon/psi/chi
219 90285c3b 2019-01-08 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
220 90285c3b 2019-01-08 stsp (cd $testroot/repo && git add .)
221 90285c3b 2019-01-08 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
222 90285c3b 2019-01-08 stsp
223 90285c3b 2019-01-08 stsp # check out the epsilon/ sub-tree
224 90285c3b 2019-01-08 stsp got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
225 e60e7f5b 2019-02-10 stsp ret="$?"
226 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
227 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
228 90285c3b 2019-01-08 stsp return 1
229 90285c3b 2019-01-08 stsp fi
230 90285c3b 2019-01-08 stsp
231 90285c3b 2019-01-08 stsp # update back to first commit and expect psi/mu to be deleted
232 90285c3b 2019-01-08 stsp echo "D psi/chi/tau" > $testroot/stdout.expected
233 90285c3b 2019-01-08 stsp echo "D psi/mu" >> $testroot/stdout.expected
234 90285c3b 2019-01-08 stsp echo "Updated to commit $first_rev" >> $testroot/stdout.expected
235 90285c3b 2019-01-08 stsp
236 90285c3b 2019-01-08 stsp (cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
237 90285c3b 2019-01-08 stsp
238 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
239 e60e7f5b 2019-02-10 stsp ret="$?"
240 90285c3b 2019-01-08 stsp if [ "$?" != "0" ]; then
241 90285c3b 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
242 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
243 90285c3b 2019-01-08 stsp return 1
244 90285c3b 2019-01-08 stsp fi
245 90285c3b 2019-01-08 stsp
246 90285c3b 2019-01-08 stsp if [ -e $testroot/wt/psi ]; then
247 90285c3b 2019-01-08 stsp echo "removed dir psi still exists on disk" >&2
248 90285c3b 2019-01-08 stsp test_done "$testroot" "1"
249 90285c3b 2019-01-08 stsp return 1
250 90285c3b 2019-01-08 stsp fi
251 90285c3b 2019-01-08 stsp
252 90285c3b 2019-01-08 stsp test_done "$testroot" "0"
253 90285c3b 2019-01-08 stsp }
254 90285c3b 2019-01-08 stsp
255 4482e97b 2019-01-08 stsp function test_update_sibling_dirs_with_common_prefix {
256 4482e97b 2019-01-08 stsp local testroot=`test_init update_sibling_dirs_with_common_prefix`
257 81a30460 2019-01-08 stsp
258 81a30460 2019-01-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
259 e60e7f5b 2019-02-10 stsp ret="$?"
260 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
261 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
262 81a30460 2019-01-08 stsp return 1
263 81a30460 2019-01-08 stsp fi
264 81a30460 2019-01-08 stsp
265 81a30460 2019-01-08 stsp mkdir $testroot/repo/epsilon2
266 81a30460 2019-01-08 stsp echo mu > $testroot/repo/epsilon2/mu
267 81a30460 2019-01-08 stsp (cd $testroot/repo && git add epsilon2/mu)
268 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
269 81a30460 2019-01-08 stsp echo change > $testroot/repo/epsilon/zeta
270 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
271 81a30460 2019-01-08 stsp
272 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
273 81a30460 2019-01-08 stsp echo "A epsilon2/mu" >> $testroot/stdout.expected
274 81a30460 2019-01-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
275 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
276 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
277 81a30460 2019-01-08 stsp
278 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
279 81a30460 2019-01-08 stsp
280 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
281 e60e7f5b 2019-02-10 stsp ret="$?"
282 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
283 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
284 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
285 81a30460 2019-01-08 stsp return 1
286 81a30460 2019-01-08 stsp fi
287 81a30460 2019-01-08 stsp
288 81a30460 2019-01-08 stsp echo "another change" > $testroot/repo/epsilon/zeta
289 81a30460 2019-01-08 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
290 81a30460 2019-01-08 stsp
291 81a30460 2019-01-08 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
292 81a30460 2019-01-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
293 81a30460 2019-01-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
294 81a30460 2019-01-08 stsp echo >> $testroot/stdout.expected
295 81a30460 2019-01-08 stsp
296 81a30460 2019-01-08 stsp # Bug: This update used to do delete/add epsilon2/mu again:
297 81a30460 2019-01-08 stsp # U epsilon/zeta
298 81a30460 2019-01-08 stsp # D epsilon2/mu <--- not intended
299 81a30460 2019-01-08 stsp # A epsilon2/mu <--- not intended
300 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
301 50952927 2019-01-12 stsp
302 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
303 e60e7f5b 2019-02-10 stsp ret="$?"
304 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
305 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
306 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
307 50952927 2019-01-12 stsp return 1
308 50952927 2019-01-12 stsp fi
309 50952927 2019-01-12 stsp
310 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
311 e60e7f5b 2019-02-10 stsp ret="$?"
312 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
313 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
314 50952927 2019-01-12 stsp fi
315 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
316 50952927 2019-01-12 stsp }
317 50952927 2019-01-12 stsp
318 50952927 2019-01-12 stsp function test_update_dir_with_dot_sibling {
319 50952927 2019-01-12 stsp local testroot=`test_init update_dir_with_dot_sibling`
320 50952927 2019-01-12 stsp
321 50952927 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
322 e60e7f5b 2019-02-10 stsp ret="$ret"
323 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
324 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
325 50952927 2019-01-12 stsp return 1
326 50952927 2019-01-12 stsp fi
327 50952927 2019-01-12 stsp
328 50952927 2019-01-12 stsp echo text > $testroot/repo/epsilon.txt
329 50952927 2019-01-12 stsp (cd $testroot/repo && git add epsilon.txt)
330 50952927 2019-01-12 stsp git_commit $testroot/repo -m "adding sibling of epsilon"
331 50952927 2019-01-12 stsp echo change > $testroot/repo/epsilon/zeta
332 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta"
333 50952927 2019-01-12 stsp
334 f5d3d7af 2019-02-05 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
335 f5d3d7af 2019-02-05 stsp echo "A epsilon.txt" >> $testroot/stdout.expected
336 50952927 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
337 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
338 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
339 50952927 2019-01-12 stsp
340 81a30460 2019-01-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
341 81a30460 2019-01-08 stsp
342 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
343 e60e7f5b 2019-02-10 stsp ret="$?"
344 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
345 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
346 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
347 81a30460 2019-01-08 stsp return 1
348 81a30460 2019-01-08 stsp fi
349 81a30460 2019-01-08 stsp
350 50952927 2019-01-12 stsp echo "another change" > $testroot/repo/epsilon/zeta
351 50952927 2019-01-12 stsp git_commit $testroot/repo -m "changing epsilon/zeta again"
352 50952927 2019-01-12 stsp
353 50952927 2019-01-12 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
354 50952927 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
355 50952927 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
356 50952927 2019-01-12 stsp echo >> $testroot/stdout.expected
357 50952927 2019-01-12 stsp
358 50952927 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
359 50952927 2019-01-12 stsp
360 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
361 e60e7f5b 2019-02-10 stsp ret="$?"
362 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
363 81a30460 2019-01-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
364 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
365 81a30460 2019-01-08 stsp return 1
366 81a30460 2019-01-08 stsp fi
367 81a30460 2019-01-08 stsp
368 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
369 e60e7f5b 2019-02-10 stsp ret="$?"
370 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
371 50952927 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
372 50952927 2019-01-12 stsp fi
373 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
374 81a30460 2019-01-08 stsp }
375 46cee7a3 2019-01-12 stsp
376 46cee7a3 2019-01-12 stsp function test_update_moves_files_upwards {
377 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_upwards`
378 46cee7a3 2019-01-12 stsp
379 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
380 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
381 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
382 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
383 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
384 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
385 46cee7a3 2019-01-12 stsp
386 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
387 e60e7f5b 2019-02-10 stsp ret="$?"
388 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
389 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
390 46cee7a3 2019-01-12 stsp return 1
391 46cee7a3 2019-01-12 stsp fi
392 81a30460 2019-01-08 stsp
393 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu)
394 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon/psi/tau)
395 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
396 46cee7a3 2019-01-12 stsp
397 21908da4 2019-01-13 stsp echo "A epsilon/mu" > $testroot/stdout.expected
398 21908da4 2019-01-13 stsp echo "D epsilon/psi/chi/tau" >> $testroot/stdout.expected
399 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
400 bd4792ec 2019-01-13 stsp echo "A epsilon/psi/tau" >> $testroot/stdout.expected
401 46cee7a3 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
402 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
403 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
404 46cee7a3 2019-01-12 stsp
405 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
406 46cee7a3 2019-01-12 stsp
407 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
408 e60e7f5b 2019-02-10 stsp ret="$?"
409 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
410 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
411 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
412 46cee7a3 2019-01-12 stsp return 1
413 46cee7a3 2019-01-12 stsp fi
414 46cee7a3 2019-01-12 stsp
415 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
416 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
417 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
418 46cee7a3 2019-01-12 stsp return 1
419 46cee7a3 2019-01-12 stsp fi
420 46cee7a3 2019-01-12 stsp
421 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
422 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
423 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
424 46cee7a3 2019-01-12 stsp return 1
425 46cee7a3 2019-01-12 stsp fi
426 46cee7a3 2019-01-12 stsp
427 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
428 46cee7a3 2019-01-12 stsp }
429 46cee7a3 2019-01-12 stsp
430 46cee7a3 2019-01-12 stsp function test_update_moves_files_to_new_dir {
431 46cee7a3 2019-01-12 stsp local testroot=`test_init update_moves_files_to_new_dir`
432 46cee7a3 2019-01-12 stsp
433 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi
434 46cee7a3 2019-01-12 stsp echo mu > $testroot/repo/epsilon/psi/mu
435 46cee7a3 2019-01-12 stsp mkdir $testroot/repo/epsilon/psi/chi
436 46cee7a3 2019-01-12 stsp echo tau > $testroot/repo/epsilon/psi/chi/tau
437 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git add .)
438 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "adding a sub-directory beneath epsilon"
439 46cee7a3 2019-01-12 stsp
440 46cee7a3 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
441 e60e7f5b 2019-02-10 stsp ret="$?"
442 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
443 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
444 46cee7a3 2019-01-12 stsp return 1
445 46cee7a3 2019-01-12 stsp fi
446 46cee7a3 2019-01-12 stsp
447 46cee7a3 2019-01-12 stsp mkdir -p $testroot/repo/epsilon-new/psi
448 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu)
449 46cee7a3 2019-01-12 stsp (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon-new/psi/tau)
450 46cee7a3 2019-01-12 stsp git_commit $testroot/repo -m "moving files upwards"
451 46cee7a3 2019-01-12 stsp
452 f5d3d7af 2019-02-05 stsp echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected
453 46cee7a3 2019-01-12 stsp echo "D epsilon/psi/mu" >> $testroot/stdout.expected
454 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/mu" >> $testroot/stdout.expected
455 f5d3d7af 2019-02-05 stsp echo "A epsilon-new/psi/tau" >> $testroot/stdout.expected
456 46cee7a3 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
457 46cee7a3 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
458 46cee7a3 2019-01-12 stsp echo >> $testroot/stdout.expected
459 46cee7a3 2019-01-12 stsp
460 46cee7a3 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
461 46cee7a3 2019-01-12 stsp
462 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
463 e60e7f5b 2019-02-10 stsp ret="$?"
464 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
465 46cee7a3 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
466 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
467 46cee7a3 2019-01-12 stsp return 1
468 46cee7a3 2019-01-12 stsp fi
469 46cee7a3 2019-01-12 stsp
470 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/chi ]; then
471 46cee7a3 2019-01-12 stsp echo "removed dir epsilon/psi/chi still exists on disk" >&2
472 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
473 46cee7a3 2019-01-12 stsp return 1
474 46cee7a3 2019-01-12 stsp fi
475 46cee7a3 2019-01-12 stsp
476 46cee7a3 2019-01-12 stsp if [ -e $testroot/wt/epsilon/psi/mu ]; then
477 46cee7a3 2019-01-12 stsp echo "removed file epsilon/psi/mu still exists on disk" >&2
478 46cee7a3 2019-01-12 stsp test_done "$testroot" "1"
479 4a1ddfc2 2019-01-12 stsp return 1
480 4a1ddfc2 2019-01-12 stsp fi
481 4a1ddfc2 2019-01-12 stsp
482 4a1ddfc2 2019-01-12 stsp test_done "$testroot" "0"
483 4a1ddfc2 2019-01-12 stsp }
484 4a1ddfc2 2019-01-12 stsp
485 4a1ddfc2 2019-01-12 stsp function test_update_creates_missing_parent {
486 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent 1`
487 4a1ddfc2 2019-01-12 stsp
488 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/Makefile
489 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.6
490 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake.c
491 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
492 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "adding initial snake tree"
493 4a1ddfc2 2019-01-12 stsp
494 4a1ddfc2 2019-01-12 stsp got checkout $testroot/repo $testroot/wt > /dev/null
495 e60e7f5b 2019-02-10 stsp ret="$?"
496 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
497 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
498 4a1ddfc2 2019-01-12 stsp return 1
499 4a1ddfc2 2019-01-12 stsp fi
500 4a1ddfc2 2019-01-12 stsp
501 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snake
502 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c snake)
503 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/move.c
504 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/pathnames.h
505 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snake/snake.h
506 4a1ddfc2 2019-01-12 stsp mkdir -p $testroot/repo/snscore
507 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/Makefile
508 4a1ddfc2 2019-01-12 stsp touch $testroot/repo/snscore/snscore.c
509 4a1ddfc2 2019-01-12 stsp (cd $testroot/repo && git add .)
510 4a1ddfc2 2019-01-12 stsp git_commit $testroot/repo -m "restructuring snake tree"
511 4a1ddfc2 2019-01-12 stsp
512 4a1ddfc2 2019-01-12 stsp echo "D Makefile" > $testroot/stdout.expected
513 4a1ddfc2 2019-01-12 stsp echo "A snake/Makefile" >> $testroot/stdout.expected
514 4a1ddfc2 2019-01-12 stsp echo "A snake/move.c" >> $testroot/stdout.expected
515 4a1ddfc2 2019-01-12 stsp echo "A snake/pathnames.h" >> $testroot/stdout.expected
516 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.6" >> $testroot/stdout.expected
517 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.c" >> $testroot/stdout.expected
518 4a1ddfc2 2019-01-12 stsp echo "A snake/snake.h" >> $testroot/stdout.expected
519 18831e78 2019-02-10 stsp echo "D snake.6" >> $testroot/stdout.expected
520 18831e78 2019-02-10 stsp echo "D snake.c" >> $testroot/stdout.expected
521 bd4792ec 2019-01-13 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
522 bd4792ec 2019-01-13 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
523 bd4792ec 2019-01-13 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
524 bd4792ec 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
525 bd4792ec 2019-01-13 stsp echo >> $testroot/stdout.expected
526 bd4792ec 2019-01-13 stsp
527 bd4792ec 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
528 bd4792ec 2019-01-13 stsp
529 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
530 e60e7f5b 2019-02-10 stsp ret="$?"
531 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
532 e60e7f5b 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
533 bd4792ec 2019-01-13 stsp fi
534 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
535 bd4792ec 2019-01-13 stsp }
536 bd4792ec 2019-01-13 stsp
537 bd4792ec 2019-01-13 stsp function test_update_creates_missing_parent_with_subdir {
538 1aad446a 2019-01-13 stsp local testroot=`test_init update_creates_missing_parent_with_subdir 1`
539 bd4792ec 2019-01-13 stsp
540 bd4792ec 2019-01-13 stsp touch $testroot/repo/Makefile
541 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.6
542 bd4792ec 2019-01-13 stsp touch $testroot/repo/snake.c
543 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
544 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "adding initial snake tree"
545 bd4792ec 2019-01-13 stsp
546 bd4792ec 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
547 e60e7f5b 2019-02-10 stsp ret="$?"
548 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
549 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
550 bd4792ec 2019-01-13 stsp return 1
551 bd4792ec 2019-01-13 stsp fi
552 bd4792ec 2019-01-13 stsp
553 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/sss/snake
554 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git mv Makefile snake.6 snake.c sss/snake)
555 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/move.c
556 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/pathnames.h
557 bd4792ec 2019-01-13 stsp touch $testroot/repo/sss/snake/snake.h
558 bd4792ec 2019-01-13 stsp mkdir -p $testroot/repo/snscore
559 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/Makefile
560 bd4792ec 2019-01-13 stsp touch $testroot/repo/snscore/snscore.c
561 bd4792ec 2019-01-13 stsp (cd $testroot/repo && git add .)
562 bd4792ec 2019-01-13 stsp git_commit $testroot/repo -m "restructuring snake tree"
563 bd4792ec 2019-01-13 stsp
564 bd4792ec 2019-01-13 stsp echo "D Makefile" > $testroot/stdout.expected
565 4a1ddfc2 2019-01-12 stsp echo "D snake.6" >> $testroot/stdout.expected
566 4a1ddfc2 2019-01-12 stsp echo "D snake.c" >> $testroot/stdout.expected
567 4a1ddfc2 2019-01-12 stsp echo "A snscore/Makefile" >> $testroot/stdout.expected
568 4a1ddfc2 2019-01-12 stsp echo "A snscore/snscore.c" >> $testroot/stdout.expected
569 bd4792ec 2019-01-13 stsp echo "A sss/snake/Makefile" >> $testroot/stdout.expected
570 bd4792ec 2019-01-13 stsp echo "A sss/snake/move.c" >> $testroot/stdout.expected
571 bd4792ec 2019-01-13 stsp echo "A sss/snake/pathnames.h" >> $testroot/stdout.expected
572 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.6" >> $testroot/stdout.expected
573 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.c" >> $testroot/stdout.expected
574 bd4792ec 2019-01-13 stsp echo "A sss/snake/snake.h" >> $testroot/stdout.expected
575 4a1ddfc2 2019-01-12 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
576 4a1ddfc2 2019-01-12 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
577 4a1ddfc2 2019-01-12 stsp echo >> $testroot/stdout.expected
578 4a1ddfc2 2019-01-12 stsp
579 4a1ddfc2 2019-01-12 stsp (cd $testroot/wt && got update > $testroot/stdout)
580 4a1ddfc2 2019-01-12 stsp
581 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
582 e60e7f5b 2019-02-10 stsp ret="$?"
583 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
584 4a1ddfc2 2019-01-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
585 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
586 46cee7a3 2019-01-12 stsp return 1
587 46cee7a3 2019-01-12 stsp fi
588 46cee7a3 2019-01-12 stsp
589 46cee7a3 2019-01-12 stsp test_done "$testroot" "0"
590 46cee7a3 2019-01-12 stsp }
591 21908da4 2019-01-13 stsp
592 21908da4 2019-01-13 stsp function test_update_file_in_subsubdir {
593 1aad446a 2019-01-13 stsp local testroot=`test_init update_fle_in_subsubdir 1`
594 46cee7a3 2019-01-12 stsp
595 21908da4 2019-01-13 stsp touch $testroot/repo/Makefile
596 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/altq
597 21908da4 2019-01-13 stsp touch $testroot/repo/altq/if_altq.h
598 21908da4 2019-01-13 stsp mkdir -p $testroot/repo/arch/alpha
599 21908da4 2019-01-13 stsp touch $testroot/repo/arch/alpha/Makefile
600 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
601 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "adding initial tree"
602 21908da4 2019-01-13 stsp
603 21908da4 2019-01-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
604 e60e7f5b 2019-02-10 stsp ret="$?"
605 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
606 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
607 21908da4 2019-01-13 stsp return 1
608 21908da4 2019-01-13 stsp fi
609 21908da4 2019-01-13 stsp
610 21908da4 2019-01-13 stsp echo change > $testroot/repo/arch/alpha/Makefile
611 21908da4 2019-01-13 stsp (cd $testroot/repo && git add .)
612 21908da4 2019-01-13 stsp git_commit $testroot/repo -m "changed a file"
613 21908da4 2019-01-13 stsp
614 21908da4 2019-01-13 stsp echo "U arch/alpha/Makefile" > $testroot/stdout.expected
615 21908da4 2019-01-13 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
616 21908da4 2019-01-13 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
617 21908da4 2019-01-13 stsp echo >> $testroot/stdout.expected
618 21908da4 2019-01-13 stsp
619 21908da4 2019-01-13 stsp (cd $testroot/wt && got update > $testroot/stdout)
620 21908da4 2019-01-13 stsp
621 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
622 e60e7f5b 2019-02-10 stsp ret="$?"
623 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
624 21908da4 2019-01-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
625 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
626 21908da4 2019-01-13 stsp return 1
627 21908da4 2019-01-13 stsp fi
628 21908da4 2019-01-13 stsp
629 21908da4 2019-01-13 stsp test_done "$testroot" "0"
630 21908da4 2019-01-13 stsp }
631 6353ad76 2019-02-08 stsp
632 6353ad76 2019-02-08 stsp function test_update_merges_file_edits {
633 6353ad76 2019-02-08 stsp local testroot=`test_init update_merges_file_edits`
634 6353ad76 2019-02-08 stsp
635 6353ad76 2019-02-08 stsp echo "1" > $testroot/repo/numbers
636 6353ad76 2019-02-08 stsp echo "2" >> $testroot/repo/numbers
637 6353ad76 2019-02-08 stsp echo "3" >> $testroot/repo/numbers
638 6353ad76 2019-02-08 stsp echo "4" >> $testroot/repo/numbers
639 6353ad76 2019-02-08 stsp echo "5" >> $testroot/repo/numbers
640 6353ad76 2019-02-08 stsp echo "6" >> $testroot/repo/numbers
641 6353ad76 2019-02-08 stsp echo "7" >> $testroot/repo/numbers
642 6353ad76 2019-02-08 stsp echo "8" >> $testroot/repo/numbers
643 6353ad76 2019-02-08 stsp (cd $testroot/repo && git add numbers)
644 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "added numbers file"
645 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
646 21908da4 2019-01-13 stsp
647 6353ad76 2019-02-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
648 e60e7f5b 2019-02-10 stsp ret="$?"
649 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
650 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
651 6353ad76 2019-02-08 stsp return 1
652 6353ad76 2019-02-08 stsp fi
653 6353ad76 2019-02-08 stsp
654 6353ad76 2019-02-08 stsp echo "modified alpha" > $testroot/repo/alpha
655 6353ad76 2019-02-08 stsp echo "modified beta" > $testroot/repo/beta
656 6353ad76 2019-02-08 stsp sed -i 's/2/22/' $testroot/repo/numbers
657 6353ad76 2019-02-08 stsp git_commit $testroot/repo -m "modified 3 files"
658 6353ad76 2019-02-08 stsp
659 6353ad76 2019-02-08 stsp echo "modified alpha, too" > $testroot/wt/alpha
660 6353ad76 2019-02-08 stsp touch $testroot/wt/beta
661 6353ad76 2019-02-08 stsp sed -i 's/7/77/' $testroot/wt/numbers
662 6353ad76 2019-02-08 stsp
663 6353ad76 2019-02-08 stsp echo "C alpha" > $testroot/stdout.expected
664 6353ad76 2019-02-08 stsp echo "U beta" >> $testroot/stdout.expected
665 6353ad76 2019-02-08 stsp echo "G numbers" >> $testroot/stdout.expected
666 6353ad76 2019-02-08 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
667 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
668 6353ad76 2019-02-08 stsp echo >> $testroot/stdout.expected
669 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
670 6353ad76 2019-02-08 stsp
671 6353ad76 2019-02-08 stsp (cd $testroot/wt && got update > $testroot/stdout)
672 6353ad76 2019-02-08 stsp
673 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
674 e60e7f5b 2019-02-10 stsp ret="$?"
675 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
676 6353ad76 2019-02-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
677 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
678 6353ad76 2019-02-08 stsp return 1
679 6353ad76 2019-02-08 stsp fi
680 6353ad76 2019-02-08 stsp
681 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
682 6353ad76 2019-02-08 stsp git_show_head $testroot/repo >> $testroot/content.expected
683 6353ad76 2019-02-08 stsp echo >> $testroot/content.expected
684 6353ad76 2019-02-08 stsp echo "modified alpha" >> $testroot/content.expected
685 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
686 f69721c3 2019-10-21 stsp >> $testroot/content.expected
687 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
688 6353ad76 2019-02-08 stsp echo "=======" >> $testroot/content.expected
689 6353ad76 2019-02-08 stsp echo "modified alpha, too" >> $testroot/content.expected
690 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
691 6353ad76 2019-02-08 stsp echo "modified beta" >> $testroot/content.expected
692 6353ad76 2019-02-08 stsp echo "1" >> $testroot/content.expected
693 6353ad76 2019-02-08 stsp echo "22" >> $testroot/content.expected
694 6353ad76 2019-02-08 stsp echo "3" >> $testroot/content.expected
695 6353ad76 2019-02-08 stsp echo "4" >> $testroot/content.expected
696 6353ad76 2019-02-08 stsp echo "5" >> $testroot/content.expected
697 6353ad76 2019-02-08 stsp echo "6" >> $testroot/content.expected
698 6353ad76 2019-02-08 stsp echo "77" >> $testroot/content.expected
699 6353ad76 2019-02-08 stsp echo "8" >> $testroot/content.expected
700 6353ad76 2019-02-08 stsp
701 6353ad76 2019-02-08 stsp cat $testroot/wt/alpha > $testroot/content
702 6353ad76 2019-02-08 stsp cat $testroot/wt/beta >> $testroot/content
703 6353ad76 2019-02-08 stsp cat $testroot/wt/numbers >> $testroot/content
704 6353ad76 2019-02-08 stsp
705 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
706 6353ad76 2019-02-08 stsp ret="$?"
707 6353ad76 2019-02-08 stsp if [ "$ret" != "0" ]; then
708 6353ad76 2019-02-08 stsp diff -u $testroot/content.expected $testroot/content
709 68ed9ba5 2019-02-10 stsp fi
710 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
711 68ed9ba5 2019-02-10 stsp }
712 68ed9ba5 2019-02-10 stsp
713 68ed9ba5 2019-02-10 stsp function test_update_keeps_xbit {
714 68ed9ba5 2019-02-10 stsp local testroot=`test_init update_keeps_xbit 1`
715 68ed9ba5 2019-02-10 stsp
716 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
717 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
718 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
719 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
720 68ed9ba5 2019-02-10 stsp
721 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
722 68ed9ba5 2019-02-10 stsp ret="$?"
723 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
724 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
725 68ed9ba5 2019-02-10 stsp return 1
726 68ed9ba5 2019-02-10 stsp fi
727 68ed9ba5 2019-02-10 stsp
728 68ed9ba5 2019-02-10 stsp echo foo > $testroot/repo/xfile
729 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "changed executable file"
730 68ed9ba5 2019-02-10 stsp
731 68ed9ba5 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
732 68ed9ba5 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
733 68ed9ba5 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
734 68ed9ba5 2019-02-10 stsp echo >> $testroot/stdout.expected
735 68ed9ba5 2019-02-10 stsp
736 68ed9ba5 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
737 68ed9ba5 2019-02-10 stsp ret="$?"
738 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
739 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
740 68ed9ba5 2019-02-10 stsp return 1
741 6353ad76 2019-02-08 stsp fi
742 68ed9ba5 2019-02-10 stsp
743 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
744 68ed9ba5 2019-02-10 stsp ret="$?"
745 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
746 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
747 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
748 68ed9ba5 2019-02-10 stsp return 1
749 68ed9ba5 2019-02-10 stsp fi
750 68ed9ba5 2019-02-10 stsp
751 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
752 68ed9ba5 2019-02-10 stsp ret="$?"
753 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
754 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
755 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
756 68ed9ba5 2019-02-10 stsp fi
757 6353ad76 2019-02-08 stsp test_done "$testroot" "$ret"
758 6353ad76 2019-02-08 stsp }
759 ba8a0d4d 2019-02-10 stsp
760 ba8a0d4d 2019-02-10 stsp function test_update_clears_xbit {
761 ba8a0d4d 2019-02-10 stsp local testroot=`test_init update_clears_xbit 1`
762 ba8a0d4d 2019-02-10 stsp
763 ba8a0d4d 2019-02-10 stsp touch $testroot/repo/xfile
764 ba8a0d4d 2019-02-10 stsp chmod +x $testroot/repo/xfile
765 ba8a0d4d 2019-02-10 stsp (cd $testroot/repo && git add .)
766 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
767 6353ad76 2019-02-08 stsp
768 ba8a0d4d 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
769 ba8a0d4d 2019-02-10 stsp ret="$?"
770 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
771 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
772 ba8a0d4d 2019-02-10 stsp return 1
773 ba8a0d4d 2019-02-10 stsp fi
774 ba8a0d4d 2019-02-10 stsp
775 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
776 ba8a0d4d 2019-02-10 stsp ret="$?"
777 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
778 ba8a0d4d 2019-02-10 stsp echo "file is not executable" >&2
779 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
780 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
781 ba8a0d4d 2019-02-10 stsp return 1
782 ba8a0d4d 2019-02-10 stsp fi
783 ba8a0d4d 2019-02-10 stsp
784 ba8a0d4d 2019-02-10 stsp # XXX git seems to require a file edit when flipping the x bit?
785 ba8a0d4d 2019-02-10 stsp echo foo > $testroot/repo/xfile
786 ba8a0d4d 2019-02-10 stsp chmod -x $testroot/repo/xfile
787 ba8a0d4d 2019-02-10 stsp git_commit $testroot/repo -m "not an executable file anymore"
788 ba8a0d4d 2019-02-10 stsp
789 ba8a0d4d 2019-02-10 stsp echo "U xfile" > $testroot/stdout.expected
790 ba8a0d4d 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
791 ba8a0d4d 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
792 ba8a0d4d 2019-02-10 stsp echo >> $testroot/stdout.expected
793 ba8a0d4d 2019-02-10 stsp
794 ba8a0d4d 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
795 ba8a0d4d 2019-02-10 stsp ret="$?"
796 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
797 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
798 ba8a0d4d 2019-02-10 stsp return 1
799 ba8a0d4d 2019-02-10 stsp fi
800 ba8a0d4d 2019-02-10 stsp
801 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
802 ba8a0d4d 2019-02-10 stsp ret="$?"
803 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
804 ba8a0d4d 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
805 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
806 ba8a0d4d 2019-02-10 stsp return 1
807 ba8a0d4d 2019-02-10 stsp fi
808 ba8a0d4d 2019-02-10 stsp
809 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
810 ba8a0d4d 2019-02-10 stsp ret="$?"
811 ba8a0d4d 2019-02-10 stsp if [ "$ret" != "0" ]; then
812 ba8a0d4d 2019-02-10 stsp echo "file is unexpectedly executable" >&2
813 ba8a0d4d 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
814 ba8a0d4d 2019-02-10 stsp fi
815 ba8a0d4d 2019-02-10 stsp test_done "$testroot" "$ret"
816 ba8a0d4d 2019-02-10 stsp }
817 a378724f 2019-02-10 stsp
818 a378724f 2019-02-10 stsp function test_update_restores_missing_file {
819 a378724f 2019-02-10 stsp local testroot=`test_init update_restores_missing_file`
820 a378724f 2019-02-10 stsp
821 a378724f 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
822 a378724f 2019-02-10 stsp ret="$?"
823 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
824 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
825 a378724f 2019-02-10 stsp return 1
826 a378724f 2019-02-10 stsp fi
827 ba8a0d4d 2019-02-10 stsp
828 a378724f 2019-02-10 stsp rm $testroot/wt/alpha
829 a378724f 2019-02-10 stsp
830 a378724f 2019-02-10 stsp echo "! alpha" > $testroot/stdout.expected
831 1545c615 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
832 1545c615 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
833 1545c615 2019-02-10 stsp echo >> $testroot/stdout.expected
834 a378724f 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
835 a378724f 2019-02-10 stsp
836 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
837 a378724f 2019-02-10 stsp ret="$?"
838 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
839 a378724f 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
840 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
841 a378724f 2019-02-10 stsp return 1
842 a378724f 2019-02-10 stsp fi
843 a378724f 2019-02-10 stsp
844 a378724f 2019-02-10 stsp echo "alpha" > $testroot/content.expected
845 a378724f 2019-02-10 stsp
846 a378724f 2019-02-10 stsp cat $testroot/wt/alpha > $testroot/content
847 1430b4e0 2019-03-27 stsp
848 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
849 1430b4e0 2019-03-27 stsp ret="$?"
850 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
851 1430b4e0 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
852 1430b4e0 2019-03-27 stsp fi
853 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
854 1430b4e0 2019-03-27 stsp }
855 1430b4e0 2019-03-27 stsp
856 085d5bcf 2019-03-27 stsp function test_update_conflict_wt_add_vs_repo_add {
857 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_add_vs_repo_add`
858 1430b4e0 2019-03-27 stsp
859 1430b4e0 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
860 1430b4e0 2019-03-27 stsp ret="$?"
861 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
862 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
863 1430b4e0 2019-03-27 stsp return 1
864 1430b4e0 2019-03-27 stsp fi
865 1430b4e0 2019-03-27 stsp
866 1430b4e0 2019-03-27 stsp echo "new" > $testroot/repo/gamma/new
867 1430b4e0 2019-03-27 stsp (cd $testroot/repo && git add .)
868 1430b4e0 2019-03-27 stsp git_commit $testroot/repo -m "adding a new file"
869 1430b4e0 2019-03-27 stsp
870 1430b4e0 2019-03-27 stsp echo "also new" > $testroot/wt/gamma/new
871 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got add gamma/new >/dev/null)
872 1430b4e0 2019-03-27 stsp
873 1430b4e0 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
874 a378724f 2019-02-10 stsp
875 1430b4e0 2019-03-27 stsp echo "C gamma/new" > $testroot/stdout.expected
876 1430b4e0 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
877 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
878 1430b4e0 2019-03-27 stsp echo >> $testroot/stdout.expected
879 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
880 9627c110 2020-04-18 stsp
881 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
882 1430b4e0 2019-03-27 stsp ret="$?"
883 1430b4e0 2019-03-27 stsp if [ "$ret" != "0" ]; then
884 1430b4e0 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
885 1430b4e0 2019-03-27 stsp test_done "$testroot" "$ret"
886 1430b4e0 2019-03-27 stsp return 1
887 1430b4e0 2019-03-27 stsp fi
888 1430b4e0 2019-03-27 stsp
889 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
890 1430b4e0 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/content.expected
891 1430b4e0 2019-03-27 stsp echo >> $testroot/content.expected
892 1430b4e0 2019-03-27 stsp echo "new" >> $testroot/content.expected
893 1430b4e0 2019-03-27 stsp echo "=======" >> $testroot/content.expected
894 1430b4e0 2019-03-27 stsp echo "also new" >> $testroot/content.expected
895 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
896 1430b4e0 2019-03-27 stsp
897 1430b4e0 2019-03-27 stsp cat $testroot/wt/gamma/new > $testroot/content
898 1430b4e0 2019-03-27 stsp
899 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
900 a378724f 2019-02-10 stsp ret="$?"
901 a378724f 2019-02-10 stsp if [ "$ret" != "0" ]; then
902 a378724f 2019-02-10 stsp diff -u $testroot/content.expected $testroot/content
903 3165301c 2019-03-27 stsp test_done "$testroot" "$ret"
904 3165301c 2019-03-27 stsp return 1
905 3165301c 2019-03-27 stsp fi
906 3165301c 2019-03-27 stsp
907 3165301c 2019-03-27 stsp # resolve the conflict
908 3165301c 2019-03-27 stsp echo "new and also new" > $testroot/wt/gamma/new
909 3165301c 2019-03-27 stsp echo 'M gamma/new' > $testroot/stdout.expected
910 3165301c 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
911 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
912 3165301c 2019-03-27 stsp ret="$?"
913 3165301c 2019-03-27 stsp if [ "$ret" != "0" ]; then
914 3165301c 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
915 a378724f 2019-02-10 stsp fi
916 a378724f 2019-02-10 stsp test_done "$testroot" "$ret"
917 a378724f 2019-02-10 stsp }
918 708d8e67 2019-03-27 stsp
919 085d5bcf 2019-03-27 stsp function test_update_conflict_wt_edit_vs_repo_rm {
920 085d5bcf 2019-03-27 stsp local testroot=`test_init update_conflict_wt_edit_vs_repo_rm`
921 708d8e67 2019-03-27 stsp
922 708d8e67 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
923 708d8e67 2019-03-27 stsp ret="$?"
924 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
925 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
926 708d8e67 2019-03-27 stsp return 1
927 708d8e67 2019-03-27 stsp fi
928 708d8e67 2019-03-27 stsp
929 708d8e67 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
930 708d8e67 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
931 708d8e67 2019-03-27 stsp
932 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/wt/beta
933 a378724f 2019-02-10 stsp
934 708d8e67 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
935 708d8e67 2019-03-27 stsp
936 fc6346c4 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
937 708d8e67 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
938 708d8e67 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
939 708d8e67 2019-03-27 stsp echo >> $testroot/stdout.expected
940 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
941 708d8e67 2019-03-27 stsp ret="$?"
942 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
943 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
944 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
945 708d8e67 2019-03-27 stsp return 1
946 708d8e67 2019-03-27 stsp fi
947 708d8e67 2019-03-27 stsp
948 708d8e67 2019-03-27 stsp echo "modified beta" > $testroot/content.expected
949 708d8e67 2019-03-27 stsp
950 708d8e67 2019-03-27 stsp cat $testroot/wt/beta > $testroot/content
951 708d8e67 2019-03-27 stsp
952 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
953 708d8e67 2019-03-27 stsp ret="$?"
954 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
955 708d8e67 2019-03-27 stsp diff -u $testroot/content.expected $testroot/content
956 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
957 708d8e67 2019-03-27 stsp return 1
958 708d8e67 2019-03-27 stsp fi
959 708d8e67 2019-03-27 stsp
960 fc6346c4 2019-03-27 stsp # beta is now an added file... we don't flag tree conflicts yet
961 fc6346c4 2019-03-27 stsp echo 'A beta' > $testroot/stdout.expected
962 13d9040b 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
963 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
964 13d9040b 2019-03-27 stsp ret="$?"
965 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
966 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
967 13d9040b 2019-03-27 stsp fi
968 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
969 13d9040b 2019-03-27 stsp }
970 13d9040b 2019-03-27 stsp
971 13d9040b 2019-03-27 stsp function test_update_conflict_wt_rm_vs_repo_edit {
972 13d9040b 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_edit`
973 13d9040b 2019-03-27 stsp
974 13d9040b 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
975 13d9040b 2019-03-27 stsp ret="$?"
976 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
977 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
978 13d9040b 2019-03-27 stsp return 1
979 13d9040b 2019-03-27 stsp fi
980 13d9040b 2019-03-27 stsp
981 13d9040b 2019-03-27 stsp echo "modified beta" > $testroot/repo/beta
982 13d9040b 2019-03-27 stsp git_commit $testroot/repo -m "modified a file"
983 13d9040b 2019-03-27 stsp
984 13d9040b 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
985 13d9040b 2019-03-27 stsp
986 13d9040b 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
987 13d9040b 2019-03-27 stsp
988 13d9040b 2019-03-27 stsp echo "G beta" > $testroot/stdout.expected
989 13d9040b 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
990 13d9040b 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
991 13d9040b 2019-03-27 stsp echo >> $testroot/stdout.expected
992 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
993 13d9040b 2019-03-27 stsp ret="$?"
994 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
995 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
996 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
997 13d9040b 2019-03-27 stsp return 1
998 13d9040b 2019-03-27 stsp fi
999 13d9040b 2019-03-27 stsp
1000 13d9040b 2019-03-27 stsp # beta remains a deleted file... we don't flag tree conflicts yet
1001 13d9040b 2019-03-27 stsp echo 'D beta' > $testroot/stdout.expected
1002 708d8e67 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
1003 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1004 708d8e67 2019-03-27 stsp ret="$?"
1005 708d8e67 2019-03-27 stsp if [ "$ret" != "0" ]; then
1006 708d8e67 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1007 13d9040b 2019-03-27 stsp test_done "$testroot" "$ret"
1008 13d9040b 2019-03-27 stsp return 1
1009 708d8e67 2019-03-27 stsp fi
1010 13d9040b 2019-03-27 stsp
1011 13d9040b 2019-03-27 stsp # 'got diff' should show post-update contents of beta being deleted
1012 13d9040b 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
1013 13d9040b 2019-03-27 stsp echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
1014 13d9040b 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1015 13d9040b 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1016 13d9040b 2019-03-27 stsp >> $testroot/stdout.expected
1017 13d9040b 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
1018 13d9040b 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
1019 13d9040b 2019-03-27 stsp echo '+++ beta' >> $testroot/stdout.expected
1020 13d9040b 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1021 13d9040b 2019-03-27 stsp echo '-modified beta' >> $testroot/stdout.expected
1022 13d9040b 2019-03-27 stsp
1023 13d9040b 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
1024 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1025 13d9040b 2019-03-27 stsp ret="$?"
1026 13d9040b 2019-03-27 stsp if [ "$ret" != "0" ]; then
1027 13d9040b 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1028 13d9040b 2019-03-27 stsp fi
1029 708d8e67 2019-03-27 stsp test_done "$testroot" "$ret"
1030 66b11bf5 2019-03-27 stsp }
1031 66b11bf5 2019-03-27 stsp
1032 66b11bf5 2019-03-27 stsp function test_update_conflict_wt_rm_vs_repo_rm {
1033 66b11bf5 2019-03-27 stsp local testroot=`test_init update_conflict_wt_rm_vs_repo_rm`
1034 66b11bf5 2019-03-27 stsp
1035 66b11bf5 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1036 66b11bf5 2019-03-27 stsp ret="$?"
1037 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1038 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1039 66b11bf5 2019-03-27 stsp return 1
1040 66b11bf5 2019-03-27 stsp fi
1041 66b11bf5 2019-03-27 stsp
1042 66b11bf5 2019-03-27 stsp (cd $testroot/repo && git rm -q beta)
1043 66b11bf5 2019-03-27 stsp git_commit $testroot/repo -m "removing a file"
1044 66b11bf5 2019-03-27 stsp
1045 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
1046 66b11bf5 2019-03-27 stsp
1047 66b11bf5 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
1048 66b11bf5 2019-03-27 stsp
1049 66b11bf5 2019-03-27 stsp echo "D beta" > $testroot/stdout.expected
1050 66b11bf5 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1051 66b11bf5 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1052 66b11bf5 2019-03-27 stsp echo >> $testroot/stdout.expected
1053 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1054 66b11bf5 2019-03-27 stsp ret="$?"
1055 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1056 66b11bf5 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1057 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
1058 66b11bf5 2019-03-27 stsp return 1
1059 66b11bf5 2019-03-27 stsp fi
1060 66b11bf5 2019-03-27 stsp
1061 66b11bf5 2019-03-27 stsp # beta is now gone... we don't flag tree conflicts yet
1062 2a06fe5f 2019-08-24 stsp echo "N beta" > $testroot/stdout.expected
1063 54817d72 2019-07-27 stsp echo -n > $testroot/stderr.expected
1064 54817d72 2019-07-27 stsp (cd $testroot/wt && got status beta > $testroot/stdout \
1065 54817d72 2019-07-27 stsp 2> $testroot/stderr)
1066 54817d72 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1067 54817d72 2019-07-27 stsp ret="$?"
1068 54817d72 2019-07-27 stsp if [ "$ret" != "0" ]; then
1069 54817d72 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1070 54817d72 2019-07-27 stsp test_done "$testroot" "$ret"
1071 54817d72 2019-07-27 stsp return 1
1072 54817d72 2019-07-27 stsp fi
1073 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1074 66b11bf5 2019-03-27 stsp ret="$?"
1075 66b11bf5 2019-03-27 stsp if [ "$ret" != "0" ]; then
1076 66b11bf5 2019-03-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1077 66b11bf5 2019-03-27 stsp test_done "$testroot" "$ret"
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 if [ -e $testroot/wt/beta ]; then
1082 66b11bf5 2019-03-27 stsp echo "removed file beta still exists on disk" >&2
1083 66b11bf5 2019-03-27 stsp test_done "$testroot" "1"
1084 66b11bf5 2019-03-27 stsp return 1
1085 66b11bf5 2019-03-27 stsp fi
1086 66b11bf5 2019-03-27 stsp
1087 66b11bf5 2019-03-27 stsp test_done "$testroot" "0"
1088 708d8e67 2019-03-27 stsp }
1089 c4cdcb68 2019-04-03 stsp
1090 c4cdcb68 2019-04-03 stsp function test_update_partial {
1091 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial`
1092 c4cdcb68 2019-04-03 stsp
1093 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1094 c4cdcb68 2019-04-03 stsp ret="$?"
1095 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1096 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1097 c4cdcb68 2019-04-03 stsp return 1
1098 c4cdcb68 2019-04-03 stsp fi
1099 708d8e67 2019-03-27 stsp
1100 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1101 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1102 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1103 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1104 c4cdcb68 2019-04-03 stsp
1105 f2ea84fa 2019-07-27 stsp echo "U alpha" > $testroot/stdout.expected
1106 f2ea84fa 2019-07-27 stsp echo "U beta" >> $testroot/stdout.expected
1107 f2ea84fa 2019-07-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1108 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1109 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1110 c4cdcb68 2019-04-03 stsp
1111 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha beta > $testroot/stdout)
1112 c4cdcb68 2019-04-03 stsp
1113 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1114 f2ea84fa 2019-07-27 stsp ret="$?"
1115 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1116 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1117 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1118 f2ea84fa 2019-07-27 stsp return 1
1119 f2ea84fa 2019-07-27 stsp fi
1120 c4cdcb68 2019-04-03 stsp
1121 f2ea84fa 2019-07-27 stsp echo "modified alpha" > $testroot/content.expected
1122 f2ea84fa 2019-07-27 stsp echo "modified beta" >> $testroot/content.expected
1123 f2ea84fa 2019-07-27 stsp
1124 f2ea84fa 2019-07-27 stsp cat $testroot/wt/alpha $testroot/wt/beta > $testroot/content
1125 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1126 f2ea84fa 2019-07-27 stsp ret="$?"
1127 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1128 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1129 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1130 f2ea84fa 2019-07-27 stsp return 1
1131 f2ea84fa 2019-07-27 stsp fi
1132 e4d984c2 2019-05-22 stsp
1133 e4d984c2 2019-05-22 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1134 e4d984c2 2019-05-22 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1135 e4d984c2 2019-05-22 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1136 e4d984c2 2019-05-22 stsp echo >> $testroot/stdout.expected
1137 e4d984c2 2019-05-22 stsp
1138 e4d984c2 2019-05-22 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1139 e4d984c2 2019-05-22 stsp
1140 e4d984c2 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1141 e4d984c2 2019-05-22 stsp ret="$?"
1142 e4d984c2 2019-05-22 stsp if [ "$ret" != "0" ]; then
1143 e4d984c2 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1144 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1145 e4d984c2 2019-05-22 stsp return 1
1146 e4d984c2 2019-05-22 stsp fi
1147 e4d984c2 2019-05-22 stsp
1148 e4d984c2 2019-05-22 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1149 e4d984c2 2019-05-22 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1150 e4d984c2 2019-05-22 stsp
1151 e4d984c2 2019-05-22 stsp cmp -s $testroot/content.expected $testroot/content
1152 e4d984c2 2019-05-22 stsp ret="$?"
1153 e4d984c2 2019-05-22 stsp if [ "$ret" != "0" ]; then
1154 e4d984c2 2019-05-22 stsp diff -u $testroot/content.expected $testroot/content
1155 e4d984c2 2019-05-22 stsp test_done "$testroot" "$ret"
1156 e4d984c2 2019-05-22 stsp return 1
1157 e4d984c2 2019-05-22 stsp fi
1158 e4d984c2 2019-05-22 stsp
1159 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1160 c4cdcb68 2019-04-03 stsp }
1161 c4cdcb68 2019-04-03 stsp
1162 c4cdcb68 2019-04-03 stsp function test_update_partial_add {
1163 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_add`
1164 c4cdcb68 2019-04-03 stsp
1165 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1166 c4cdcb68 2019-04-03 stsp ret="$?"
1167 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1168 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1169 c4cdcb68 2019-04-03 stsp return 1
1170 c4cdcb68 2019-04-03 stsp fi
1171 c4cdcb68 2019-04-03 stsp
1172 c4cdcb68 2019-04-03 stsp echo "new" > $testroot/repo/new
1173 c4cdcb68 2019-04-03 stsp echo "epsilon/new2" > $testroot/repo/epsilon/new2
1174 c4cdcb68 2019-04-03 stsp (cd $testroot/repo && git add .)
1175 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "added two files"
1176 c4cdcb68 2019-04-03 stsp
1177 f2ea84fa 2019-07-27 stsp echo "A new" > $testroot/stdout.expected
1178 f2ea84fa 2019-07-27 stsp echo "A epsilon/new2" >> $testroot/stdout.expected
1179 f2ea84fa 2019-07-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1180 f2ea84fa 2019-07-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1181 f2ea84fa 2019-07-27 stsp echo >> $testroot/stdout.expected
1182 c4cdcb68 2019-04-03 stsp
1183 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update new epsilon/new2 > $testroot/stdout)
1184 c4cdcb68 2019-04-03 stsp
1185 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1186 f2ea84fa 2019-07-27 stsp ret="$?"
1187 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1188 f2ea84fa 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
1189 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1190 f2ea84fa 2019-07-27 stsp return 1
1191 f2ea84fa 2019-07-27 stsp fi
1192 c4cdcb68 2019-04-03 stsp
1193 f2ea84fa 2019-07-27 stsp echo "new" > $testroot/content.expected
1194 f2ea84fa 2019-07-27 stsp echo "epsilon/new2" >> $testroot/content.expected
1195 c4cdcb68 2019-04-03 stsp
1196 f2ea84fa 2019-07-27 stsp cat $testroot/wt/new $testroot/wt/epsilon/new2 > $testroot/content
1197 f2ea84fa 2019-07-27 stsp
1198 f2ea84fa 2019-07-27 stsp cmp -s $testroot/content.expected $testroot/content
1199 f2ea84fa 2019-07-27 stsp ret="$?"
1200 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1201 f2ea84fa 2019-07-27 stsp diff -u $testroot/content.expected $testroot/content
1202 f2ea84fa 2019-07-27 stsp fi
1203 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1204 c4cdcb68 2019-04-03 stsp }
1205 c4cdcb68 2019-04-03 stsp
1206 c4cdcb68 2019-04-03 stsp function test_update_partial_rm {
1207 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_rm`
1208 c4cdcb68 2019-04-03 stsp
1209 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1210 c4cdcb68 2019-04-03 stsp ret="$?"
1211 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1212 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1213 c4cdcb68 2019-04-03 stsp return 1
1214 c4cdcb68 2019-04-03 stsp fi
1215 c4cdcb68 2019-04-03 stsp
1216 f2ea84fa 2019-07-27 stsp (cd $testroot/repo && git rm -q alpha epsilon/zeta)
1217 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "removed two files"
1218 c4cdcb68 2019-04-03 stsp
1219 f2ea84fa 2019-07-27 stsp echo "got: no such entry found in tree" \
1220 f2ea84fa 2019-07-27 stsp > $testroot/stderr.expected
1221 f2ea84fa 2019-07-27 stsp
1222 f2ea84fa 2019-07-27 stsp (cd $testroot/wt && got update alpha epsilon/zeta 2> $testroot/stderr)
1223 f2ea84fa 2019-07-27 stsp ret="$?"
1224 f2ea84fa 2019-07-27 stsp if [ "$ret" == "0" ]; then
1225 f2ea84fa 2019-07-27 stsp echo "update succeeded unexpectedly" >&2
1226 f2ea84fa 2019-07-27 stsp test_done "$testroot" "1"
1227 f2ea84fa 2019-07-27 stsp return 1
1228 f2ea84fa 2019-07-27 stsp fi
1229 c4cdcb68 2019-04-03 stsp
1230 f2ea84fa 2019-07-27 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1231 f2ea84fa 2019-07-27 stsp ret="$?"
1232 f2ea84fa 2019-07-27 stsp if [ "$ret" != "0" ]; then
1233 f2ea84fa 2019-07-27 stsp diff -u $testroot/stderr.expected $testroot/stderr
1234 f2ea84fa 2019-07-27 stsp test_done "$testroot" "$ret"
1235 f2ea84fa 2019-07-27 stsp return 1
1236 f2ea84fa 2019-07-27 stsp fi
1237 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1238 c4cdcb68 2019-04-03 stsp }
1239 c4cdcb68 2019-04-03 stsp
1240 c4cdcb68 2019-04-03 stsp function test_update_partial_dir {
1241 c4cdcb68 2019-04-03 stsp local testroot=`test_init update_partial_dir`
1242 c4cdcb68 2019-04-03 stsp
1243 c4cdcb68 2019-04-03 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1244 c4cdcb68 2019-04-03 stsp ret="$?"
1245 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1246 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1247 c4cdcb68 2019-04-03 stsp return 1
1248 c4cdcb68 2019-04-03 stsp fi
1249 c4cdcb68 2019-04-03 stsp
1250 c4cdcb68 2019-04-03 stsp echo "modified alpha" > $testroot/repo/alpha
1251 c4cdcb68 2019-04-03 stsp echo "modified beta" > $testroot/repo/beta
1252 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/repo/epsilon/zeta
1253 c4cdcb68 2019-04-03 stsp git_commit $testroot/repo -m "modified two files"
1254 c4cdcb68 2019-04-03 stsp
1255 c4cdcb68 2019-04-03 stsp echo "U epsilon/zeta" > $testroot/stdout.expected
1256 c4cdcb68 2019-04-03 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1257 c4cdcb68 2019-04-03 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1258 c4cdcb68 2019-04-03 stsp echo >> $testroot/stdout.expected
1259 c4cdcb68 2019-04-03 stsp
1260 c4cdcb68 2019-04-03 stsp (cd $testroot/wt && got update epsilon > $testroot/stdout)
1261 c4cdcb68 2019-04-03 stsp
1262 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1263 c4cdcb68 2019-04-03 stsp ret="$?"
1264 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1265 c4cdcb68 2019-04-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
1266 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1267 c4cdcb68 2019-04-03 stsp return 1
1268 c4cdcb68 2019-04-03 stsp fi
1269 c4cdcb68 2019-04-03 stsp
1270 c4cdcb68 2019-04-03 stsp echo "modified epsilon/zeta" > $testroot/content.expected
1271 c4cdcb68 2019-04-03 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
1272 c4cdcb68 2019-04-03 stsp
1273 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1274 c4cdcb68 2019-04-03 stsp ret="$?"
1275 c4cdcb68 2019-04-03 stsp if [ "$ret" != "0" ]; then
1276 c4cdcb68 2019-04-03 stsp diff -u $testroot/content.expected $testroot/content
1277 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1278 c4cdcb68 2019-04-03 stsp return 1
1279 c4cdcb68 2019-04-03 stsp fi
1280 c4cdcb68 2019-04-03 stsp test_done "$testroot" "$ret"
1281 d5bea539 2019-05-13 stsp
1282 d5bea539 2019-05-13 stsp }
1283 d5bea539 2019-05-13 stsp
1284 d5bea539 2019-05-13 stsp function test_update_moved_branch_ref {
1285 d5bea539 2019-05-13 stsp local testroot=`test_init update_moved_branch_ref`
1286 d5bea539 2019-05-13 stsp
1287 d5bea539 2019-05-13 stsp git clone -q --mirror $testroot/repo $testroot/repo2
1288 d5bea539 2019-05-13 stsp
1289 d5bea539 2019-05-13 stsp echo "modified alpha with git" > $testroot/repo/alpha
1290 d5bea539 2019-05-13 stsp git_commit $testroot/repo -m "modified alpha with git"
1291 d5bea539 2019-05-13 stsp
1292 d5bea539 2019-05-13 stsp got checkout $testroot/repo2 $testroot/wt > /dev/null
1293 d5bea539 2019-05-13 stsp ret="$?"
1294 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1295 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1296 d5bea539 2019-05-13 stsp return 1
1297 d5bea539 2019-05-13 stsp fi
1298 d5bea539 2019-05-13 stsp
1299 d5bea539 2019-05-13 stsp echo "modified alpha with got" > $testroot/wt/alpha
1300 d5bea539 2019-05-13 stsp (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null)
1301 d5bea539 2019-05-13 stsp
1302 d5bea539 2019-05-13 stsp # + xxxxxxx...yyyyyyy master -> master (forced update)
1303 d5bea539 2019-05-13 stsp (cd $testroot/repo2 && git fetch -q --all)
1304 c4cdcb68 2019-04-03 stsp
1305 d5bea539 2019-05-13 stsp echo -n > $testroot/stdout.expected
1306 a1fb16d8 2019-05-24 stsp echo -n "got: work tree's head reference now points to a different " \
1307 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1308 a1fb16d8 2019-05-24 stsp echo "branch; new head reference and/or update -b required" \
1309 a1fb16d8 2019-05-24 stsp >> $testroot/stderr.expected
1310 d5bea539 2019-05-13 stsp
1311 d5bea539 2019-05-13 stsp (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
1312 d5bea539 2019-05-13 stsp
1313 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1314 d5bea539 2019-05-13 stsp ret="$?"
1315 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1316 d5bea539 2019-05-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1317 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1318 d5bea539 2019-05-13 stsp return 1
1319 d5bea539 2019-05-13 stsp fi
1320 d5bea539 2019-05-13 stsp
1321 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1322 d5bea539 2019-05-13 stsp ret="$?"
1323 d5bea539 2019-05-13 stsp if [ "$ret" != "0" ]; then
1324 d5bea539 2019-05-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
1325 d5bea539 2019-05-13 stsp fi
1326 d5bea539 2019-05-13 stsp test_done "$testroot" "$ret"
1327 c4cdcb68 2019-04-03 stsp }
1328 024e9686 2019-05-14 stsp
1329 024e9686 2019-05-14 stsp function test_update_to_another_branch {
1330 024e9686 2019-05-14 stsp local testroot=`test_init update_to_another_branch`
1331 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
1332 024e9686 2019-05-14 stsp
1333 024e9686 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1334 024e9686 2019-05-14 stsp ret="$?"
1335 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1336 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1337 024e9686 2019-05-14 stsp return 1
1338 024e9686 2019-05-14 stsp fi
1339 024e9686 2019-05-14 stsp
1340 024e9686 2019-05-14 stsp echo 'refs/heads/master'> $testroot/head-ref.expected
1341 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1342 024e9686 2019-05-14 stsp ret="$?"
1343 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1344 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1345 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1346 024e9686 2019-05-14 stsp return 1
1347 024e9686 2019-05-14 stsp fi
1348 024e9686 2019-05-14 stsp
1349 024e9686 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1350 024e9686 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1351 024e9686 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1352 024e9686 2019-05-14 stsp
1353 024e9686 2019-05-14 stsp echo "modified alpha in work tree" > $testroot/wt/alpha
1354 024e9686 2019-05-14 stsp
1355 d969fa15 2019-05-22 stsp echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
1356 d969fa15 2019-05-22 stsp echo "C alpha" >> $testroot/stdout.expected
1357 024e9686 2019-05-14 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1358 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1359 024e9686 2019-05-14 stsp echo >> $testroot/stdout.expected
1360 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1361 024e9686 2019-05-14 stsp
1362 024e9686 2019-05-14 stsp (cd $testroot/wt && got update -b newbranch > $testroot/stdout)
1363 024e9686 2019-05-14 stsp
1364 024e9686 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1365 024e9686 2019-05-14 stsp ret="$?"
1366 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1367 024e9686 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1368 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1369 024e9686 2019-05-14 stsp return 1
1370 024e9686 2019-05-14 stsp fi
1371 c4cdcb68 2019-04-03 stsp
1372 f69721c3 2019-10-21 stsp echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
1373 024e9686 2019-05-14 stsp git_show_head $testroot/repo >> $testroot/content.expected
1374 024e9686 2019-05-14 stsp echo >> $testroot/content.expected
1375 024e9686 2019-05-14 stsp echo "modified alpha on new branch" >> $testroot/content.expected
1376 f69721c3 2019-10-21 stsp echo "||||||| 3-way merge base: commit $base_commit" \
1377 f69721c3 2019-10-21 stsp >> $testroot/content.expected
1378 d136cfcb 2019-10-12 stsp echo "alpha" >> $testroot/content.expected
1379 024e9686 2019-05-14 stsp echo "=======" >> $testroot/content.expected
1380 024e9686 2019-05-14 stsp echo "modified alpha in work tree" >> $testroot/content.expected
1381 f69721c3 2019-10-21 stsp echo '>>>>>>>' >> $testroot/content.expected
1382 d5bea539 2019-05-13 stsp
1383 024e9686 2019-05-14 stsp cat $testroot/wt/alpha > $testroot/content
1384 024e9686 2019-05-14 stsp
1385 024e9686 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
1386 024e9686 2019-05-14 stsp ret="$?"
1387 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1388 024e9686 2019-05-14 stsp diff -u $testroot/content.expected $testroot/content
1389 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1390 024e9686 2019-05-14 stsp return 1
1391 024e9686 2019-05-14 stsp fi
1392 024e9686 2019-05-14 stsp
1393 024e9686 2019-05-14 stsp echo 'refs/heads/newbranch'> $testroot/head-ref.expected
1394 024e9686 2019-05-14 stsp cmp -s $testroot/head-ref.expected $testroot/wt/.got/head-ref
1395 024e9686 2019-05-14 stsp ret="$?"
1396 024e9686 2019-05-14 stsp if [ "$ret" != "0" ]; then
1397 024e9686 2019-05-14 stsp diff -u $testroot/head-ref.expected $testroot/wt/.got/head-ref
1398 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1399 a367ff0f 2019-05-14 stsp return 1
1400 a367ff0f 2019-05-14 stsp fi
1401 a367ff0f 2019-05-14 stsp
1402 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1403 a367ff0f 2019-05-14 stsp }
1404 a367ff0f 2019-05-14 stsp
1405 a367ff0f 2019-05-14 stsp function test_update_to_commit_on_wrong_branch {
1406 a367ff0f 2019-05-14 stsp local testroot=`test_init update_to_commit_on_wrong_branch`
1407 a367ff0f 2019-05-14 stsp
1408 a367ff0f 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1409 a367ff0f 2019-05-14 stsp ret="$?"
1410 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1411 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1412 a367ff0f 2019-05-14 stsp return 1
1413 a367ff0f 2019-05-14 stsp fi
1414 a367ff0f 2019-05-14 stsp
1415 a367ff0f 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
1416 a367ff0f 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
1417 a367ff0f 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
1418 a367ff0f 2019-05-14 stsp
1419 a367ff0f 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
1420 a367ff0f 2019-05-14 stsp echo "got: target commit is on a different branch" \
1421 a367ff0f 2019-05-14 stsp > $testroot/stderr.expected
1422 a367ff0f 2019-05-14 stsp
1423 a367ff0f 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
1424 a367ff0f 2019-05-14 stsp (cd $testroot/wt && got update -c $head_rev > $testroot/stdout \
1425 a367ff0f 2019-05-14 stsp 2> $testroot/stderr)
1426 a367ff0f 2019-05-14 stsp
1427 a367ff0f 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1428 a367ff0f 2019-05-14 stsp ret="$?"
1429 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1430 a367ff0f 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1431 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1432 024e9686 2019-05-14 stsp return 1
1433 024e9686 2019-05-14 stsp fi
1434 024e9686 2019-05-14 stsp
1435 a367ff0f 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1436 a367ff0f 2019-05-14 stsp ret="$?"
1437 a367ff0f 2019-05-14 stsp if [ "$ret" != "0" ]; then
1438 a367ff0f 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
1439 a367ff0f 2019-05-14 stsp test_done "$testroot" "$ret"
1440 a367ff0f 2019-05-14 stsp return 1
1441 a367ff0f 2019-05-14 stsp fi
1442 a367ff0f 2019-05-14 stsp
1443 024e9686 2019-05-14 stsp test_done "$testroot" "$ret"
1444 024e9686 2019-05-14 stsp }
1445 c932eeeb 2019-05-22 stsp
1446 c932eeeb 2019-05-22 stsp function test_update_bumps_base_commit_id {
1447 a5e55564 2019-06-10 stsp local testroot=`test_init update_bumps_base_commit_id`
1448 c932eeeb 2019-05-22 stsp
1449 1a36436d 2019-06-10 stsp echo "psi" > $testroot/repo/epsilon/psi
1450 1a36436d 2019-06-10 stsp (cd $testroot/repo && git add .)
1451 1a36436d 2019-06-10 stsp git_commit $testroot/repo -m "adding another file"
1452 1a36436d 2019-06-10 stsp
1453 c932eeeb 2019-05-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1454 c932eeeb 2019-05-22 stsp ret="$?"
1455 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1456 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1457 c932eeeb 2019-05-22 stsp return 1
1458 c932eeeb 2019-05-22 stsp fi
1459 024e9686 2019-05-14 stsp
1460 1a36436d 2019-06-10 stsp echo "modified psi" > $testroot/wt/epsilon/psi
1461 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed psi" > $testroot/stdout)
1462 c932eeeb 2019-05-22 stsp
1463 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1464 1a36436d 2019-06-10 stsp echo "M epsilon/psi" > $testroot/stdout.expected
1465 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1466 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1467 c932eeeb 2019-05-22 stsp ret="$?"
1468 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1469 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1470 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1471 c932eeeb 2019-05-22 stsp return 1
1472 c932eeeb 2019-05-22 stsp fi
1473 9bead371 2019-07-28 stsp
1474 305993b9 2019-07-28 stsp echo "changed zeta with git" > $testroot/repo/epsilon/zeta
1475 9bead371 2019-07-28 stsp (cd $testroot/repo && git add .)
1476 9bead371 2019-07-28 stsp git_commit $testroot/repo -m "changing zeta with git"
1477 c932eeeb 2019-05-22 stsp
1478 1a36436d 2019-06-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
1479 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout \
1480 c932eeeb 2019-05-22 stsp 2> $testroot/stderr)
1481 c932eeeb 2019-05-22 stsp
1482 c932eeeb 2019-05-22 stsp echo -n "" > $testroot/stdout.expected
1483 c932eeeb 2019-05-22 stsp echo "got: work tree must be updated before these changes can be committed" > $testroot/stderr.expected
1484 c932eeeb 2019-05-22 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1485 c932eeeb 2019-05-22 stsp ret="$?"
1486 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1487 c932eeeb 2019-05-22 stsp diff -u $testroot/stderr.expected $testroot/stderr
1488 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1489 c932eeeb 2019-05-22 stsp return 1
1490 c932eeeb 2019-05-22 stsp fi
1491 c932eeeb 2019-05-22 stsp
1492 c932eeeb 2019-05-22 stsp (cd $testroot/wt && got update > $testroot/stdout)
1493 c932eeeb 2019-05-22 stsp
1494 9bead371 2019-07-28 stsp echo "U epsilon/psi" > $testroot/stdout.expected
1495 9bead371 2019-07-28 stsp echo "C epsilon/zeta" >> $testroot/stdout.expected
1496 a484d721 2019-06-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1497 a484d721 2019-06-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1498 a484d721 2019-06-10 stsp echo >> $testroot/stdout.expected
1499 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
1500 9627c110 2020-04-18 stsp
1501 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1502 c932eeeb 2019-05-22 stsp ret="$?"
1503 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1504 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1505 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1506 c932eeeb 2019-05-22 stsp return 1
1507 c932eeeb 2019-05-22 stsp fi
1508 c932eeeb 2019-05-22 stsp
1509 9bead371 2019-07-28 stsp # resolve conflict
1510 9bead371 2019-07-28 stsp echo "modified zeta with got and git" > $testroot/wt/epsilon/zeta
1511 9bead371 2019-07-28 stsp
1512 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m "changed zeta" > $testroot/stdout)
1513 c932eeeb 2019-05-22 stsp
1514 c932eeeb 2019-05-22 stsp local head_rev=`git_show_head $testroot/repo`
1515 1a36436d 2019-06-10 stsp echo "M epsilon/zeta" > $testroot/stdout.expected
1516 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1517 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1518 303e2782 2019-08-09 stsp ret="$?"
1519 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1520 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
1521 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1522 303e2782 2019-08-09 stsp return 1
1523 303e2782 2019-08-09 stsp fi
1524 303e2782 2019-08-09 stsp
1525 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1526 303e2782 2019-08-09 stsp }
1527 303e2782 2019-08-09 stsp
1528 303e2782 2019-08-09 stsp function test_update_tag {
1529 303e2782 2019-08-09 stsp local testroot=`test_init update_tag`
1530 303e2782 2019-08-09 stsp local tag="1.0.0"
1531 303e2782 2019-08-09 stsp
1532 303e2782 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1533 303e2782 2019-08-09 stsp ret="$?"
1534 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1535 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
1536 303e2782 2019-08-09 stsp return 1
1537 303e2782 2019-08-09 stsp fi
1538 303e2782 2019-08-09 stsp
1539 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/repo/alpha
1540 303e2782 2019-08-09 stsp git_commit $testroot/repo -m "modified alpha"
1541 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -m "test" -a $tag)
1542 303e2782 2019-08-09 stsp
1543 303e2782 2019-08-09 stsp echo "U alpha" > $testroot/stdout.expected
1544 303e2782 2019-08-09 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1545 303e2782 2019-08-09 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1546 303e2782 2019-08-09 stsp echo >> $testroot/stdout.expected
1547 303e2782 2019-08-09 stsp
1548 303e2782 2019-08-09 stsp (cd $testroot/wt && got update -c $tag > $testroot/stdout)
1549 303e2782 2019-08-09 stsp
1550 c932eeeb 2019-05-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1551 c932eeeb 2019-05-22 stsp ret="$?"
1552 c932eeeb 2019-05-22 stsp if [ "$ret" != "0" ]; then
1553 c932eeeb 2019-05-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
1554 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1555 c932eeeb 2019-05-22 stsp return 1
1556 c932eeeb 2019-05-22 stsp fi
1557 c932eeeb 2019-05-22 stsp
1558 303e2782 2019-08-09 stsp echo "modified alpha" > $testroot/content.expected
1559 303e2782 2019-08-09 stsp cat $testroot/wt/alpha > $testroot/content
1560 303e2782 2019-08-09 stsp
1561 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
1562 303e2782 2019-08-09 stsp ret="$?"
1563 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
1564 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
1565 523b8417 2019-10-19 stsp fi
1566 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1567 523b8417 2019-10-19 stsp }
1568 523b8417 2019-10-19 stsp
1569 523b8417 2019-10-19 stsp function test_update_toggles_xbit {
1570 523b8417 2019-10-19 stsp local testroot=`test_init update_toggles_xbit 1`
1571 523b8417 2019-10-19 stsp
1572 523b8417 2019-10-19 stsp touch $testroot/repo/xfile
1573 523b8417 2019-10-19 stsp chmod +x $testroot/repo/xfile
1574 523b8417 2019-10-19 stsp (cd $testroot/repo && git add .)
1575 523b8417 2019-10-19 stsp git_commit $testroot/repo -m "adding executable file"
1576 523b8417 2019-10-19 stsp local commit_id1=`git_show_head $testroot/repo`
1577 523b8417 2019-10-19 stsp
1578 523b8417 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
1579 523b8417 2019-10-19 stsp ret="$?"
1580 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1581 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1582 523b8417 2019-10-19 stsp return 1
1583 523b8417 2019-10-19 stsp fi
1584 523b8417 2019-10-19 stsp
1585 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1586 523b8417 2019-10-19 stsp ret="$?"
1587 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1588 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1589 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1590 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1591 523b8417 2019-10-19 stsp return 1
1592 523b8417 2019-10-19 stsp fi
1593 523b8417 2019-10-19 stsp
1594 523b8417 2019-10-19 stsp chmod -x $testroot/wt/xfile
1595 523b8417 2019-10-19 stsp (cd $testroot/wt && got commit -m "clear x bit" >/dev/null)
1596 523b8417 2019-10-19 stsp local commit_id2=`git_show_head $testroot/repo`
1597 523b8417 2019-10-19 stsp
1598 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1599 523b8417 2019-10-19 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1600 523b8417 2019-10-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1601 523b8417 2019-10-19 stsp echo >> $testroot/stdout.expected
1602 523b8417 2019-10-19 stsp
1603 523b8417 2019-10-19 stsp (cd $testroot/wt && got update -c $commit_id1 > $testroot/stdout)
1604 523b8417 2019-10-19 stsp ret="$?"
1605 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1606 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1607 523b8417 2019-10-19 stsp return 1
1608 523b8417 2019-10-19 stsp fi
1609 523b8417 2019-10-19 stsp
1610 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1611 523b8417 2019-10-19 stsp echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
1612 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1613 523b8417 2019-10-19 stsp ret="$?"
1614 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1615 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1616 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1617 523b8417 2019-10-19 stsp return 1
1618 303e2782 2019-08-09 stsp fi
1619 523b8417 2019-10-19 stsp
1620 523b8417 2019-10-19 stsp
1621 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
1622 523b8417 2019-10-19 stsp ret="$?"
1623 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1624 523b8417 2019-10-19 stsp echo "file is not executable" >&2
1625 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1626 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1627 523b8417 2019-10-19 stsp return 1
1628 523b8417 2019-10-19 stsp fi
1629 523b8417 2019-10-19 stsp
1630 523b8417 2019-10-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
1631 523b8417 2019-10-19 stsp ret="$?"
1632 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1633 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1634 523b8417 2019-10-19 stsp return 1
1635 523b8417 2019-10-19 stsp fi
1636 523b8417 2019-10-19 stsp
1637 523b8417 2019-10-19 stsp echo "U xfile" > $testroot/stdout.expected
1638 523b8417 2019-10-19 stsp echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
1639 523b8417 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1640 523b8417 2019-10-19 stsp ret="$?"
1641 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1642 523b8417 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1643 523b8417 2019-10-19 stsp test_done "$testroot" "$ret"
1644 523b8417 2019-10-19 stsp return 1
1645 523b8417 2019-10-19 stsp fi
1646 523b8417 2019-10-19 stsp
1647 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile | grep -q '^-rw-'
1648 523b8417 2019-10-19 stsp ret="$?"
1649 523b8417 2019-10-19 stsp if [ "$ret" != "0" ]; then
1650 523b8417 2019-10-19 stsp echo "file is unexpectedly executable" >&2
1651 523b8417 2019-10-19 stsp ls -l $testroot/wt/xfile >&2
1652 5036ab18 2020-04-18 stsp fi
1653 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1654 5036ab18 2020-04-18 stsp }
1655 5036ab18 2020-04-18 stsp
1656 5036ab18 2020-04-18 stsp function test_update_preserves_conflicted_file {
1657 5036ab18 2020-04-18 stsp local testroot=`test_init update_preserves_conflicted_file`
1658 5036ab18 2020-04-18 stsp local commit_id0=`git_show_head $testroot/repo`
1659 5036ab18 2020-04-18 stsp
1660 5036ab18 2020-04-18 stsp echo "modified alpha" > $testroot/repo/alpha
1661 5036ab18 2020-04-18 stsp git_commit $testroot/repo -m "modified alpha"
1662 5036ab18 2020-04-18 stsp local commit_id1=`git_show_head $testroot/repo`
1663 5036ab18 2020-04-18 stsp
1664 5036ab18 2020-04-18 stsp got checkout -c $commit_id0 $testroot/repo $testroot/wt > /dev/null
1665 5036ab18 2020-04-18 stsp ret="$?"
1666 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1667 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1668 5036ab18 2020-04-18 stsp return 1
1669 5036ab18 2020-04-18 stsp fi
1670 5036ab18 2020-04-18 stsp
1671 5036ab18 2020-04-18 stsp # fake a merge conflict
1672 5036ab18 2020-04-18 stsp echo '<<<<<<<' > $testroot/wt/alpha
1673 5036ab18 2020-04-18 stsp echo 'alpha' >> $testroot/wt/alpha
1674 5036ab18 2020-04-18 stsp echo '=======' >> $testroot/wt/alpha
1675 5036ab18 2020-04-18 stsp echo 'alpha, too' >> $testroot/wt/alpha
1676 5036ab18 2020-04-18 stsp echo '>>>>>>>' >> $testroot/wt/alpha
1677 5036ab18 2020-04-18 stsp cp $testroot/wt/alpha $testroot/content.expected
1678 5036ab18 2020-04-18 stsp
1679 5036ab18 2020-04-18 stsp echo "C alpha" > $testroot/stdout.expected
1680 5036ab18 2020-04-18 stsp (cd $testroot/wt && got status > $testroot/stdout)
1681 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1682 5036ab18 2020-04-18 stsp ret="$?"
1683 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1684 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1685 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1686 5036ab18 2020-04-18 stsp return 1
1687 523b8417 2019-10-19 stsp fi
1688 5036ab18 2020-04-18 stsp
1689 5036ab18 2020-04-18 stsp echo "# alpha" > $testroot/stdout.expected
1690 5036ab18 2020-04-18 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
1691 5036ab18 2020-04-18 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
1692 5036ab18 2020-04-18 stsp echo >> $testroot/stdout.expected
1693 9627c110 2020-04-18 stsp echo "Files not updated because of existing merge conflicts: 1" \
1694 9627c110 2020-04-18 stsp >> $testroot/stdout.expected
1695 5036ab18 2020-04-18 stsp (cd $testroot/wt && got update > $testroot/stdout)
1696 5036ab18 2020-04-18 stsp
1697 5036ab18 2020-04-18 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1698 5036ab18 2020-04-18 stsp ret="$?"
1699 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1700 5036ab18 2020-04-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
1701 5036ab18 2020-04-18 stsp test_done "$testroot" "$ret"
1702 5036ab18 2020-04-18 stsp return 1
1703 5036ab18 2020-04-18 stsp fi
1704 5036ab18 2020-04-18 stsp
1705 5036ab18 2020-04-18 stsp cmp -s $testroot/content.expected $testroot/wt/alpha
1706 5036ab18 2020-04-18 stsp ret="$?"
1707 5036ab18 2020-04-18 stsp if [ "$ret" != "0" ]; then
1708 5036ab18 2020-04-18 stsp diff -u $testroot/content.expected $testroot/wt/alpha
1709 5036ab18 2020-04-18 stsp fi
1710 c932eeeb 2019-05-22 stsp test_done "$testroot" "$ret"
1711 c932eeeb 2019-05-22 stsp }
1712 c932eeeb 2019-05-22 stsp
1713 c84d8c75 2019-01-02 stsp run_test test_update_basic
1714 3b4d3732 2019-01-02 stsp run_test test_update_adds_file
1715 512f0d0e 2019-01-02 stsp run_test test_update_deletes_file
1716 f5c49f82 2019-01-06 stsp run_test test_update_deletes_dir
1717 5cc266ba 2019-01-06 stsp run_test test_update_deletes_dir_with_path_prefix
1718 90285c3b 2019-01-08 stsp run_test test_update_deletes_dir_recursively
1719 4482e97b 2019-01-08 stsp run_test test_update_sibling_dirs_with_common_prefix
1720 50952927 2019-01-12 stsp run_test test_update_dir_with_dot_sibling
1721 46cee7a3 2019-01-12 stsp run_test test_update_moves_files_upwards
1722 bd4792ec 2019-01-13 stsp run_test test_update_moves_files_to_new_dir
1723 4a1ddfc2 2019-01-12 stsp run_test test_update_creates_missing_parent
1724 bd4792ec 2019-01-13 stsp run_test test_update_creates_missing_parent_with_subdir
1725 21908da4 2019-01-13 stsp run_test test_update_file_in_subsubdir
1726 6353ad76 2019-02-08 stsp run_test test_update_merges_file_edits
1727 68ed9ba5 2019-02-10 stsp run_test test_update_keeps_xbit
1728 ba8a0d4d 2019-02-10 stsp run_test test_update_clears_xbit
1729 a378724f 2019-02-10 stsp run_test test_update_restores_missing_file
1730 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_add_vs_repo_add
1731 085d5bcf 2019-03-27 stsp run_test test_update_conflict_wt_edit_vs_repo_rm
1732 13d9040b 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_edit
1733 66b11bf5 2019-03-27 stsp run_test test_update_conflict_wt_rm_vs_repo_rm
1734 c4cdcb68 2019-04-03 stsp run_test test_update_partial
1735 c4cdcb68 2019-04-03 stsp run_test test_update_partial_add
1736 c4cdcb68 2019-04-03 stsp run_test test_update_partial_rm
1737 c4cdcb68 2019-04-03 stsp run_test test_update_partial_dir
1738 d5bea539 2019-05-13 stsp run_test test_update_moved_branch_ref
1739 024e9686 2019-05-14 stsp run_test test_update_to_another_branch
1740 a367ff0f 2019-05-14 stsp run_test test_update_to_commit_on_wrong_branch
1741 c932eeeb 2019-05-22 stsp run_test test_update_bumps_base_commit_id
1742 303e2782 2019-08-09 stsp run_test test_update_tag
1743 523b8417 2019-10-19 stsp run_test test_update_toggles_xbit
1744 5036ab18 2020-04-18 stsp run_test test_update_preserves_conflicted_file