Blame


1 35dc4510 2019-02-04 stsp #!/bin/sh
2 35dc4510 2019-02-04 stsp #
3 35dc4510 2019-02-04 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 35dc4510 2019-02-04 stsp #
5 35dc4510 2019-02-04 stsp # Permission to use, copy, modify, and distribute this software for any
6 35dc4510 2019-02-04 stsp # purpose with or without fee is hereby granted, provided that the above
7 35dc4510 2019-02-04 stsp # copyright notice and this permission notice appear in all copies.
8 35dc4510 2019-02-04 stsp #
9 35dc4510 2019-02-04 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 35dc4510 2019-02-04 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 35dc4510 2019-02-04 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 35dc4510 2019-02-04 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 35dc4510 2019-02-04 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 35dc4510 2019-02-04 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 35dc4510 2019-02-04 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 35dc4510 2019-02-04 stsp
17 35dc4510 2019-02-04 stsp . ./common.sh
18 35dc4510 2019-02-04 stsp
19 f6cae3ed 2020-09-13 naddy test_status_basic() {
20 35dc4510 2019-02-04 stsp local testroot=`test_init status_basic`
21 35dc4510 2019-02-04 stsp
22 35dc4510 2019-02-04 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 35dc4510 2019-02-04 stsp return 1
27 35dc4510 2019-02-04 stsp fi
28 35dc4510 2019-02-04 stsp
29 35dc4510 2019-02-04 stsp echo "modified alpha" > $testroot/wt/alpha
30 2ec1f75b 2019-03-26 stsp (cd $testroot/wt && got rm beta >/dev/null)
31 35dc4510 2019-02-04 stsp echo "unversioned file" > $testroot/wt/foo
32 35dc4510 2019-02-04 stsp rm $testroot/wt/epsilon/zeta
33 14e5d4dc 2019-02-05 stsp touch $testroot/wt/beta
34 d00136be 2019-03-26 stsp echo "new file" > $testroot/wt/new
35 d00136be 2019-03-26 stsp (cd $testroot/wt && got add new >/dev/null)
36 40b289d7 2019-09-07 stsp mkdir -m 0000 $testroot/wt/bar
37 35dc4510 2019-02-04 stsp
38 35dc4510 2019-02-04 stsp echo 'M alpha' > $testroot/stdout.expected
39 2ec1f75b 2019-03-26 stsp echo 'D beta' >> $testroot/stdout.expected
40 35dc4510 2019-02-04 stsp echo '! epsilon/zeta' >> $testroot/stdout.expected
41 35dc4510 2019-02-04 stsp echo '? foo' >> $testroot/stdout.expected
42 d00136be 2019-03-26 stsp echo 'A new' >> $testroot/stdout.expected
43 35dc4510 2019-02-04 stsp
44 35dc4510 2019-02-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
45 35dc4510 2019-02-04 stsp
46 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
47 e60e7f5b 2019-02-10 stsp ret="$?"
48 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
49 35dc4510 2019-02-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
50 35dc4510 2019-02-04 stsp fi
51 40b289d7 2019-09-07 stsp chmod 700 $testroot/wt/bar
52 40b289d7 2019-09-07 stsp rmdir $testroot/wt/bar
53 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
54 35dc4510 2019-02-04 stsp }
55 35dc4510 2019-02-04 stsp
56 f6cae3ed 2020-09-13 naddy test_status_subdir_no_mods() {
57 f02ba292 2019-02-05 stsp local testroot=`test_init status_subdir_no_mods 1`
58 f02ba292 2019-02-05 stsp
59 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Basic/
60 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Basic/Targets/
61 f02ba292 2019-02-05 stsp touch $testroot/repo/Basic/Targets/AArch64.cpp
62 f02ba292 2019-02-05 stsp touch $testroot/repo/Basic/Targets.cpp
63 f02ba292 2019-02-05 stsp touch $testroot/repo/Basic/Targets.h
64 f02ba292 2019-02-05 stsp (cd $testroot/repo && git add .)
65 f02ba292 2019-02-05 stsp git_commit $testroot/repo -m "add subdir with files"
66 f02ba292 2019-02-05 stsp
67 f02ba292 2019-02-05 stsp got checkout $testroot/repo $testroot/wt > /dev/null
68 e60e7f5b 2019-02-10 stsp ret="$?"
69 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
70 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
71 f02ba292 2019-02-05 stsp return 1
72 f02ba292 2019-02-05 stsp fi
73 f02ba292 2019-02-05 stsp
74 f02ba292 2019-02-05 stsp touch $testroot/stdout.expected
75 f02ba292 2019-02-05 stsp
76 f02ba292 2019-02-05 stsp # This used to erroneously print:
77 f02ba292 2019-02-05 stsp #
78 f02ba292 2019-02-05 stsp # ! Basic/Targets.cpp
79 f02ba292 2019-02-05 stsp # ? Basic/Targets.cpp
80 f02ba292 2019-02-05 stsp (cd $testroot/wt && got status > $testroot/stdout)
81 f02ba292 2019-02-05 stsp
82 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp ret="$?"
84 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
85 f02ba292 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
86 f02ba292 2019-02-05 stsp fi
87 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
88 f02ba292 2019-02-05 stsp }
89 f02ba292 2019-02-05 stsp
90 f6cae3ed 2020-09-13 naddy test_status_subdir_no_mods2() {
91 f02ba292 2019-02-05 stsp local testroot=`test_init status_subdir_no_mods2 1`
92 f02ba292 2019-02-05 stsp
93 f02ba292 2019-02-05 stsp mkdir $testroot/repo/AST
94 f02ba292 2019-02-05 stsp touch $testroot/repo/AST/APValue.cpp
95 f02ba292 2019-02-05 stsp mkdir $testroot/repo/ASTMatchers
96 f02ba292 2019-02-05 stsp touch $testroot/repo/ASTMatchers/ASTMatchFinder.cpp
97 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Frontend
98 f02ba292 2019-02-05 stsp touch $testroot/repo/Frontend/ASTConsumers.cpp
99 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Frontend/Rewrite
100 f02ba292 2019-02-05 stsp touch $testroot/repo/Frontend/Rewrite/CMakeLists.txt
101 f02ba292 2019-02-05 stsp mkdir $testroot/repo/FrontendTool
102 f02ba292 2019-02-05 stsp touch $testroot/repo/FrontendTool/CMakeLists.txt
103 f02ba292 2019-02-05 stsp touch $testroot/repo/FrontendTool/ExecuteCompilerInvocation.cpp
104 f02ba292 2019-02-05 stsp (cd $testroot/repo && git add .)
105 f02ba292 2019-02-05 stsp git_commit $testroot/repo -m "add subdir with files"
106 f02ba292 2019-02-05 stsp
107 f02ba292 2019-02-05 stsp got checkout $testroot/repo $testroot/wt > /dev/null
108 e60e7f5b 2019-02-10 stsp ret="$?"
109 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
110 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
111 f02ba292 2019-02-05 stsp return 1
112 f02ba292 2019-02-05 stsp fi
113 f02ba292 2019-02-05 stsp
114 f02ba292 2019-02-05 stsp touch $testroot/stdout.expected
115 f02ba292 2019-02-05 stsp
116 f02ba292 2019-02-05 stsp # This used to erroneously print:
117 f02ba292 2019-02-05 stsp #
118 f02ba292 2019-02-05 stsp # ! AST/APValue.cpp
119 f02ba292 2019-02-05 stsp # ? AST/APValue.cpp
120 f02ba292 2019-02-05 stsp # ! Frontend/ASTConsumers.cpp
121 f02ba292 2019-02-05 stsp # ! Frontend/Rewrite/CMakeLists.txt
122 f02ba292 2019-02-05 stsp # ? Frontend/ASTConsumers.cpp
123 f02ba292 2019-02-05 stsp # ? Frontend/Rewrite/CMakeLists.txt
124 f02ba292 2019-02-05 stsp (cd $testroot/wt && got status > $testroot/stdout)
125 f02ba292 2019-02-05 stsp
126 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
127 e60e7f5b 2019-02-10 stsp ret="$?"
128 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
129 f02ba292 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
130 f02ba292 2019-02-05 stsp fi
131 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
132 f02ba292 2019-02-05 stsp }
133 f02ba292 2019-02-05 stsp
134 f6cae3ed 2020-09-13 naddy test_status_obstructed() {
135 0dbc2271 2019-02-05 stsp local testroot=`test_init status_obstructed`
136 0dbc2271 2019-02-05 stsp
137 0dbc2271 2019-02-05 stsp got checkout $testroot/repo $testroot/wt > /dev/null
138 e60e7f5b 2019-02-10 stsp ret="$?"
139 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
140 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
141 0dbc2271 2019-02-05 stsp return 1
142 0dbc2271 2019-02-05 stsp fi
143 0dbc2271 2019-02-05 stsp
144 0dbc2271 2019-02-05 stsp rm $testroot/wt/epsilon/zeta
145 0dbc2271 2019-02-05 stsp mkdir $testroot/wt/epsilon/zeta
146 0dbc2271 2019-02-05 stsp
147 0dbc2271 2019-02-05 stsp echo '~ epsilon/zeta' > $testroot/stdout.expected
148 0dbc2271 2019-02-05 stsp
149 0dbc2271 2019-02-05 stsp (cd $testroot/wt && got status > $testroot/stdout)
150 0dbc2271 2019-02-05 stsp
151 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
152 e60e7f5b 2019-02-10 stsp ret="$?"
153 a062651c 2019-07-27 stsp if [ "$ret" != "0" ]; then
154 0dbc2271 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
155 0dbc2271 2019-02-05 stsp fi
156 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
157 0dbc2271 2019-02-05 stsp }
158 0dbc2271 2019-02-05 stsp
159 f6cae3ed 2020-09-13 naddy test_status_shows_local_mods_after_update() {
160 02c07007 2019-02-10 stsp local testroot=`test_init status_shows_local_mods_after_update 1`
161 02c07007 2019-02-10 stsp
162 02c07007 2019-02-10 stsp echo "1" > $testroot/repo/numbers
163 02c07007 2019-02-10 stsp echo "2" >> $testroot/repo/numbers
164 02c07007 2019-02-10 stsp echo "3" >> $testroot/repo/numbers
165 02c07007 2019-02-10 stsp echo "4" >> $testroot/repo/numbers
166 02c07007 2019-02-10 stsp echo "5" >> $testroot/repo/numbers
167 02c07007 2019-02-10 stsp echo "6" >> $testroot/repo/numbers
168 02c07007 2019-02-10 stsp echo "7" >> $testroot/repo/numbers
169 02c07007 2019-02-10 stsp echo "8" >> $testroot/repo/numbers
170 02c07007 2019-02-10 stsp (cd $testroot/repo && git add numbers)
171 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "added numbers file"
172 02c07007 2019-02-10 stsp
173 02c07007 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
174 02c07007 2019-02-10 stsp ret="$?"
175 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
176 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
177 02c07007 2019-02-10 stsp return 1
178 02c07007 2019-02-10 stsp fi
179 02c07007 2019-02-10 stsp
180 c206b220 2021-10-09 thomas sed -i '' -e 's/2/22/' $testroot/repo/numbers
181 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "modified line 2"
182 02c07007 2019-02-10 stsp
183 02c07007 2019-02-10 stsp # modify line 7; both changes should merge cleanly
184 c206b220 2021-10-09 thomas sed -i '' -e 's/7/77/' $testroot/wt/numbers
185 02c07007 2019-02-10 stsp
186 02c07007 2019-02-10 stsp echo "G numbers" > $testroot/stdout.expected
187 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
188 02c07007 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
189 02c07007 2019-02-10 stsp echo >> $testroot/stdout.expected
190 02c07007 2019-02-10 stsp
191 02c07007 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
192 02c07007 2019-02-10 stsp
193 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
194 02c07007 2019-02-10 stsp ret="$?"
195 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
196 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
197 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
198 02c07007 2019-02-10 stsp return 1
199 02c07007 2019-02-10 stsp fi
200 02c07007 2019-02-10 stsp
201 02c07007 2019-02-10 stsp echo 'M numbers' > $testroot/stdout.expected
202 02c07007 2019-02-10 stsp
203 02c07007 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
204 02c07007 2019-02-10 stsp
205 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
206 02c07007 2019-02-10 stsp ret="$?"
207 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
208 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
209 02c07007 2019-02-10 stsp fi
210 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
211 02c07007 2019-02-10 stsp }
212 02c07007 2019-02-10 stsp
213 f6cae3ed 2020-09-13 naddy test_status_unversioned_subdirs() {
214 18831e78 2019-02-10 stsp local testroot=`test_init status_unversioned_subdirs 1`
215 18831e78 2019-02-10 stsp
216 18831e78 2019-02-10 stsp mkdir $testroot/repo/cdfs/
217 18831e78 2019-02-10 stsp touch $testroot/repo/cdfs/Makefile
218 18831e78 2019-02-10 stsp mkdir $testroot/repo/common/
219 18831e78 2019-02-10 stsp touch $testroot/repo/common/Makefile
220 18831e78 2019-02-10 stsp mkdir $testroot/repo/iso/
221 18831e78 2019-02-10 stsp touch $testroot/repo/iso/Makefile
222 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
223 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
224 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/list.local
225 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk_cd/
226 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/Makefile
227 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/list.local
228 18831e78 2019-02-10 stsp (cd $testroot/repo && git add .)
229 18831e78 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
230 18831e78 2019-02-10 stsp
231 18831e78 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
232 18831e78 2019-02-10 stsp ret="$?"
233 18831e78 2019-02-10 stsp if [ "$ret" != "0" ]; then
234 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
235 18831e78 2019-02-10 stsp return 1
236 18831e78 2019-02-10 stsp fi
237 18831e78 2019-02-10 stsp
238 18831e78 2019-02-10 stsp mkdir $testroot/wt/cdfs/obj
239 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk/obj
240 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk_cd/obj
241 18831e78 2019-02-10 stsp mkdir $testroot/wt/iso/obj
242 18831e78 2019-02-10 stsp
243 18831e78 2019-02-10 stsp echo -n > $testroot/stdout.expected
244 18831e78 2019-02-10 stsp
245 18831e78 2019-02-10 stsp # This used to erroneously print:
246 18831e78 2019-02-10 stsp #
247 18831e78 2019-02-10 stsp # ! ramdisk_cd/Makefile
248 18831e78 2019-02-10 stsp # ! ramdisk_cd/list.local
249 18831e78 2019-02-10 stsp # ? ramdisk_cd/Makefile
250 18831e78 2019-02-10 stsp # ? ramdisk_cd/list.local
251 18831e78 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
252 18831e78 2019-02-10 stsp
253 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
254 18831e78 2019-02-10 stsp ret="$?"
255 18831e78 2019-02-10 stsp if [ "$ret" != "0" ]; then
256 18831e78 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
257 18831e78 2019-02-10 stsp fi
258 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
259 18831e78 2019-02-10 stsp }
260 18831e78 2019-02-10 stsp
261 f6cae3ed 2020-09-13 naddy test_status_symlink() {
262 00bb5ea0 2020-07-23 stsp local testroot=`test_init status_symlink`
263 2c201a36 2019-02-10 stsp
264 2c201a36 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
265 2c201a36 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
266 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
267 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
268 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
269 2c201a36 2019-02-10 stsp (cd $testroot/repo && git add .)
270 2c201a36 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
271 2c201a36 2019-02-10 stsp
272 2c201a36 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
273 2c201a36 2019-02-10 stsp ret="$?"
274 2c201a36 2019-02-10 stsp if [ "$ret" != "0" ]; then
275 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
276 2c201a36 2019-02-10 stsp return 1
277 2c201a36 2019-02-10 stsp fi
278 2c201a36 2019-02-10 stsp
279 2c201a36 2019-02-10 stsp ln -s /usr/obj/distrib/i386/ramdisk $testroot/wt/ramdisk/obj
280 3cbbd752 2019-02-19 stsp
281 00bb5ea0 2020-07-23 stsp echo "? ramdisk/obj" > $testroot/stdout.expected
282 00bb5ea0 2020-07-23 stsp
283 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
284 00bb5ea0 2020-07-23 stsp
285 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
286 00bb5ea0 2020-07-23 stsp ret="$?"
287 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
288 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
289 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
290 00bb5ea0 2020-07-23 stsp return 1
291 00bb5ea0 2020-07-23 stsp fi
292 00bb5ea0 2020-07-23 stsp
293 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
294 dd6165e4 2021-09-21 thomas.ad (cd $testroot/wt && ln -sfT gamma epsilon.link)
295 d4ae64fa 2020-07-23 stsp
296 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s /etc/passwd passwd.link)
297 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s ../beta epsilon/beta.link)
298 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && got add passwd.link epsilon/beta.link > /dev/null)
299 00bb5ea0 2020-07-23 stsp
300 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
301 d4ae64fa 2020-07-23 stsp
302 d4ae64fa 2020-07-23 stsp echo 'M alpha.link' > $testroot/stdout.expected
303 00bb5ea0 2020-07-23 stsp echo 'A epsilon/beta.link' >> $testroot/stdout.expected
304 d4ae64fa 2020-07-23 stsp echo 'M epsilon.link' >> $testroot/stdout.expected
305 d4ae64fa 2020-07-23 stsp echo 'D nonexistent.link' >> $testroot/stdout.expected
306 00bb5ea0 2020-07-23 stsp echo 'A passwd.link' >> $testroot/stdout.expected
307 00bb5ea0 2020-07-23 stsp echo "? ramdisk/obj" >> $testroot/stdout.expected
308 3cbbd752 2019-02-19 stsp
309 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
310 3cbbd752 2019-02-19 stsp
311 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
312 3cbbd752 2019-02-19 stsp ret="$?"
313 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
314 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
315 3cbbd752 2019-02-19 stsp fi
316 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
317 3cbbd752 2019-02-19 stsp }
318 3cbbd752 2019-02-19 stsp
319 f6cae3ed 2020-09-13 naddy test_status_shows_no_mods_after_complete_merge() {
320 3cbbd752 2019-02-19 stsp local testroot=`test_init status_shows_no_mods_after_complete_merge 1`
321 3cbbd752 2019-02-19 stsp
322 3cbbd752 2019-02-19 stsp # make this file larger than the usual blob buffer size of 8192
323 3cbbd752 2019-02-19 stsp echo -n > $testroot/repo/numbers
324 3cbbd752 2019-02-19 stsp for i in `jot 16384`; do
325 3cbbd752 2019-02-19 stsp echo "$i" >> $testroot/repo/numbers
326 3cbbd752 2019-02-19 stsp done
327 3cbbd752 2019-02-19 stsp
328 3cbbd752 2019-02-19 stsp (cd $testroot/repo && git add numbers)
329 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "added numbers file"
330 3cbbd752 2019-02-19 stsp
331 3cbbd752 2019-02-19 stsp got checkout $testroot/repo $testroot/wt > /dev/null
332 3cbbd752 2019-02-19 stsp ret="$?"
333 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
334 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
335 3cbbd752 2019-02-19 stsp return 1
336 3cbbd752 2019-02-19 stsp fi
337 2c201a36 2019-02-10 stsp
338 c206b220 2021-10-09 thomas sed -i '' -e 's/2/22/' $testroot/repo/numbers
339 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "modified line 2"
340 3cbbd752 2019-02-19 stsp
341 3cbbd752 2019-02-19 stsp sleep 1
342 3cbbd752 2019-02-19 stsp # modify line 2 again; no local changes are left after merge
343 c206b220 2021-10-09 thomas sed -i '' -e 's/2/22/' $testroot/wt/numbers
344 3cbbd752 2019-02-19 stsp
345 3cbbd752 2019-02-19 stsp echo "G numbers" > $testroot/stdout.expected
346 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
347 3cbbd752 2019-02-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
348 3cbbd752 2019-02-19 stsp echo >> $testroot/stdout.expected
349 3cbbd752 2019-02-19 stsp
350 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
351 3cbbd752 2019-02-19 stsp
352 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
353 3cbbd752 2019-02-19 stsp ret="$?"
354 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
355 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
356 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
357 3cbbd752 2019-02-19 stsp return 1
358 3cbbd752 2019-02-19 stsp fi
359 3cbbd752 2019-02-19 stsp
360 2c201a36 2019-02-10 stsp echo -n > $testroot/stdout.expected
361 2c201a36 2019-02-10 stsp
362 2c201a36 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
363 2c201a36 2019-02-10 stsp
364 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
365 2c201a36 2019-02-10 stsp ret="$?"
366 2c201a36 2019-02-10 stsp if [ "$ret" != "0" ]; then
367 2c201a36 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
368 2c201a36 2019-02-10 stsp fi
369 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
370 2c201a36 2019-02-10 stsp }
371 7154f6ce 2019-03-27 stsp
372 f6cae3ed 2020-09-13 naddy test_status_shows_conflict() {
373 7154f6ce 2019-03-27 stsp local testroot=`test_init status_shows_conflict 1`
374 2c201a36 2019-02-10 stsp
375 7154f6ce 2019-03-27 stsp echo "1" > $testroot/repo/numbers
376 7154f6ce 2019-03-27 stsp echo "2" >> $testroot/repo/numbers
377 7154f6ce 2019-03-27 stsp echo "3" >> $testroot/repo/numbers
378 7154f6ce 2019-03-27 stsp echo "4" >> $testroot/repo/numbers
379 7154f6ce 2019-03-27 stsp echo "5" >> $testroot/repo/numbers
380 7154f6ce 2019-03-27 stsp echo "6" >> $testroot/repo/numbers
381 7154f6ce 2019-03-27 stsp echo "7" >> $testroot/repo/numbers
382 7154f6ce 2019-03-27 stsp echo "8" >> $testroot/repo/numbers
383 7154f6ce 2019-03-27 stsp (cd $testroot/repo && git add numbers)
384 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "added numbers file"
385 7154f6ce 2019-03-27 stsp
386 7154f6ce 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
387 7154f6ce 2019-03-27 stsp ret="$?"
388 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
389 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
390 7154f6ce 2019-03-27 stsp return 1
391 7154f6ce 2019-03-27 stsp fi
392 7154f6ce 2019-03-27 stsp
393 c206b220 2021-10-09 thomas sed -i '' -e 's/2/22/' $testroot/repo/numbers
394 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "modified line 2"
395 7154f6ce 2019-03-27 stsp
396 7154f6ce 2019-03-27 stsp # modify line 2 in a conflicting way
397 c206b220 2021-10-09 thomas sed -i '' -e 's/2/77/' $testroot/wt/numbers
398 7154f6ce 2019-03-27 stsp
399 7154f6ce 2019-03-27 stsp echo "C numbers" > $testroot/stdout.expected
400 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
401 7154f6ce 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
402 7154f6ce 2019-03-27 stsp echo >> $testroot/stdout.expected
403 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
404 7154f6ce 2019-03-27 stsp
405 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
406 7154f6ce 2019-03-27 stsp
407 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
408 7154f6ce 2019-03-27 stsp ret="$?"
409 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
410 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
411 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
412 7154f6ce 2019-03-27 stsp return 1
413 7154f6ce 2019-03-27 stsp fi
414 7154f6ce 2019-03-27 stsp
415 7154f6ce 2019-03-27 stsp echo 'C numbers' > $testroot/stdout.expected
416 7154f6ce 2019-03-27 stsp
417 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
418 c577a9ce 2019-07-27 stsp
419 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
420 c577a9ce 2019-07-27 stsp ret="$?"
421 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
422 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
423 c577a9ce 2019-07-27 stsp fi
424 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
425 c577a9ce 2019-07-27 stsp }
426 c577a9ce 2019-07-27 stsp
427 f6cae3ed 2020-09-13 naddy test_status_empty_dir() {
428 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir`
429 c577a9ce 2019-07-27 stsp
430 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
431 c577a9ce 2019-07-27 stsp ret="$?"
432 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
433 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
434 c577a9ce 2019-07-27 stsp return 1
435 c577a9ce 2019-07-27 stsp fi
436 c577a9ce 2019-07-27 stsp
437 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
438 c577a9ce 2019-07-27 stsp
439 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
440 c577a9ce 2019-07-27 stsp
441 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
442 c577a9ce 2019-07-27 stsp
443 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
444 c577a9ce 2019-07-27 stsp ret="$?"
445 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
446 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
447 c577a9ce 2019-07-27 stsp fi
448 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
449 c577a9ce 2019-07-27 stsp }
450 7154f6ce 2019-03-27 stsp
451 f6cae3ed 2020-09-13 naddy test_status_empty_dir_unversioned_file() {
452 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir_unversioned_file`
453 c577a9ce 2019-07-27 stsp
454 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
455 c577a9ce 2019-07-27 stsp ret="$?"
456 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
457 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
458 c577a9ce 2019-07-27 stsp return 1
459 c577a9ce 2019-07-27 stsp fi
460 c577a9ce 2019-07-27 stsp
461 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
462 c577a9ce 2019-07-27 stsp touch $testroot/wt/epsilon/unversioned
463 c577a9ce 2019-07-27 stsp
464 c577a9ce 2019-07-27 stsp echo '? epsilon/unversioned' > $testroot/stdout.expected
465 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' >> $testroot/stdout.expected
466 c577a9ce 2019-07-27 stsp
467 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
468 c577a9ce 2019-07-27 stsp
469 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
470 7154f6ce 2019-03-27 stsp ret="$?"
471 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
472 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
473 7154f6ce 2019-03-27 stsp fi
474 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
475 7154f6ce 2019-03-27 stsp }
476 72ea6654 2019-07-27 stsp
477 f6cae3ed 2020-09-13 naddy test_status_many_paths() {
478 72ea6654 2019-07-27 stsp local testroot=`test_init status_many_paths`
479 7154f6ce 2019-03-27 stsp
480 72ea6654 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
481 72ea6654 2019-07-27 stsp ret="$?"
482 72ea6654 2019-07-27 stsp if [ "$ret" != "0" ]; then
483 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
484 72ea6654 2019-07-27 stsp return 1
485 72ea6654 2019-07-27 stsp fi
486 72ea6654 2019-07-27 stsp
487 72ea6654 2019-07-27 stsp echo "modified alpha" > $testroot/wt/alpha
488 72ea6654 2019-07-27 stsp (cd $testroot/wt && got rm beta >/dev/null)
489 72ea6654 2019-07-27 stsp echo "unversioned file" > $testroot/wt/foo
490 72ea6654 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
491 72ea6654 2019-07-27 stsp touch $testroot/wt/beta
492 72ea6654 2019-07-27 stsp echo "new file" > $testroot/wt/new
493 72ea6654 2019-07-27 stsp mkdir $testroot/wt/newdir
494 72ea6654 2019-07-27 stsp (cd $testroot/wt && got add new >/dev/null)
495 72ea6654 2019-07-27 stsp
496 f1417e9f 2021-10-12 thomas (cd $testroot/wt && got status alpha > $testroot/stdout.expected)
497 f1417e9f 2021-10-12 thomas (cd $testroot/wt && got status beta >> $testroot/stdout.expected)
498 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status epsilon >> $testroot/stdout.expected)
499 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status foo >> $testroot/stdout.expected)
500 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status new >> $testroot/stdout.expected)
501 f1417e9f 2021-10-12 thomas (cd $testroot/wt && got status newdir >> $testroot/stdout.expected)
502 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status . >> $testroot/stdout.expected)
503 72ea6654 2019-07-27 stsp
504 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status newdir alpha epsilon foo new beta . \
505 72ea6654 2019-07-27 stsp > $testroot/stdout)
506 6841da00 2019-08-08 stsp
507 6841da00 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
508 6841da00 2019-08-08 stsp ret="$?"
509 6841da00 2019-08-08 stsp if [ "$ret" != "0" ]; then
510 6841da00 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
511 6841da00 2019-08-08 stsp fi
512 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
513 6841da00 2019-08-08 stsp }
514 6841da00 2019-08-08 stsp
515 f6cae3ed 2020-09-13 naddy test_status_cvsignore() {
516 6841da00 2019-08-08 stsp local testroot=`test_init status_cvsignore`
517 6841da00 2019-08-08 stsp
518 6841da00 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
519 6841da00 2019-08-08 stsp ret="$?"
520 6841da00 2019-08-08 stsp if [ "$ret" != "0" ]; then
521 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
522 6841da00 2019-08-08 stsp return 1
523 6841da00 2019-08-08 stsp fi
524 72ea6654 2019-07-27 stsp
525 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foo
526 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foop
527 3143d852 2020-06-25 stsp echo "unversioned file" > $testroot/wt/epsilon/foo
528 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
529 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
530 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
531 3143d852 2020-06-25 stsp mkdir -p $testroot/wt/epsilon/new/
532 3143d852 2020-06-25 stsp echo "unversioned file" > $testroot/wt/epsilon/new/foo
533 3143d852 2020-06-25 stsp echo "**/foo" > $testroot/wt/.cvsignore
534 8528beef 2021-10-15 thomas echo "**/gamma" >> $testroot/wt/.cvsignore
535 6841da00 2019-08-08 stsp echo "bar" > $testroot/wt/epsilon/.cvsignore
536 6841da00 2019-08-08 stsp echo "moo" >> $testroot/wt/epsilon/.cvsignore
537 6841da00 2019-08-08 stsp
538 6841da00 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
539 6841da00 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
540 6841da00 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
541 6841da00 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
542 6841da00 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
543 3143d852 2020-06-25 stsp
544 3143d852 2020-06-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
545 3143d852 2020-06-25 stsp ret="$?"
546 3143d852 2020-06-25 stsp if [ "$ret" != "0" ]; then
547 3143d852 2020-06-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
548 3143d852 2020-06-25 stsp test_done "$testroot" "$ret"
549 3143d852 2020-06-25 stsp return 1
550 3143d852 2020-06-25 stsp fi
551 3143d852 2020-06-25 stsp
552 3143d852 2020-06-25 stsp echo '? epsilon/.cvsignore' > $testroot/stdout.expected
553 3143d852 2020-06-25 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
554 3143d852 2020-06-25 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
555 b80270a7 2019-08-08 stsp
556 b80270a7 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
557 b80270a7 2019-08-08 stsp ret="$?"
558 b80270a7 2019-08-08 stsp if [ "$ret" != "0" ]; then
559 b80270a7 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
560 b80270a7 2019-08-08 stsp test_done "$testroot" "$ret"
561 b80270a7 2019-08-08 stsp return 1
562 b80270a7 2019-08-08 stsp fi
563 3143d852 2020-06-25 stsp
564 3143d852 2020-06-25 stsp echo -n '' > $testroot/stdout.expected
565 3143d852 2020-06-25 stsp (cd $testroot/wt && got status epsilon/new > $testroot/stdout)
566 6841da00 2019-08-08 stsp
567 3143d852 2020-06-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
568 3143d852 2020-06-25 stsp ret="$?"
569 3143d852 2020-06-25 stsp if [ "$ret" != "0" ]; then
570 3143d852 2020-06-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
571 3143d852 2020-06-25 stsp test_done "$testroot" "$ret"
572 3143d852 2020-06-25 stsp return 1
573 3143d852 2020-06-25 stsp fi
574 3143d852 2020-06-25 stsp
575 b80270a7 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
576 b80270a7 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
577 b80270a7 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
578 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
579 bd8de430 2019-10-04 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
580 f6343036 2021-06-22 stsp
581 f6343036 2021-06-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
582 f6343036 2021-06-22 stsp ret="$?"
583 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
584 f6343036 2021-06-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
585 f6343036 2021-06-22 stsp test_done "$testroot" "$ret"
586 f6343036 2021-06-22 stsp return 1
587 f6343036 2021-06-22 stsp fi
588 f6343036 2021-06-22 stsp
589 f6343036 2021-06-22 stsp cat > $testroot/stdout.expected <<EOF
590 f6343036 2021-06-22 stsp ? .cvsignore
591 f6343036 2021-06-22 stsp ? epsilon/.cvsignore
592 f6343036 2021-06-22 stsp ? epsilon/bar
593 f6343036 2021-06-22 stsp ? epsilon/boo
594 f6343036 2021-06-22 stsp ? epsilon/foo
595 f6343036 2021-06-22 stsp ? epsilon/moo
596 f6343036 2021-06-22 stsp ? epsilon/new/foo
597 f6343036 2021-06-22 stsp ? foo
598 f6343036 2021-06-22 stsp ? foop
599 f6343036 2021-06-22 stsp EOF
600 f6343036 2021-06-22 stsp (cd $testroot/wt && got status -I > $testroot/stdout)
601 f6343036 2021-06-22 stsp ret="$?"
602 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
603 f6343036 2021-06-22 stsp echo "got status failed unexpectedly" >&2
604 f6343036 2021-06-22 stsp test_done "$testroot" "1"
605 f6343036 2021-06-22 stsp return 1
606 f6343036 2021-06-22 stsp fi
607 bd8de430 2019-10-04 stsp
608 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
609 bd8de430 2019-10-04 stsp ret="$?"
610 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
611 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
612 bd8de430 2019-10-04 stsp fi
613 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
614 bd8de430 2019-10-04 stsp }
615 bd8de430 2019-10-04 stsp
616 f6cae3ed 2020-09-13 naddy test_status_gitignore() {
617 bd8de430 2019-10-04 stsp local testroot=`test_init status_gitignore`
618 bd8de430 2019-10-04 stsp
619 bd8de430 2019-10-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
620 bd8de430 2019-10-04 stsp ret="$?"
621 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
622 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
623 bd8de430 2019-10-04 stsp return 1
624 bd8de430 2019-10-04 stsp fi
625 bd8de430 2019-10-04 stsp
626 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foo
627 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foop
628 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/barp
629 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
630 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
631 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
632 bd8de430 2019-10-04 stsp mkdir -p $testroot/wt/a/b/c/
633 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/foo
634 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/zoo
635 bd8de430 2019-10-04 stsp echo "foo" > $testroot/wt/.gitignore
636 bd8de430 2019-10-04 stsp echo "bar*" >> $testroot/wt/.gitignore
637 bd8de430 2019-10-04 stsp echo "epsilon/**" >> $testroot/wt/.gitignore
638 bd8de430 2019-10-04 stsp echo "a/**/foo" >> $testroot/wt/.gitignore
639 bd8de430 2019-10-04 stsp echo "**/zoo" >> $testroot/wt/.gitignore
640 bd8de430 2019-10-04 stsp
641 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
642 b80270a7 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
643 bd8de430 2019-10-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
644 bd8de430 2019-10-04 stsp
645 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
646 bd8de430 2019-10-04 stsp ret="$?"
647 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
648 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
649 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
650 bd8de430 2019-10-04 stsp return 1
651 bd8de430 2019-10-04 stsp fi
652 bd8de430 2019-10-04 stsp
653 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
654 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
655 b80270a7 2019-08-08 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
656 b80270a7 2019-08-08 stsp
657 72ea6654 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
658 72ea6654 2019-07-27 stsp ret="$?"
659 72ea6654 2019-07-27 stsp if [ "$ret" != "0" ]; then
660 72ea6654 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
661 f6343036 2021-06-22 stsp test_done "$testroot" "$ret"
662 f6343036 2021-06-22 stsp return 1
663 72ea6654 2019-07-27 stsp fi
664 f6343036 2021-06-22 stsp
665 f6343036 2021-06-22 stsp cat > $testroot/stdout.expected <<EOF
666 f6343036 2021-06-22 stsp ? .gitignore
667 f6343036 2021-06-22 stsp ? a/b/c/foo
668 f6343036 2021-06-22 stsp ? a/b/c/zoo
669 f6343036 2021-06-22 stsp ? barp
670 f6343036 2021-06-22 stsp ? epsilon/bar
671 f6343036 2021-06-22 stsp ? epsilon/boo
672 f6343036 2021-06-22 stsp ? epsilon/moo
673 f6343036 2021-06-22 stsp ? foo
674 f6343036 2021-06-22 stsp ? foop
675 f6343036 2021-06-22 stsp EOF
676 f6343036 2021-06-22 stsp (cd $testroot/wt && got status -I > $testroot/stdout)
677 f6343036 2021-06-22 stsp ret="$?"
678 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
679 f6343036 2021-06-22 stsp echo "got status failed unexpectedly" >&2
680 f6343036 2021-06-22 stsp test_done "$testroot" "1"
681 f6343036 2021-06-22 stsp return 1
682 f6343036 2021-06-22 stsp fi
683 f6343036 2021-06-22 stsp
684 f6343036 2021-06-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
685 f6343036 2021-06-22 stsp ret="$?"
686 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
687 f6343036 2021-06-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
688 f6343036 2021-06-22 stsp fi
689 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
690 72ea6654 2019-07-27 stsp }
691 081470ac 2020-08-13 stsp
692 f6cae3ed 2020-09-13 naddy test_status_status_code() {
693 081470ac 2020-08-13 stsp local testroot=`test_init status_status_code`
694 081470ac 2020-08-13 stsp
695 081470ac 2020-08-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
696 081470ac 2020-08-13 stsp ret="$?"
697 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
698 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
699 081470ac 2020-08-13 stsp return 1
700 081470ac 2020-08-13 stsp fi
701 081470ac 2020-08-13 stsp
702 081470ac 2020-08-13 stsp echo "modified alpha" > $testroot/wt/alpha
703 081470ac 2020-08-13 stsp (cd $testroot/wt && got rm beta >/dev/null)
704 081470ac 2020-08-13 stsp echo "unversioned file" > $testroot/wt/foo
705 081470ac 2020-08-13 stsp rm $testroot/wt/epsilon/zeta
706 081470ac 2020-08-13 stsp touch $testroot/wt/beta
707 081470ac 2020-08-13 stsp echo "new file" > $testroot/wt/new
708 081470ac 2020-08-13 stsp (cd $testroot/wt && got add new >/dev/null)
709 081470ac 2020-08-13 stsp
710 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s xDM \
711 081470ac 2020-08-13 stsp > $testroot/stdout 2> $testroot/stderr)
712 081470ac 2020-08-13 stsp ret="$?"
713 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
714 081470ac 2020-08-13 stsp echo "status succeeded unexpectedly" >&2
715 081470ac 2020-08-13 stsp test_done "$testroot" "1"
716 081470ac 2020-08-13 stsp return 1
717 081470ac 2020-08-13 stsp fi
718 081470ac 2020-08-13 stsp
719 081470ac 2020-08-13 stsp echo "got: invalid status code 'x'" > $testroot/stderr.expected
720 081470ac 2020-08-13 stsp cmp -s $testroot/stderr.expected $testroot/stderr
721 081470ac 2020-08-13 stsp ret="$?"
722 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
723 081470ac 2020-08-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
724 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
725 081470ac 2020-08-13 stsp return 1
726 081470ac 2020-08-13 stsp fi
727 72ea6654 2019-07-27 stsp
728 081470ac 2020-08-13 stsp echo 'M alpha' > $testroot/stdout.expected
729 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s M > $testroot/stdout)
730 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
731 081470ac 2020-08-13 stsp ret="$?"
732 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
733 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
734 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
735 081470ac 2020-08-13 stsp return 1
736 081470ac 2020-08-13 stsp fi
737 081470ac 2020-08-13 stsp
738 081470ac 2020-08-13 stsp echo 'D beta' > $testroot/stdout.expected
739 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s D > $testroot/stdout)
740 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
741 081470ac 2020-08-13 stsp ret="$?"
742 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
743 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
744 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
745 081470ac 2020-08-13 stsp return 1
746 081470ac 2020-08-13 stsp fi
747 081470ac 2020-08-13 stsp
748 081470ac 2020-08-13 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
749 081470ac 2020-08-13 stsp echo '? foo' >> $testroot/stdout.expected
750 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -s !\? > $testroot/stdout)
751 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
752 081470ac 2020-08-13 stsp ret="$?"
753 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
754 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
755 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
756 081470ac 2020-08-13 stsp return 1
757 081470ac 2020-08-13 stsp fi
758 081470ac 2020-08-13 stsp
759 081470ac 2020-08-13 stsp echo 'A new' > $testroot/stdout.expected
760 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
761 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
762 081470ac 2020-08-13 stsp ret="$?"
763 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
764 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
765 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
766 081470ac 2020-08-13 stsp return 1
767 081470ac 2020-08-13 stsp fi
768 081470ac 2020-08-13 stsp
769 081470ac 2020-08-13 stsp (cd $testroot/wt && got stage new > $testroot/stdout)
770 081470ac 2020-08-13 stsp
771 081470ac 2020-08-13 stsp echo ' A new' > $testroot/stdout.expected
772 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
773 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
774 081470ac 2020-08-13 stsp ret="$?"
775 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
776 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
777 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
778 081470ac 2020-08-13 stsp return 1
779 081470ac 2020-08-13 stsp fi
780 081470ac 2020-08-13 stsp
781 081470ac 2020-08-13 stsp echo 'changed file new' > $testroot/wt/new
782 081470ac 2020-08-13 stsp
783 081470ac 2020-08-13 stsp echo 'MA new' > $testroot/stdout.expected
784 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
785 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
786 081470ac 2020-08-13 stsp ret="$?"
787 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
788 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
789 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
790 081470ac 2020-08-13 stsp return 1
791 081470ac 2020-08-13 stsp fi
792 081470ac 2020-08-13 stsp
793 081470ac 2020-08-13 stsp echo 'M alpha' > $testroot/stdout.expected
794 081470ac 2020-08-13 stsp echo 'MA new' >> $testroot/stdout.expected
795 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s M > $testroot/stdout)
796 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
797 67c65ed7 2021-09-14 tracey ret="$?"
798 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
799 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
800 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
801 67c65ed7 2021-09-14 tracey return 1
802 67c65ed7 2021-09-14 tracey fi
803 67c65ed7 2021-09-14 tracey
804 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
805 67c65ed7 2021-09-14 tracey }
806 67c65ed7 2021-09-14 tracey
807 67c65ed7 2021-09-14 tracey test_status_suppress() {
808 67c65ed7 2021-09-14 tracey local testroot=`test_init status_suppress`
809 67c65ed7 2021-09-14 tracey
810 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
811 67c65ed7 2021-09-14 tracey ret="$?"
812 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
813 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
814 67c65ed7 2021-09-14 tracey return 1
815 67c65ed7 2021-09-14 tracey fi
816 67c65ed7 2021-09-14 tracey
817 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/wt/alpha
818 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got rm beta >/dev/null)
819 67c65ed7 2021-09-14 tracey echo "unversioned file" > $testroot/wt/foo
820 67c65ed7 2021-09-14 tracey rm $testroot/wt/epsilon/zeta
821 67c65ed7 2021-09-14 tracey touch $testroot/wt/beta
822 67c65ed7 2021-09-14 tracey echo "new file" > $testroot/wt/new
823 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got add new >/dev/null)
824 e3a46353 2021-09-14 stsp
825 e3a46353 2021-09-14 stsp (cd $testroot/wt && got status -S A -s M \
826 e3a46353 2021-09-14 stsp > $testroot/stdout 2> $testroot/stderr)
827 e3a46353 2021-09-14 stsp ret="$?"
828 e3a46353 2021-09-14 stsp if [ "$ret" = "0" ]; then
829 e3a46353 2021-09-14 stsp echo "status succeeded unexpectedly" >&2
830 e3a46353 2021-09-14 stsp test_done "$testroot" "1"
831 e3a46353 2021-09-14 stsp return 1
832 e3a46353 2021-09-14 stsp fi
833 e3a46353 2021-09-14 stsp
834 e3a46353 2021-09-14 stsp echo "got: -s and -S options are mutually exclusive" \
835 e3a46353 2021-09-14 stsp > $testroot/stderr.expected
836 e3a46353 2021-09-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
837 e3a46353 2021-09-14 stsp ret="$?"
838 e3a46353 2021-09-14 stsp if [ "$ret" != "0" ]; then
839 e3a46353 2021-09-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
840 e3a46353 2021-09-14 stsp test_done "$testroot" "$ret"
841 e3a46353 2021-09-14 stsp return 1
842 e3a46353 2021-09-14 stsp fi
843 e3a46353 2021-09-14 stsp
844 e3a46353 2021-09-14 stsp (cd $testroot/wt && got status -s A -S M \
845 e3a46353 2021-09-14 stsp > $testroot/stdout 2> $testroot/stderr)
846 e3a46353 2021-09-14 stsp ret="$?"
847 e3a46353 2021-09-14 stsp if [ "$ret" = "0" ]; then
848 e3a46353 2021-09-14 stsp echo "status succeeded unexpectedly" >&2
849 e3a46353 2021-09-14 stsp test_done "$testroot" "1"
850 e3a46353 2021-09-14 stsp return 1
851 e3a46353 2021-09-14 stsp fi
852 67c65ed7 2021-09-14 tracey
853 e3a46353 2021-09-14 stsp echo "got: -S and -s options are mutually exclusive" \
854 e3a46353 2021-09-14 stsp > $testroot/stderr.expected
855 e3a46353 2021-09-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
856 e3a46353 2021-09-14 stsp ret="$?"
857 e3a46353 2021-09-14 stsp if [ "$ret" != "0" ]; then
858 e3a46353 2021-09-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
859 e3a46353 2021-09-14 stsp test_done "$testroot" "$ret"
860 e3a46353 2021-09-14 stsp return 1
861 e3a46353 2021-09-14 stsp fi
862 e3a46353 2021-09-14 stsp
863 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got status -S xDM \
864 67c65ed7 2021-09-14 tracey > $testroot/stdout 2> $testroot/stderr)
865 67c65ed7 2021-09-14 tracey ret="$?"
866 67c65ed7 2021-09-14 tracey if [ "$ret" = "0" ]; then
867 67c65ed7 2021-09-14 tracey echo "status succeeded unexpectedly" >&2
868 67c65ed7 2021-09-14 tracey test_done "$testroot" "1"
869 67c65ed7 2021-09-14 tracey return 1
870 67c65ed7 2021-09-14 tracey fi
871 67c65ed7 2021-09-14 tracey
872 67c65ed7 2021-09-14 tracey echo "got: invalid status code 'x'" > $testroot/stderr.expected
873 67c65ed7 2021-09-14 tracey cmp -s $testroot/stderr.expected $testroot/stderr
874 67c65ed7 2021-09-14 tracey ret="$?"
875 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
876 67c65ed7 2021-09-14 tracey diff -u $testroot/stderr.expected $testroot/stderr
877 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
878 67c65ed7 2021-09-14 tracey return 1
879 67c65ed7 2021-09-14 tracey fi
880 67c65ed7 2021-09-14 tracey
881 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
882 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S D\?A! > $testroot/stdout)
883 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
884 67c65ed7 2021-09-14 tracey ret="$?"
885 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
886 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
887 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
888 67c65ed7 2021-09-14 tracey return 1
889 67c65ed7 2021-09-14 tracey fi
890 67c65ed7 2021-09-14 tracey
891 67c65ed7 2021-09-14 tracey echo 'D beta' > $testroot/stdout.expected
892 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S M\?A! > $testroot/stdout)
893 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
894 67c65ed7 2021-09-14 tracey ret="$?"
895 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
896 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
897 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
898 67c65ed7 2021-09-14 tracey return 1
899 67c65ed7 2021-09-14 tracey fi
900 67c65ed7 2021-09-14 tracey
901 67c65ed7 2021-09-14 tracey echo '! epsilon/zeta' > $testroot/stdout.expected
902 67c65ed7 2021-09-14 tracey echo '? foo' >> $testroot/stdout.expected
903 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got status -S MDA > $testroot/stdout)
904 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
905 081470ac 2020-08-13 stsp ret="$?"
906 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
907 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
908 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
909 081470ac 2020-08-13 stsp return 1
910 081470ac 2020-08-13 stsp fi
911 081470ac 2020-08-13 stsp
912 67c65ed7 2021-09-14 tracey echo 'A new' > $testroot/stdout.expected
913 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
914 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
915 67c65ed7 2021-09-14 tracey ret="$?"
916 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
917 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
918 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
919 67c65ed7 2021-09-14 tracey return 1
920 67c65ed7 2021-09-14 tracey fi
921 67c65ed7 2021-09-14 tracey
922 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got stage new > $testroot/stdout)
923 67c65ed7 2021-09-14 tracey
924 67c65ed7 2021-09-14 tracey echo ' A new' > $testroot/stdout.expected
925 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
926 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
927 67c65ed7 2021-09-14 tracey ret="$?"
928 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
929 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
930 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
931 67c65ed7 2021-09-14 tracey return 1
932 67c65ed7 2021-09-14 tracey fi
933 67c65ed7 2021-09-14 tracey
934 67c65ed7 2021-09-14 tracey echo 'changed file new' > $testroot/wt/new
935 67c65ed7 2021-09-14 tracey
936 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
937 67c65ed7 2021-09-14 tracey echo 'MA new' >> $testroot/stdout.expected
938 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S D\?! > $testroot/stdout)
939 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
940 67c65ed7 2021-09-14 tracey ret="$?"
941 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
942 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
943 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
944 67c65ed7 2021-09-14 tracey return 1
945 67c65ed7 2021-09-14 tracey fi
946 67c65ed7 2021-09-14 tracey
947 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
948 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S AD\?! > $testroot/stdout)
949 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
950 67c65ed7 2021-09-14 tracey ret="$?"
951 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
952 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
953 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
954 67c65ed7 2021-09-14 tracey return 1
955 67c65ed7 2021-09-14 tracey fi
956 67c65ed7 2021-09-14 tracey
957 67c65ed7 2021-09-14 tracey rm $testroot/stdout.expected
958 67c65ed7 2021-09-14 tracey touch $testroot/stdout.expected
959 67c65ed7 2021-09-14 tracey
960 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
961 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
962 67c65ed7 2021-09-14 tracey ret="$?"
963 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
964 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
965 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
966 67c65ed7 2021-09-14 tracey return 1
967 67c65ed7 2021-09-14 tracey fi
968 67c65ed7 2021-09-14 tracey
969 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
970 081470ac 2020-08-13 stsp }
971 4a26d3f8 2020-10-07 stsp
972 4a26d3f8 2020-10-07 stsp test_status_empty_file() {
973 4a26d3f8 2020-10-07 stsp local testroot=`test_init status_empty_file`
974 4a26d3f8 2020-10-07 stsp
975 4a26d3f8 2020-10-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
976 4a26d3f8 2020-10-07 stsp ret="$?"
977 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
978 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
979 4a26d3f8 2020-10-07 stsp return 1
980 4a26d3f8 2020-10-07 stsp fi
981 4a26d3f8 2020-10-07 stsp
982 4a26d3f8 2020-10-07 stsp echo -n "" > $testroot/wt/empty
983 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got add empty >/dev/null)
984 4a26d3f8 2020-10-07 stsp
985 4a26d3f8 2020-10-07 stsp echo 'A empty' > $testroot/stdout.expected
986 4a26d3f8 2020-10-07 stsp
987 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
988 4a26d3f8 2020-10-07 stsp
989 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
990 4a26d3f8 2020-10-07 stsp ret="$?"
991 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
992 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
993 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
994 4a26d3f8 2020-10-07 stsp return 1
995 4a26d3f8 2020-10-07 stsp fi
996 4a26d3f8 2020-10-07 stsp
997 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got commit -m "empty file" >/dev/null)
998 4a26d3f8 2020-10-07 stsp
999 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1000 081470ac 2020-08-13 stsp
1001 4a26d3f8 2020-10-07 stsp echo -n > $testroot/stdout.expected
1002 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1003 4a26d3f8 2020-10-07 stsp ret="$?"
1004 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
1005 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1006 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1007 4a26d3f8 2020-10-07 stsp return 1
1008 4a26d3f8 2020-10-07 stsp fi
1009 081470ac 2020-08-13 stsp
1010 4a26d3f8 2020-10-07 stsp # update the timestamp; this used to make the file show up as:
1011 4a26d3f8 2020-10-07 stsp # M empty
1012 4a26d3f8 2020-10-07 stsp # which should not happen
1013 4a26d3f8 2020-10-07 stsp touch $testroot/wt/empty
1014 4a26d3f8 2020-10-07 stsp
1015 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1016 4a26d3f8 2020-10-07 stsp
1017 4a26d3f8 2020-10-07 stsp echo -n > $testroot/stdout.expected
1018 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1019 4a26d3f8 2020-10-07 stsp ret="$?"
1020 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
1021 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1022 4a26d3f8 2020-10-07 stsp fi
1023 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1024 4a26d3f8 2020-10-07 stsp }
1025 4a26d3f8 2020-10-07 stsp
1026 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1027 35dc4510 2019-02-04 stsp run_test test_status_basic
1028 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods
1029 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods2
1030 0dbc2271 2019-02-05 stsp run_test test_status_obstructed
1031 02c07007 2019-02-10 stsp run_test test_status_shows_local_mods_after_update
1032 18831e78 2019-02-10 stsp run_test test_status_unversioned_subdirs
1033 00bb5ea0 2020-07-23 stsp run_test test_status_symlink
1034 3cbbd752 2019-02-19 stsp run_test test_status_shows_no_mods_after_complete_merge
1035 7154f6ce 2019-03-27 stsp run_test test_status_shows_conflict
1036 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir
1037 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir_unversioned_file
1038 72ea6654 2019-07-27 stsp run_test test_status_many_paths
1039 6841da00 2019-08-08 stsp run_test test_status_cvsignore
1040 bd8de430 2019-10-04 stsp run_test test_status_gitignore
1041 081470ac 2020-08-13 stsp run_test test_status_status_code
1042 67c65ed7 2021-09-14 tracey run_test test_status_suppress
1043 4a26d3f8 2020-10-07 stsp run_test test_status_empty_file