Blame


1 0e673013 2019-01-02 stsp #!/bin/sh
2 0e673013 2019-01-02 stsp #
3 0e673013 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 0e673013 2019-01-02 stsp #
5 0e673013 2019-01-02 stsp # Permission to use, copy, modify, and distribute this software for any
6 0e673013 2019-01-02 stsp # purpose with or without fee is hereby granted, provided that the above
7 0e673013 2019-01-02 stsp # copyright notice and this permission notice appear in all copies.
8 0e673013 2019-01-02 stsp #
9 0e673013 2019-01-02 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 0e673013 2019-01-02 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 0e673013 2019-01-02 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 0e673013 2019-01-02 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 0e673013 2019-01-02 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 0e673013 2019-01-02 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 0e673013 2019-01-02 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 0e673013 2019-01-02 stsp
17 0e673013 2019-01-02 stsp . ./common.sh
18 0e673013 2019-01-02 stsp
19 0e673013 2019-01-02 stsp function test_checkout_basic {
20 0e673013 2019-01-02 stsp local testroot=`test_init checkout_basic`
21 0e673013 2019-01-02 stsp
22 0e673013 2019-01-02 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
23 0e673013 2019-01-02 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
24 0e673013 2019-01-02 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
25 0e673013 2019-01-02 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
26 0e673013 2019-01-02 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
27 0e673013 2019-01-02 stsp
28 0e673013 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
29 e60e7f5b 2019-02-10 stsp ret="$?"
30 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
31 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
32 0e673013 2019-01-02 stsp return 1
33 0e673013 2019-01-02 stsp fi
34 0e673013 2019-01-02 stsp
35 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
36 e60e7f5b 2019-02-10 stsp ret="$?"
37 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
38 0e673013 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
39 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
40 0e673013 2019-01-02 stsp return 1
41 0e673013 2019-01-02 stsp fi
42 0e673013 2019-01-02 stsp
43 0e673013 2019-01-02 stsp echo "alpha" > $testroot/content.expected
44 0e673013 2019-01-02 stsp echo "beta" >> $testroot/content.expected
45 0e673013 2019-01-02 stsp echo "zeta" >> $testroot/content.expected
46 0e673013 2019-01-02 stsp echo "delta" >> $testroot/content.expected
47 0e673013 2019-01-02 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
48 0e673013 2019-01-02 stsp $testroot/wt/gamma/delta > $testroot/content
49 0e673013 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 0e673013 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
54 0e673013 2019-01-02 stsp fi
55 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
56 0e673013 2019-01-02 stsp }
57 0e673013 2019-01-02 stsp
58 80c1b583 2019-08-07 stsp function test_checkout_dir_exists {
59 80c1b583 2019-08-07 stsp local testroot=`test_init checkout_dir_exists`
60 80c1b583 2019-08-07 stsp
61 80c1b583 2019-08-07 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
62 80c1b583 2019-08-07 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
63 80c1b583 2019-08-07 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
64 80c1b583 2019-08-07 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
65 80c1b583 2019-08-07 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
66 80c1b583 2019-08-07 stsp
67 80c1b583 2019-08-07 stsp mkdir $testroot/wt
68 80c1b583 2019-08-07 stsp
69 80c1b583 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
70 80c1b583 2019-08-07 stsp ret="$?"
71 80c1b583 2019-08-07 stsp if [ "$ret" != "0" ]; then
72 80c1b583 2019-08-07 stsp test_done "$testroot" "$ret"
73 80c1b583 2019-08-07 stsp return 1
74 80c1b583 2019-08-07 stsp fi
75 80c1b583 2019-08-07 stsp
76 80c1b583 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
77 80c1b583 2019-08-07 stsp ret="$?"
78 80c1b583 2019-08-07 stsp if [ "$ret" != "0" ]; then
79 80c1b583 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
80 80c1b583 2019-08-07 stsp test_done "$testroot" "$ret"
81 80c1b583 2019-08-07 stsp return 1
82 80c1b583 2019-08-07 stsp fi
83 80c1b583 2019-08-07 stsp
84 80c1b583 2019-08-07 stsp echo "alpha" > $testroot/content.expected
85 80c1b583 2019-08-07 stsp echo "beta" >> $testroot/content.expected
86 80c1b583 2019-08-07 stsp echo "zeta" >> $testroot/content.expected
87 80c1b583 2019-08-07 stsp echo "delta" >> $testroot/content.expected
88 80c1b583 2019-08-07 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
89 80c1b583 2019-08-07 stsp $testroot/wt/gamma/delta > $testroot/content
90 80c1b583 2019-08-07 stsp
91 80c1b583 2019-08-07 stsp cmp -s $testroot/content.expected $testroot/content
92 80c1b583 2019-08-07 stsp ret="$?"
93 80c1b583 2019-08-07 stsp if [ "$ret" != "0" ]; then
94 80c1b583 2019-08-07 stsp diff -u $testroot/content.expected $testroot/content
95 80c1b583 2019-08-07 stsp fi
96 80c1b583 2019-08-07 stsp test_done "$testroot" "$ret"
97 80c1b583 2019-08-07 stsp }
98 80c1b583 2019-08-07 stsp
99 80c1b583 2019-08-07 stsp function test_checkout_dir_not_empty {
100 80c1b583 2019-08-07 stsp local testroot=`test_init checkout_dir_not_empty`
101 80c1b583 2019-08-07 stsp
102 80c1b583 2019-08-07 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
103 80c1b583 2019-08-07 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
104 80c1b583 2019-08-07 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
105 80c1b583 2019-08-07 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
106 80c1b583 2019-08-07 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
107 80c1b583 2019-08-07 stsp
108 80c1b583 2019-08-07 stsp mkdir $testroot/wt
109 80c1b583 2019-08-07 stsp touch $testroot/wt/foo
110 80c1b583 2019-08-07 stsp
111 80c1b583 2019-08-07 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout \
112 80c1b583 2019-08-07 stsp 2> $testroot/stderr
113 80c1b583 2019-08-07 stsp ret="$?"
114 80c1b583 2019-08-07 stsp if [ "$ret" == "0" ]; then
115 80c1b583 2019-08-07 stsp echo "checkout succeeded unexpectedly" >&2
116 80c1b583 2019-08-07 stsp test_done "$testroot" "1"
117 80c1b583 2019-08-07 stsp return 1
118 80c1b583 2019-08-07 stsp fi
119 80c1b583 2019-08-07 stsp
120 80c1b583 2019-08-07 stsp echo "got: $testroot/wt: directory exists and is not empty" \
121 80c1b583 2019-08-07 stsp > $testroot/stderr.expected
122 80c1b583 2019-08-07 stsp cmp -s $testroot/stderr.expected $testroot/stderr
123 80c1b583 2019-08-07 stsp ret="$?"
124 80c1b583 2019-08-07 stsp if [ "$ret" != "0" ]; then
125 80c1b583 2019-08-07 stsp diff -u $testroot/stderr.expected $testroot/stderr
126 80c1b583 2019-08-07 stsp test_done "$testroot" "$ret"
127 80c1b583 2019-08-07 stsp return 1
128 80c1b583 2019-08-07 stsp fi
129 80c1b583 2019-08-07 stsp
130 80c1b583 2019-08-07 stsp echo -n > $testroot/stdout.expected
131 80c1b583 2019-08-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
132 80c1b583 2019-08-07 stsp ret="$?"
133 80c1b583 2019-08-07 stsp if [ "$ret" != "0" ]; then
134 80c1b583 2019-08-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
135 80c1b583 2019-08-07 stsp fi
136 80c1b583 2019-08-07 stsp test_done "$testroot" "$ret"
137 80c1b583 2019-08-07 stsp
138 80c1b583 2019-08-07 stsp }
139 80c1b583 2019-08-07 stsp
140 68ed9ba5 2019-02-10 stsp function test_checkout_sets_xbit {
141 68ed9ba5 2019-02-10 stsp local testroot=`test_init checkout_sets_xbit 1`
142 68ed9ba5 2019-02-10 stsp
143 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
144 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
145 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
146 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
147 68ed9ba5 2019-02-10 stsp
148 68ed9ba5 2019-02-10 stsp echo "A $testroot/wt/xfile" > $testroot/stdout.expected
149 68ed9ba5 2019-02-10 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
150 68ed9ba5 2019-02-10 stsp
151 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
152 68ed9ba5 2019-02-10 stsp ret="$?"
153 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
154 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
155 68ed9ba5 2019-02-10 stsp return 1
156 68ed9ba5 2019-02-10 stsp fi
157 68ed9ba5 2019-02-10 stsp
158 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
159 68ed9ba5 2019-02-10 stsp ret="$?"
160 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
161 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
162 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
163 68ed9ba5 2019-02-10 stsp return 1
164 68ed9ba5 2019-02-10 stsp fi
165 68ed9ba5 2019-02-10 stsp
166 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
167 68ed9ba5 2019-02-10 stsp ret="$?"
168 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
169 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
170 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
171 68ed9ba5 2019-02-10 stsp fi
172 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
173 68ed9ba5 2019-02-10 stsp }
174 68ed9ba5 2019-02-10 stsp
175 45d344f6 2019-05-14 stsp function test_checkout_commit_from_wrong_branch {
176 45d344f6 2019-05-14 stsp local testroot=`test_init checkout_commit_from_wrong_branch`
177 45d344f6 2019-05-14 stsp
178 45d344f6 2019-05-14 stsp (cd $testroot/repo && git checkout -q -b newbranch)
179 45d344f6 2019-05-14 stsp echo "modified alpha on new branch" > $testroot/repo/alpha
180 45d344f6 2019-05-14 stsp git_commit $testroot/repo -m "modified alpha on new branch"
181 45d344f6 2019-05-14 stsp
182 45d344f6 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
183 45d344f6 2019-05-14 stsp got checkout -b master -c $head_rev $testroot/repo $testroot/wt \
184 45d344f6 2019-05-14 stsp > $testroot/stdout 2> $testroot/stderr
185 45d344f6 2019-05-14 stsp ret="$?"
186 45d344f6 2019-05-14 stsp if [ "$ret" == "0" ]; then
187 45d344f6 2019-05-14 stsp test_done "$testroot" "1"
188 45d344f6 2019-05-14 stsp return 1
189 45d344f6 2019-05-14 stsp fi
190 45d344f6 2019-05-14 stsp
191 45d344f6 2019-05-14 stsp echo -n "" > $testroot/stdout.expected
192 45d344f6 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
193 45d344f6 2019-05-14 stsp ret="$?"
194 45d344f6 2019-05-14 stsp if [ "$ret" != "0" ]; then
195 45d344f6 2019-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
196 45d344f6 2019-05-14 stsp test_done "$testroot" "$ret"
197 45d344f6 2019-05-14 stsp return 1
198 45d344f6 2019-05-14 stsp fi
199 45d344f6 2019-05-14 stsp
200 45d344f6 2019-05-14 stsp echo "got: target commit is on a different branch" \
201 45d344f6 2019-05-14 stsp > $testroot/stderr.expected
202 45d344f6 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
203 45d344f6 2019-05-14 stsp ret="$?"
204 45d344f6 2019-05-14 stsp if [ "$ret" != "0" ]; then
205 45d344f6 2019-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
206 45d344f6 2019-05-14 stsp test_done "$testroot" "$ret"
207 45d344f6 2019-05-14 stsp return 1
208 45d344f6 2019-05-14 stsp fi
209 45d344f6 2019-05-14 stsp
210 45d344f6 2019-05-14 stsp test_done "$testroot" "$ret"
211 45d344f6 2019-05-14 stsp }
212 45d344f6 2019-05-14 stsp
213 303e2782 2019-08-09 stsp function test_checkout_tag {
214 303e2782 2019-08-09 stsp local testroot=`test_init checkout_tag`
215 303e2782 2019-08-09 stsp local tag="1.0.0"
216 303e2782 2019-08-09 stsp
217 303e2782 2019-08-09 stsp (cd $testroot/repo && git tag -a -m "test" $tag)
218 303e2782 2019-08-09 stsp
219 303e2782 2019-08-09 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
220 303e2782 2019-08-09 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
221 303e2782 2019-08-09 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
222 303e2782 2019-08-09 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
223 303e2782 2019-08-09 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
224 303e2782 2019-08-09 stsp
225 303e2782 2019-08-09 stsp got checkout -c $tag $testroot/repo $testroot/wt > $testroot/stdout
226 303e2782 2019-08-09 stsp ret="$?"
227 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
228 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
229 303e2782 2019-08-09 stsp return 1
230 303e2782 2019-08-09 stsp fi
231 303e2782 2019-08-09 stsp
232 303e2782 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
233 303e2782 2019-08-09 stsp ret="$?"
234 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
235 303e2782 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
236 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
237 303e2782 2019-08-09 stsp return 1
238 303e2782 2019-08-09 stsp fi
239 303e2782 2019-08-09 stsp
240 303e2782 2019-08-09 stsp echo "alpha" > $testroot/content.expected
241 303e2782 2019-08-09 stsp echo "beta" >> $testroot/content.expected
242 303e2782 2019-08-09 stsp echo "zeta" >> $testroot/content.expected
243 303e2782 2019-08-09 stsp echo "delta" >> $testroot/content.expected
244 303e2782 2019-08-09 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
245 303e2782 2019-08-09 stsp $testroot/wt/gamma/delta > $testroot/content
246 303e2782 2019-08-09 stsp
247 303e2782 2019-08-09 stsp cmp -s $testroot/content.expected $testroot/content
248 303e2782 2019-08-09 stsp ret="$?"
249 303e2782 2019-08-09 stsp if [ "$ret" != "0" ]; then
250 303e2782 2019-08-09 stsp diff -u $testroot/content.expected $testroot/content
251 303e2782 2019-08-09 stsp fi
252 303e2782 2019-08-09 stsp test_done "$testroot" "$ret"
253 303e2782 2019-08-09 stsp }
254 63c5ca5d 2019-08-24 stsp
255 63c5ca5d 2019-08-24 stsp function test_checkout_ignores_submodules {
256 63c5ca5d 2019-08-24 stsp local testroot=`test_init checkout_ignores_submodules`
257 63c5ca5d 2019-08-24 stsp
258 63c5ca5d 2019-08-24 stsp (cd $testroot && git clone -q repo repo2 >/dev/null)
259 63c5ca5d 2019-08-24 stsp (cd $testroot/repo && git submodule -q add ../repo2)
260 63c5ca5d 2019-08-24 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
261 63c5ca5d 2019-08-24 stsp
262 63c5ca5d 2019-08-24 stsp echo "A $testroot/wt/.gitmodules" > $testroot/stdout.expected
263 63c5ca5d 2019-08-24 stsp echo "A $testroot/wt/alpha" >> $testroot/stdout.expected
264 63c5ca5d 2019-08-24 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
265 63c5ca5d 2019-08-24 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
266 63c5ca5d 2019-08-24 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
267 63c5ca5d 2019-08-24 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
268 303e2782 2019-08-09 stsp
269 63c5ca5d 2019-08-24 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
270 63c5ca5d 2019-08-24 stsp ret="$?"
271 63c5ca5d 2019-08-24 stsp if [ "$ret" != "0" ]; then
272 63c5ca5d 2019-08-24 stsp test_done "$testroot" "$ret"
273 63c5ca5d 2019-08-24 stsp return 1
274 63c5ca5d 2019-08-24 stsp fi
275 63c5ca5d 2019-08-24 stsp
276 63c5ca5d 2019-08-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
277 63c5ca5d 2019-08-24 stsp ret="$?"
278 63c5ca5d 2019-08-24 stsp if [ "$ret" != "0" ]; then
279 63c5ca5d 2019-08-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
280 63c5ca5d 2019-08-24 stsp test_done "$testroot" "$ret"
281 63c5ca5d 2019-08-24 stsp return 1
282 63c5ca5d 2019-08-24 stsp fi
283 63c5ca5d 2019-08-24 stsp
284 63c5ca5d 2019-08-24 stsp echo "alpha" > $testroot/content.expected
285 63c5ca5d 2019-08-24 stsp echo "beta" >> $testroot/content.expected
286 63c5ca5d 2019-08-24 stsp echo "zeta" >> $testroot/content.expected
287 63c5ca5d 2019-08-24 stsp echo "delta" >> $testroot/content.expected
288 63c5ca5d 2019-08-24 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
289 63c5ca5d 2019-08-24 stsp $testroot/wt/gamma/delta > $testroot/content
290 63c5ca5d 2019-08-24 stsp
291 63c5ca5d 2019-08-24 stsp cmp -s $testroot/content.expected $testroot/content
292 63c5ca5d 2019-08-24 stsp ret="$?"
293 63c5ca5d 2019-08-24 stsp if [ "$ret" != "0" ]; then
294 63c5ca5d 2019-08-24 stsp diff -u $testroot/content.expected $testroot/content
295 63c5ca5d 2019-08-24 stsp fi
296 63c5ca5d 2019-08-24 stsp test_done "$testroot" "$ret"
297 63c5ca5d 2019-08-24 stsp }
298 7f47418f 2019-12-20 stsp
299 7f47418f 2019-12-20 stsp function test_checkout_read_only {
300 7f47418f 2019-12-20 stsp local testroot=`test_init checkout_read_only`
301 7f47418f 2019-12-20 stsp
302 7f47418f 2019-12-20 stsp # Make the repostiory read-only
303 7f47418f 2019-12-20 stsp chmod -R a-w $testroot/repo
304 7f47418f 2019-12-20 stsp
305 7f47418f 2019-12-20 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
306 7f47418f 2019-12-20 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
307 7f47418f 2019-12-20 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
308 7f47418f 2019-12-20 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
309 7f47418f 2019-12-20 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
310 7f47418f 2019-12-20 stsp
311 7f47418f 2019-12-20 stsp got checkout $testroot/repo $testroot/wt \
312 7f47418f 2019-12-20 stsp > $testroot/stdout 2> $testroot/stderr
313 7f47418f 2019-12-20 stsp ret="$?"
314 7f47418f 2019-12-20 stsp if [ "$ret" != "0" ]; then
315 7f47418f 2019-12-20 stsp test_done "$testroot" "$ret"
316 7f47418f 2019-12-20 stsp return 1
317 7f47418f 2019-12-20 stsp fi
318 63c5ca5d 2019-08-24 stsp
319 7f47418f 2019-12-20 stsp cmp -s $testroot/stdout.expected $testroot/stdout
320 7f47418f 2019-12-20 stsp ret="$?"
321 7f47418f 2019-12-20 stsp if [ "$ret" != "0" ]; then
322 7f47418f 2019-12-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
323 7f47418f 2019-12-20 stsp test_done "$testroot" "$ret"
324 7f47418f 2019-12-20 stsp return 1
325 7f47418f 2019-12-20 stsp fi
326 7f47418f 2019-12-20 stsp
327 7f47418f 2019-12-20 stsp echo -n "got: warning: could not create a reference " \
328 7f47418f 2019-12-20 stsp > $testroot/stderr.expected
329 7f47418f 2019-12-20 stsp echo -n "to the work tree's base commit; the commit could " \
330 7f47418f 2019-12-20 stsp >> $testroot/stderr.expected
331 7f47418f 2019-12-20 stsp echo -n "be garbage-collected by Git; making the repository " \
332 7f47418f 2019-12-20 stsp >> $testroot/stderr.expected
333 7f47418f 2019-12-20 stsp echo "writable and running 'got update' will prevent this" \
334 7f47418f 2019-12-20 stsp >> $testroot/stderr.expected
335 7f47418f 2019-12-20 stsp cmp -s $testroot/stderr.expected $testroot/stderr
336 7f47418f 2019-12-20 stsp ret="$?"
337 7f47418f 2019-12-20 stsp if [ "$ret" != "0" ]; then
338 7f47418f 2019-12-20 stsp diff -u $testroot/stderr.expected $testroot/stderr
339 7f47418f 2019-12-20 stsp test_done "$testroot" "$ret"
340 7f47418f 2019-12-20 stsp return 1
341 7f47418f 2019-12-20 stsp fi
342 7f47418f 2019-12-20 stsp
343 7f47418f 2019-12-20 stsp echo "alpha" > $testroot/content.expected
344 7f47418f 2019-12-20 stsp echo "beta" >> $testroot/content.expected
345 7f47418f 2019-12-20 stsp echo "zeta" >> $testroot/content.expected
346 7f47418f 2019-12-20 stsp echo "delta" >> $testroot/content.expected
347 7f47418f 2019-12-20 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
348 7f47418f 2019-12-20 stsp $testroot/wt/gamma/delta > $testroot/content
349 7f47418f 2019-12-20 stsp
350 7f47418f 2019-12-20 stsp cmp -s $testroot/content.expected $testroot/content
351 7f47418f 2019-12-20 stsp ret="$?"
352 7f47418f 2019-12-20 stsp if [ "$ret" != "0" ]; then
353 7f47418f 2019-12-20 stsp diff -u $testroot/content.expected $testroot/content
354 7f47418f 2019-12-20 stsp fi
355 7f47418f 2019-12-20 stsp chmod -R u+w $testroot/repo # make repo cleanup work
356 7f47418f 2019-12-20 stsp test_done "$testroot" "$ret"
357 7f47418f 2019-12-20 stsp }
358 7f47418f 2019-12-20 stsp
359 0e673013 2019-01-02 stsp run_test test_checkout_basic
360 80c1b583 2019-08-07 stsp run_test test_checkout_dir_exists
361 80c1b583 2019-08-07 stsp run_test test_checkout_dir_not_empty
362 68ed9ba5 2019-02-10 stsp run_test test_checkout_sets_xbit
363 45d344f6 2019-05-14 stsp run_test test_checkout_commit_from_wrong_branch
364 303e2782 2019-08-09 stsp run_test test_checkout_tag
365 63c5ca5d 2019-08-24 stsp run_test test_checkout_ignores_submodules
366 7f47418f 2019-12-20 stsp run_test test_checkout_read_only