Blame


1 6dbf1e9e 2019-03-26 stsp #!/bin/sh
2 6dbf1e9e 2019-03-26 stsp #
3 6dbf1e9e 2019-03-26 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 6dbf1e9e 2019-03-26 stsp #
5 6dbf1e9e 2019-03-26 stsp # Permission to use, copy, modify, and distribute this software for any
6 6dbf1e9e 2019-03-26 stsp # purpose with or without fee is hereby granted, provided that the above
7 6dbf1e9e 2019-03-26 stsp # copyright notice and this permission notice appear in all copies.
8 6dbf1e9e 2019-03-26 stsp #
9 6dbf1e9e 2019-03-26 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 6dbf1e9e 2019-03-26 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 6dbf1e9e 2019-03-26 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 6dbf1e9e 2019-03-26 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 6dbf1e9e 2019-03-26 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 6dbf1e9e 2019-03-26 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 6dbf1e9e 2019-03-26 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 6dbf1e9e 2019-03-26 stsp
17 6dbf1e9e 2019-03-26 stsp . ./common.sh
18 6dbf1e9e 2019-03-26 stsp
19 f6cae3ed 2020-09-13 naddy test_add_basic() {
20 6dbf1e9e 2019-03-26 stsp local testroot=`test_init add_basic`
21 6dbf1e9e 2019-03-26 stsp
22 6dbf1e9e 2019-03-26 stsp got checkout $testroot/repo $testroot/wt > /dev/null
23 6dbf1e9e 2019-03-26 stsp ret="$?"
24 6dbf1e9e 2019-03-26 stsp if [ "$ret" != "0" ]; then
25 6dbf1e9e 2019-03-26 stsp test_done "$testroot" "$ret"
26 6dbf1e9e 2019-03-26 stsp return 1
27 6dbf1e9e 2019-03-26 stsp fi
28 6dbf1e9e 2019-03-26 stsp
29 6dbf1e9e 2019-03-26 stsp echo "new file" > $testroot/wt/foo
30 6dbf1e9e 2019-03-26 stsp
31 6dbf1e9e 2019-03-26 stsp echo 'A foo' > $testroot/stdout.expected
32 6dbf1e9e 2019-03-26 stsp (cd $testroot/wt && got add foo > $testroot/stdout)
33 6dbf1e9e 2019-03-26 stsp
34 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
35 6dbf1e9e 2019-03-26 stsp ret="$?"
36 6dbf1e9e 2019-03-26 stsp if [ "$ret" != "0" ]; then
37 6dbf1e9e 2019-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
38 6dbf1e9e 2019-03-26 stsp fi
39 6dbf1e9e 2019-03-26 stsp test_done "$testroot" "$ret"
40 6dbf1e9e 2019-03-26 stsp }
41 6dbf1e9e 2019-03-26 stsp
42 f6cae3ed 2020-09-13 naddy test_double_add() {
43 5c99ca9f 2019-03-27 stsp local testroot=`test_init double_add`
44 5c99ca9f 2019-03-27 stsp
45 5c99ca9f 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
46 5c99ca9f 2019-03-27 stsp ret="$?"
47 5c99ca9f 2019-03-27 stsp if [ "$ret" != "0" ]; then
48 5c99ca9f 2019-03-27 stsp test_done "$testroot" "$ret"
49 5c99ca9f 2019-03-27 stsp return 1
50 5c99ca9f 2019-03-27 stsp fi
51 5c99ca9f 2019-03-27 stsp
52 5c99ca9f 2019-03-27 stsp echo "new file" > $testroot/wt/foo
53 5c99ca9f 2019-03-27 stsp (cd $testroot/wt && got add foo > /dev/null)
54 5c99ca9f 2019-03-27 stsp
55 dbb83fbd 2019-12-12 stsp (cd $testroot/wt && got add foo > $testroot/stdout)
56 5c99ca9f 2019-03-27 stsp ret="$?"
57 723c305c 2019-05-11 jcs if [ "$ret" != "0" ]; then
58 723c305c 2019-05-11 jcs echo "got add failed unexpectedly" >&2
59 5c99ca9f 2019-03-27 stsp test_done "$testroot" 1
60 a7c182ac 2019-03-27 stsp return 1
61 5c99ca9f 2019-03-27 stsp fi
62 5c99ca9f 2019-03-27 stsp
63 dbb83fbd 2019-12-12 stsp echo -n > $testroot/stdout.expected
64 dbb83fbd 2019-12-12 stsp cmp -s $testroot/stdout.expected $testroot/stdout
65 dbb83fbd 2019-12-12 stsp ret="$?"
66 dbb83fbd 2019-12-12 stsp if [ "$ret" != "0" ]; then
67 dbb83fbd 2019-12-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
68 dbb83fbd 2019-12-12 stsp fi
69 723c305c 2019-05-11 jcs test_done "$testroot" "$ret"
70 723c305c 2019-05-11 jcs }
71 723c305c 2019-05-11 jcs
72 f6cae3ed 2020-09-13 naddy test_add_multiple() {
73 723c305c 2019-05-11 jcs local testroot=`test_init multiple_add`
74 723c305c 2019-05-11 jcs
75 723c305c 2019-05-11 jcs got checkout $testroot/repo $testroot/wt > /dev/null
76 5c99ca9f 2019-03-27 stsp ret="$?"
77 5c99ca9f 2019-03-27 stsp if [ "$ret" != "0" ]; then
78 723c305c 2019-05-11 jcs test_done "$testroot" "$ret"
79 723c305c 2019-05-11 jcs return 1
80 5c99ca9f 2019-03-27 stsp fi
81 723c305c 2019-05-11 jcs
82 723c305c 2019-05-11 jcs echo "new file" > $testroot/wt/foo
83 723c305c 2019-05-11 jcs echo "new file" > $testroot/wt/bar
84 723c305c 2019-05-11 jcs echo "new file" > $testroot/wt/baz
85 2b01eb6c 2019-05-11 stsp (cd $testroot/wt && got add foo bar baz > $testroot/stdout)
86 723c305c 2019-05-11 jcs ret="$?"
87 723c305c 2019-05-11 jcs if [ "$ret" != "0" ]; then
88 723c305c 2019-05-11 jcs echo "got add failed unexpectedly" >&2
89 723c305c 2019-05-11 jcs test_done "$testroot" 1
90 723c305c 2019-05-11 jcs return 1
91 723c305c 2019-05-11 jcs fi
92 723c305c 2019-05-11 jcs
93 6d022e97 2019-08-04 stsp echo "A foo" > $testroot/stdout.expected
94 6d022e97 2019-08-04 stsp echo "A bar" >> $testroot/stdout.expected
95 2b01eb6c 2019-05-11 stsp echo "A baz" >> $testroot/stdout.expected
96 2b01eb6c 2019-05-11 stsp
97 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
98 2b01eb6c 2019-05-11 stsp ret="$?"
99 2b01eb6c 2019-05-11 stsp if [ "$ret" != "0" ]; then
100 2b01eb6c 2019-05-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
101 2b01eb6c 2019-05-11 stsp fi
102 5c99ca9f 2019-03-27 stsp test_done "$testroot" "$ret"
103 5c99ca9f 2019-03-27 stsp }
104 5c99ca9f 2019-03-27 stsp
105 f6cae3ed 2020-09-13 naddy test_add_file_in_new_subdir() {
106 a9fa2909 2019-07-27 stsp local testroot=`test_init add_file_in_new_subdir`
107 a9fa2909 2019-07-27 stsp
108 a9fa2909 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
109 a9fa2909 2019-07-27 stsp ret="$?"
110 a9fa2909 2019-07-27 stsp if [ "$ret" != "0" ]; then
111 a9fa2909 2019-07-27 stsp test_done "$testroot" "$ret"
112 a9fa2909 2019-07-27 stsp return 1
113 a9fa2909 2019-07-27 stsp fi
114 a9fa2909 2019-07-27 stsp
115 a9fa2909 2019-07-27 stsp mkdir -p $testroot/wt/new
116 a9fa2909 2019-07-27 stsp echo "new file" > $testroot/wt/new/foo
117 a9fa2909 2019-07-27 stsp
118 a9fa2909 2019-07-27 stsp echo 'A new/foo' > $testroot/stdout.expected
119 a9fa2909 2019-07-27 stsp (cd $testroot/wt && got add new/foo > $testroot/stdout)
120 a9fa2909 2019-07-27 stsp
121 a9fa2909 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
122 a9fa2909 2019-07-27 stsp ret="$?"
123 a9fa2909 2019-07-27 stsp if [ "$ret" != "0" ]; then
124 a9fa2909 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
125 a9fa2909 2019-07-27 stsp fi
126 a9fa2909 2019-07-27 stsp test_done "$testroot" "$ret"
127 a9fa2909 2019-07-27 stsp }
128 a9fa2909 2019-07-27 stsp
129 f6cae3ed 2020-09-13 naddy test_add_deleted() {
130 6d022e97 2019-08-04 stsp local testroot=`test_init add_deleted`
131 6d022e97 2019-08-04 stsp
132 6d022e97 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
133 6d022e97 2019-08-04 stsp ret="$?"
134 6d022e97 2019-08-04 stsp if [ "$ret" != "0" ]; then
135 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
136 6d022e97 2019-08-04 stsp return 1
137 6d022e97 2019-08-04 stsp fi
138 6d022e97 2019-08-04 stsp
139 6d022e97 2019-08-04 stsp (cd $testroot/wt && got rm beta > /dev/null)
140 6d022e97 2019-08-04 stsp
141 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
142 6d022e97 2019-08-04 stsp (cd $testroot/wt && got add beta > $testroot/stdout 2> $testroot/stderr)
143 6d022e97 2019-08-04 stsp ret="$?"
144 6d022e97 2019-08-04 stsp if [ "$ret" == "0" ]; then
145 6d022e97 2019-08-04 stsp echo "got add command succeeded unexpectedly" >&2
146 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
147 6d022e97 2019-08-04 stsp test_done "$testroot" "1"
148 6d022e97 2019-08-04 stsp return 1
149 6d022e97 2019-08-04 stsp fi
150 6d022e97 2019-08-04 stsp
151 6d022e97 2019-08-04 stsp echo "got: beta: file has unexpected status" > $testroot/stderr.expected
152 6d022e97 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
153 6d022e97 2019-08-04 stsp ret="$?"
154 6d022e97 2019-08-04 stsp if [ "$ret" != "0" ]; then
155 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
156 6d022e97 2019-08-04 stsp fi
157 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
158 6d022e97 2019-08-04 stsp }
159 6d022e97 2019-08-04 stsp
160 f6cae3ed 2020-09-13 naddy test_add_directory() {
161 4e68cba3 2019-11-23 stsp local testroot=`test_init add_directory`
162 4e68cba3 2019-11-23 stsp
163 4e68cba3 2019-11-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
164 4e68cba3 2019-11-23 stsp ret="$?"
165 4e68cba3 2019-11-23 stsp if [ "$ret" != "0" ]; then
166 4e68cba3 2019-11-23 stsp test_done "$testroot" "$ret"
167 4e68cba3 2019-11-23 stsp return 1
168 4e68cba3 2019-11-23 stsp fi
169 4e68cba3 2019-11-23 stsp
170 4e68cba3 2019-11-23 stsp (cd $testroot/wt && got add . > $testroot/stdout 2> $testroot/stderr)
171 4e68cba3 2019-11-23 stsp ret="$?"
172 022fae89 2019-12-06 tracey echo "got: adding directories requires -R option" \
173 022fae89 2019-12-06 tracey > $testroot/stderr.expected
174 022fae89 2019-12-06 tracey cmp -s $testroot/stderr.expected $testroot/stderr
175 022fae89 2019-12-06 tracey ret="$?"
176 022fae89 2019-12-06 tracey if [ "$ret" != "0" ]; then
177 022fae89 2019-12-06 tracey diff -u $testroot/stderr.expected $testroot/stderr
178 022fae89 2019-12-06 tracey test_done "$testroot" "$ret"
179 4e68cba3 2019-11-23 stsp return 1
180 4e68cba3 2019-11-23 stsp fi
181 022fae89 2019-12-06 tracey
182 022fae89 2019-12-06 tracey (cd $testroot/wt && got add -I . > $testroot/stdout 2> $testroot/stderr)
183 022fae89 2019-12-06 tracey ret="$?"
184 022fae89 2019-12-06 tracey echo "got: disregarding ignores requires -R option" \
185 4e68cba3 2019-11-23 stsp > $testroot/stderr.expected
186 4e68cba3 2019-11-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
187 4e68cba3 2019-11-23 stsp ret="$?"
188 4e68cba3 2019-11-23 stsp if [ "$ret" != "0" ]; then
189 4e68cba3 2019-11-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
190 4e68cba3 2019-11-23 stsp test_done "$testroot" "$ret"
191 4e68cba3 2019-11-23 stsp return 1
192 4e68cba3 2019-11-23 stsp fi
193 4e68cba3 2019-11-23 stsp
194 4e68cba3 2019-11-23 stsp echo -n > $testroot/stdout.expected
195 4e68cba3 2019-11-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
196 4e68cba3 2019-11-23 stsp ret="$?"
197 4e68cba3 2019-11-23 stsp if [ "$ret" != "0" ]; then
198 4e68cba3 2019-11-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
199 4e68cba3 2019-11-23 stsp test_done "$testroot" "$ret"
200 4e68cba3 2019-11-23 stsp return 1
201 4e68cba3 2019-11-23 stsp fi
202 4e68cba3 2019-11-23 stsp
203 022fae89 2019-12-06 tracey mkdir -p $testroot/wt/tree1
204 022fae89 2019-12-06 tracey mkdir -p $testroot/wt/tree2
205 022fae89 2019-12-06 tracey echo "tree1/**" > $testroot/wt/.gitignore
206 022fae89 2019-12-06 tracey echo "tree2/**" >> $testroot/wt/.gitignore
207 022fae89 2019-12-06 tracey echo -n > $testroot/wt/tree1/foo
208 022fae89 2019-12-06 tracey echo -n > $testroot/wt/tree2/foo
209 022fae89 2019-12-06 tracey echo -n > $testroot/wt/epsilon/zeta1
210 022fae89 2019-12-06 tracey echo -n > $testroot/wt/epsilon/zeta2
211 4e68cba3 2019-11-23 stsp
212 4e68cba3 2019-11-23 stsp (cd $testroot/wt && got add -R . > $testroot/stdout)
213 4e68cba3 2019-11-23 stsp
214 022fae89 2019-12-06 tracey echo 'A .gitignore' > $testroot/stdout.expected
215 022fae89 2019-12-06 tracey echo 'A epsilon/zeta1' >> $testroot/stdout.expected
216 4e68cba3 2019-11-23 stsp echo 'A epsilon/zeta2' >> $testroot/stdout.expected
217 4e68cba3 2019-11-23 stsp
218 4e68cba3 2019-11-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
219 4e68cba3 2019-11-23 stsp ret="$?"
220 4e68cba3 2019-11-23 stsp if [ "$ret" != "0" ]; then
221 4e68cba3 2019-11-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
222 4e68cba3 2019-11-23 stsp test_done "$testroot" "$ret"
223 4e68cba3 2019-11-23 stsp return 1
224 4e68cba3 2019-11-23 stsp fi
225 4e68cba3 2019-11-23 stsp
226 022fae89 2019-12-06 tracey (cd $testroot/wt && got add -RI tree1 > $testroot/stdout)
227 4e68cba3 2019-11-23 stsp
228 022fae89 2019-12-06 tracey echo 'A tree1/foo' > $testroot/stdout.expected
229 022fae89 2019-12-06 tracey
230 022fae89 2019-12-06 tracey cmp -s $testroot/stdout.expected $testroot/stdout
231 4e68cba3 2019-11-23 stsp ret="$?"
232 4e68cba3 2019-11-23 stsp if [ "$ret" != "0" ]; then
233 022fae89 2019-12-06 tracey diff -u $testroot/stdout.expected $testroot/stdout
234 022fae89 2019-12-06 tracey test_done "$testroot" "$ret"
235 022fae89 2019-12-06 tracey return 1
236 4e68cba3 2019-11-23 stsp fi
237 022fae89 2019-12-06 tracey
238 022fae89 2019-12-06 tracey (cd $testroot/wt && got add tree2/foo > $testroot/stdout)
239 022fae89 2019-12-06 tracey
240 022fae89 2019-12-06 tracey echo 'A tree2/foo' > $testroot/stdout.expected
241 e7303626 2020-05-14 stsp
242 e7303626 2020-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
243 e7303626 2020-05-14 stsp ret="$?"
244 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
245 e7303626 2020-05-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
246 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
247 e7303626 2020-05-14 stsp return 1
248 e7303626 2020-05-14 stsp fi
249 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
250 e7303626 2020-05-14 stsp }
251 e7303626 2020-05-14 stsp
252 f6cae3ed 2020-09-13 naddy test_add_clashes_with_submodule() {
253 e7303626 2020-05-14 stsp local testroot=`test_init add_clashes_with_submodule`
254 e7303626 2020-05-14 stsp
255 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
256 e7303626 2020-05-14 stsp
257 e7303626 2020-05-14 stsp (cd $testroot/repo && git submodule -q add ../repo2)
258 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
259 e7303626 2020-05-14 stsp
260 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
261 e7303626 2020-05-14 stsp
262 e7303626 2020-05-14 stsp # Atttempt to add a file clashes with a submodule
263 e7303626 2020-05-14 stsp echo "This is a file called repo2" > $testroot/wt/repo2
264 e7303626 2020-05-14 stsp (cd $testroot/wt && got add repo2 > /dev/null)
265 022fae89 2019-12-06 tracey
266 e7303626 2020-05-14 stsp (cd $testroot/wt && got status > $testroot/stdout)
267 e7303626 2020-05-14 stsp echo "A repo2" > $testroot/stdout.expected
268 022fae89 2019-12-06 tracey cmp -s $testroot/stdout.expected $testroot/stdout
269 022fae89 2019-12-06 tracey ret="$?"
270 022fae89 2019-12-06 tracey if [ "$ret" != "0" ]; then
271 022fae89 2019-12-06 tracey diff -u $testroot/stdout.expected $testroot/stdout
272 022fae89 2019-12-06 tracey test_done "$testroot" "$ret"
273 022fae89 2019-12-06 tracey return 1
274 022fae89 2019-12-06 tracey fi
275 e7303626 2020-05-14 stsp
276 e7303626 2020-05-14 stsp # Update for good measure; see the error below.
277 e7303626 2020-05-14 stsp (cd $testroot/wt && got update > /dev/null)
278 e7303626 2020-05-14 stsp
279 e7303626 2020-05-14 stsp # This currently fails with "work tree must be updated"...
280 e7303626 2020-05-14 stsp (cd $testroot/wt && got commit -m 'add file repo2' \
281 e7303626 2020-05-14 stsp > $testroot/stdout 2> $testroot/stderr)
282 e7303626 2020-05-14 stsp ret="$?"
283 e7303626 2020-05-14 stsp if [ "$ret" == "0" ]; then
284 e7303626 2020-05-14 stsp echo "commit succeeded unexpectedly" >&2
285 e7303626 2020-05-14 stsp test_done "$testroot" "1"
286 e7303626 2020-05-14 stsp return 1
287 e7303626 2020-05-14 stsp fi
288 e7303626 2020-05-14 stsp
289 e7303626 2020-05-14 stsp echo -n "got: work tree must be updated " > $testroot/stderr.expected
290 e7303626 2020-05-14 stsp echo "before these changes can be committed" >> $testroot/stderr.expected
291 e7303626 2020-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
292 e7303626 2020-05-14 stsp ret="$?"
293 e7303626 2020-05-14 stsp if [ "$ret" != "0" ]; then
294 e7303626 2020-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
295 00bb5ea0 2020-07-23 stsp fi
296 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
297 00bb5ea0 2020-07-23 stsp }
298 00bb5ea0 2020-07-23 stsp
299 f6cae3ed 2020-09-13 naddy test_add_symlink() {
300 00bb5ea0 2020-07-23 stsp local testroot=`test_init add_symlink`
301 00bb5ea0 2020-07-23 stsp
302 00bb5ea0 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
303 00bb5ea0 2020-07-23 stsp ret="$?"
304 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
305 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
306 00bb5ea0 2020-07-23 stsp return 1
307 00bb5ea0 2020-07-23 stsp fi
308 00bb5ea0 2020-07-23 stsp
309 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s alpha alpha.link)
310 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s epsilon epsilon.link)
311 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s /etc/passwd passwd.link)
312 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s ../beta epsilon/beta.link)
313 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s nonexistent nonexistent.link)
314 00bb5ea0 2020-07-23 stsp
315 00bb5ea0 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
316 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got add alpha.link > $testroot/stdout)
317 00bb5ea0 2020-07-23 stsp ret="$?"
318 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
319 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
320 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
321 00bb5ea0 2020-07-23 stsp return 1
322 00bb5ea0 2020-07-23 stsp fi
323 00bb5ea0 2020-07-23 stsp
324 00bb5ea0 2020-07-23 stsp echo "A epsilon.link" > $testroot/stdout.expected
325 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got add epsilon.link > $testroot/stdout)
326 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
327 00bb5ea0 2020-07-23 stsp ret="$?"
328 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
329 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
330 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
331 00bb5ea0 2020-07-23 stsp return 1
332 e7303626 2020-05-14 stsp fi
333 00bb5ea0 2020-07-23 stsp
334 00bb5ea0 2020-07-23 stsp echo "A passwd.link" > $testroot/stdout.expected
335 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got add passwd.link > $testroot/stdout)
336 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
337 00bb5ea0 2020-07-23 stsp ret="$?"
338 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
339 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
340 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
341 00bb5ea0 2020-07-23 stsp return 1
342 00bb5ea0 2020-07-23 stsp fi
343 00bb5ea0 2020-07-23 stsp
344 00bb5ea0 2020-07-23 stsp echo "A epsilon/beta.link" > $testroot/stdout.expected
345 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got add epsilon/beta.link > $testroot/stdout)
346 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
347 00bb5ea0 2020-07-23 stsp ret="$?"
348 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
349 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
350 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
351 00bb5ea0 2020-07-23 stsp return 1
352 00bb5ea0 2020-07-23 stsp fi
353 00bb5ea0 2020-07-23 stsp
354 00bb5ea0 2020-07-23 stsp echo "A nonexistent.link" > $testroot/stdout.expected
355 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got add nonexistent.link > $testroot/stdout)
356 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
357 00bb5ea0 2020-07-23 stsp ret="$?"
358 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
359 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
360 00bb5ea0 2020-07-23 stsp fi
361 4e68cba3 2019-11-23 stsp test_done "$testroot" "$ret"
362 4e68cba3 2019-11-23 stsp }
363 4e68cba3 2019-11-23 stsp
364 7fb414ae 2020-08-08 stsp test_parseargs "$@"
365 6dbf1e9e 2019-03-26 stsp run_test test_add_basic
366 5c99ca9f 2019-03-27 stsp run_test test_double_add
367 2b01eb6c 2019-05-11 stsp run_test test_add_multiple
368 a9fa2909 2019-07-27 stsp run_test test_add_file_in_new_subdir
369 6d022e97 2019-08-04 stsp run_test test_add_deleted
370 4e68cba3 2019-11-23 stsp run_test test_add_directory
371 e7303626 2020-05-14 stsp run_test test_add_clashes_with_submodule
372 00bb5ea0 2020-07-23 stsp run_test test_add_symlink