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 49c543a6 2022-03-31 naddy ret=$?
24 49c543a6 2022-03-31 naddy if [ $ret -ne 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 49c543a6 2022-03-31 naddy ret=$?
48 49c543a6 2022-03-31 naddy if [ $ret -ne 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 49c543a6 2022-03-31 naddy ret=$?
69 49c543a6 2022-03-31 naddy if [ $ret -ne 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 49c543a6 2022-03-31 naddy ret=$?
84 49c543a6 2022-03-31 naddy if [ $ret -ne 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 49c543a6 2022-03-31 naddy ret=$?
109 49c543a6 2022-03-31 naddy if [ $ret -ne 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 49c543a6 2022-03-31 naddy ret=$?
128 49c543a6 2022-03-31 naddy if [ $ret -ne 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 49c543a6 2022-03-31 naddy ret=$?
139 49c543a6 2022-03-31 naddy if [ $ret -ne 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 a84c0d30 2022-03-12 stsp
151 a84c0d30 2022-03-12 stsp cmp -s $testroot/stdout.expected $testroot/stdout
152 49c543a6 2022-03-31 naddy ret=$?
153 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
154 a84c0d30 2022-03-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
155 a84c0d30 2022-03-12 stsp test_done "$testroot" "$ret"
156 a84c0d30 2022-03-12 stsp return 1
157 a84c0d30 2022-03-12 stsp fi
158 a84c0d30 2022-03-12 stsp
159 a84c0d30 2022-03-12 stsp (cd $testroot/wt && got status epsilon/zeta > $testroot/stdout)
160 0dbc2271 2019-02-05 stsp
161 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
162 49c543a6 2022-03-31 naddy ret=$?
163 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
164 0dbc2271 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
165 0dbc2271 2019-02-05 stsp fi
166 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
167 0dbc2271 2019-02-05 stsp }
168 0dbc2271 2019-02-05 stsp
169 f6cae3ed 2020-09-13 naddy test_status_shows_local_mods_after_update() {
170 02c07007 2019-02-10 stsp local testroot=`test_init status_shows_local_mods_after_update 1`
171 02c07007 2019-02-10 stsp
172 02c07007 2019-02-10 stsp echo "1" > $testroot/repo/numbers
173 02c07007 2019-02-10 stsp echo "2" >> $testroot/repo/numbers
174 02c07007 2019-02-10 stsp echo "3" >> $testroot/repo/numbers
175 02c07007 2019-02-10 stsp echo "4" >> $testroot/repo/numbers
176 02c07007 2019-02-10 stsp echo "5" >> $testroot/repo/numbers
177 02c07007 2019-02-10 stsp echo "6" >> $testroot/repo/numbers
178 02c07007 2019-02-10 stsp echo "7" >> $testroot/repo/numbers
179 02c07007 2019-02-10 stsp echo "8" >> $testroot/repo/numbers
180 02c07007 2019-02-10 stsp (cd $testroot/repo && git add numbers)
181 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "added numbers file"
182 02c07007 2019-02-10 stsp
183 02c07007 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
184 49c543a6 2022-03-31 naddy ret=$?
185 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
186 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
187 02c07007 2019-02-10 stsp return 1
188 02c07007 2019-02-10 stsp fi
189 02c07007 2019-02-10 stsp
190 02c07007 2019-02-10 stsp sed -i 's/2/22/' $testroot/repo/numbers
191 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "modified line 2"
192 02c07007 2019-02-10 stsp
193 02c07007 2019-02-10 stsp # modify line 7; both changes should merge cleanly
194 02c07007 2019-02-10 stsp sed -i 's/7/77/' $testroot/wt/numbers
195 02c07007 2019-02-10 stsp
196 02c07007 2019-02-10 stsp echo "G numbers" > $testroot/stdout.expected
197 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
198 02c07007 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
199 02c07007 2019-02-10 stsp echo >> $testroot/stdout.expected
200 02c07007 2019-02-10 stsp
201 02c07007 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
202 02c07007 2019-02-10 stsp
203 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
204 49c543a6 2022-03-31 naddy ret=$?
205 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
206 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
207 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
208 02c07007 2019-02-10 stsp return 1
209 02c07007 2019-02-10 stsp fi
210 02c07007 2019-02-10 stsp
211 02c07007 2019-02-10 stsp echo 'M numbers' > $testroot/stdout.expected
212 02c07007 2019-02-10 stsp
213 02c07007 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
214 02c07007 2019-02-10 stsp
215 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
216 49c543a6 2022-03-31 naddy ret=$?
217 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
218 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
219 02c07007 2019-02-10 stsp fi
220 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
221 02c07007 2019-02-10 stsp }
222 02c07007 2019-02-10 stsp
223 f6cae3ed 2020-09-13 naddy test_status_unversioned_subdirs() {
224 18831e78 2019-02-10 stsp local testroot=`test_init status_unversioned_subdirs 1`
225 18831e78 2019-02-10 stsp
226 18831e78 2019-02-10 stsp mkdir $testroot/repo/cdfs/
227 18831e78 2019-02-10 stsp touch $testroot/repo/cdfs/Makefile
228 18831e78 2019-02-10 stsp mkdir $testroot/repo/common/
229 18831e78 2019-02-10 stsp touch $testroot/repo/common/Makefile
230 18831e78 2019-02-10 stsp mkdir $testroot/repo/iso/
231 18831e78 2019-02-10 stsp touch $testroot/repo/iso/Makefile
232 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
233 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
234 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/list.local
235 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk_cd/
236 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/Makefile
237 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/list.local
238 18831e78 2019-02-10 stsp (cd $testroot/repo && git add .)
239 18831e78 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
240 18831e78 2019-02-10 stsp
241 18831e78 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
242 49c543a6 2022-03-31 naddy ret=$?
243 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
244 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
245 18831e78 2019-02-10 stsp return 1
246 18831e78 2019-02-10 stsp fi
247 18831e78 2019-02-10 stsp
248 18831e78 2019-02-10 stsp mkdir $testroot/wt/cdfs/obj
249 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk/obj
250 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk_cd/obj
251 18831e78 2019-02-10 stsp mkdir $testroot/wt/iso/obj
252 18831e78 2019-02-10 stsp
253 18831e78 2019-02-10 stsp echo -n > $testroot/stdout.expected
254 18831e78 2019-02-10 stsp
255 18831e78 2019-02-10 stsp # This used to erroneously print:
256 18831e78 2019-02-10 stsp #
257 18831e78 2019-02-10 stsp # ! ramdisk_cd/Makefile
258 18831e78 2019-02-10 stsp # ! ramdisk_cd/list.local
259 18831e78 2019-02-10 stsp # ? ramdisk_cd/Makefile
260 18831e78 2019-02-10 stsp # ? ramdisk_cd/list.local
261 18831e78 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
262 18831e78 2019-02-10 stsp
263 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
264 49c543a6 2022-03-31 naddy ret=$?
265 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
266 18831e78 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
267 18831e78 2019-02-10 stsp fi
268 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
269 18831e78 2019-02-10 stsp }
270 18831e78 2019-02-10 stsp
271 f6cae3ed 2020-09-13 naddy test_status_symlink() {
272 00bb5ea0 2020-07-23 stsp local testroot=`test_init status_symlink`
273 2c201a36 2019-02-10 stsp
274 2c201a36 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
275 2c201a36 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
276 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
277 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
278 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
279 2c201a36 2019-02-10 stsp (cd $testroot/repo && git add .)
280 2c201a36 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
281 2c201a36 2019-02-10 stsp
282 2c201a36 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
283 49c543a6 2022-03-31 naddy ret=$?
284 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
285 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
286 2c201a36 2019-02-10 stsp return 1
287 2c201a36 2019-02-10 stsp fi
288 2c201a36 2019-02-10 stsp
289 2c201a36 2019-02-10 stsp ln -s /usr/obj/distrib/i386/ramdisk $testroot/wt/ramdisk/obj
290 3cbbd752 2019-02-19 stsp
291 00bb5ea0 2020-07-23 stsp echo "? ramdisk/obj" > $testroot/stdout.expected
292 00bb5ea0 2020-07-23 stsp
293 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
294 00bb5ea0 2020-07-23 stsp
295 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
296 49c543a6 2022-03-31 naddy ret=$?
297 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
298 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
299 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
300 00bb5ea0 2020-07-23 stsp return 1
301 00bb5ea0 2020-07-23 stsp fi
302 00bb5ea0 2020-07-23 stsp
303 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
304 f55db25a 2023-03-03 naddy (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
305 d4ae64fa 2020-07-23 stsp
306 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s /etc/passwd passwd.link)
307 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s ../beta epsilon/beta.link)
308 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && got add passwd.link epsilon/beta.link > /dev/null)
309 00bb5ea0 2020-07-23 stsp
310 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
311 d4ae64fa 2020-07-23 stsp
312 d4ae64fa 2020-07-23 stsp echo 'M alpha.link' > $testroot/stdout.expected
313 00bb5ea0 2020-07-23 stsp echo 'A epsilon/beta.link' >> $testroot/stdout.expected
314 d4ae64fa 2020-07-23 stsp echo 'M epsilon.link' >> $testroot/stdout.expected
315 d4ae64fa 2020-07-23 stsp echo 'D nonexistent.link' >> $testroot/stdout.expected
316 00bb5ea0 2020-07-23 stsp echo 'A passwd.link' >> $testroot/stdout.expected
317 00bb5ea0 2020-07-23 stsp echo "? ramdisk/obj" >> $testroot/stdout.expected
318 3cbbd752 2019-02-19 stsp
319 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
320 3cbbd752 2019-02-19 stsp
321 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
322 49c543a6 2022-03-31 naddy ret=$?
323 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
324 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
325 3cbbd752 2019-02-19 stsp fi
326 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
327 3cbbd752 2019-02-19 stsp }
328 3cbbd752 2019-02-19 stsp
329 f6cae3ed 2020-09-13 naddy test_status_shows_no_mods_after_complete_merge() {
330 3cbbd752 2019-02-19 stsp local testroot=`test_init status_shows_no_mods_after_complete_merge 1`
331 3cbbd752 2019-02-19 stsp
332 3cbbd752 2019-02-19 stsp # make this file larger than the usual blob buffer size of 8192
333 c036d108 2022-04-15 op jot 16384 > $testroot/repo/numbers
334 3cbbd752 2019-02-19 stsp
335 3cbbd752 2019-02-19 stsp (cd $testroot/repo && git add numbers)
336 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "added numbers file"
337 3cbbd752 2019-02-19 stsp
338 3cbbd752 2019-02-19 stsp got checkout $testroot/repo $testroot/wt > /dev/null
339 49c543a6 2022-03-31 naddy ret=$?
340 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
341 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
342 3cbbd752 2019-02-19 stsp return 1
343 3cbbd752 2019-02-19 stsp fi
344 2c201a36 2019-02-10 stsp
345 3cbbd752 2019-02-19 stsp sed -i 's/2/22/' $testroot/repo/numbers
346 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "modified line 2"
347 3cbbd752 2019-02-19 stsp
348 3cbbd752 2019-02-19 stsp # modify line 2 again; no local changes are left after merge
349 3cbbd752 2019-02-19 stsp sed -i 's/2/22/' $testroot/wt/numbers
350 3cbbd752 2019-02-19 stsp
351 3cbbd752 2019-02-19 stsp echo "G numbers" > $testroot/stdout.expected
352 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
353 3cbbd752 2019-02-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
354 3cbbd752 2019-02-19 stsp echo >> $testroot/stdout.expected
355 3cbbd752 2019-02-19 stsp
356 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
357 3cbbd752 2019-02-19 stsp
358 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
359 49c543a6 2022-03-31 naddy ret=$?
360 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
361 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
362 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
363 3cbbd752 2019-02-19 stsp return 1
364 3cbbd752 2019-02-19 stsp fi
365 3cbbd752 2019-02-19 stsp
366 2c201a36 2019-02-10 stsp echo -n > $testroot/stdout.expected
367 2c201a36 2019-02-10 stsp
368 2c201a36 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
369 2c201a36 2019-02-10 stsp
370 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
371 49c543a6 2022-03-31 naddy ret=$?
372 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
373 2c201a36 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
374 2c201a36 2019-02-10 stsp fi
375 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
376 2c201a36 2019-02-10 stsp }
377 7154f6ce 2019-03-27 stsp
378 f6cae3ed 2020-09-13 naddy test_status_shows_conflict() {
379 7154f6ce 2019-03-27 stsp local testroot=`test_init status_shows_conflict 1`
380 2c201a36 2019-02-10 stsp
381 7154f6ce 2019-03-27 stsp echo "1" > $testroot/repo/numbers
382 7154f6ce 2019-03-27 stsp echo "2" >> $testroot/repo/numbers
383 7154f6ce 2019-03-27 stsp echo "3" >> $testroot/repo/numbers
384 7154f6ce 2019-03-27 stsp echo "4" >> $testroot/repo/numbers
385 7154f6ce 2019-03-27 stsp echo "5" >> $testroot/repo/numbers
386 7154f6ce 2019-03-27 stsp echo "6" >> $testroot/repo/numbers
387 7154f6ce 2019-03-27 stsp echo "7" >> $testroot/repo/numbers
388 7154f6ce 2019-03-27 stsp echo "8" >> $testroot/repo/numbers
389 7154f6ce 2019-03-27 stsp (cd $testroot/repo && git add numbers)
390 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "added numbers file"
391 7154f6ce 2019-03-27 stsp
392 7154f6ce 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
393 49c543a6 2022-03-31 naddy ret=$?
394 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
395 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
396 7154f6ce 2019-03-27 stsp return 1
397 7154f6ce 2019-03-27 stsp fi
398 7154f6ce 2019-03-27 stsp
399 7154f6ce 2019-03-27 stsp sed -i 's/2/22/' $testroot/repo/numbers
400 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "modified line 2"
401 7154f6ce 2019-03-27 stsp
402 7154f6ce 2019-03-27 stsp # modify line 2 in a conflicting way
403 7154f6ce 2019-03-27 stsp sed -i 's/2/77/' $testroot/wt/numbers
404 7154f6ce 2019-03-27 stsp
405 7154f6ce 2019-03-27 stsp echo "C numbers" > $testroot/stdout.expected
406 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
407 7154f6ce 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
408 7154f6ce 2019-03-27 stsp echo >> $testroot/stdout.expected
409 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
410 7154f6ce 2019-03-27 stsp
411 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
412 7154f6ce 2019-03-27 stsp
413 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
414 49c543a6 2022-03-31 naddy ret=$?
415 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
416 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
417 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
418 7154f6ce 2019-03-27 stsp return 1
419 7154f6ce 2019-03-27 stsp fi
420 7154f6ce 2019-03-27 stsp
421 7154f6ce 2019-03-27 stsp echo 'C numbers' > $testroot/stdout.expected
422 7154f6ce 2019-03-27 stsp
423 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
424 c577a9ce 2019-07-27 stsp
425 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
426 49c543a6 2022-03-31 naddy ret=$?
427 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
428 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
429 c577a9ce 2019-07-27 stsp fi
430 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
431 c577a9ce 2019-07-27 stsp }
432 c577a9ce 2019-07-27 stsp
433 f6cae3ed 2020-09-13 naddy test_status_empty_dir() {
434 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir`
435 c577a9ce 2019-07-27 stsp
436 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
437 49c543a6 2022-03-31 naddy ret=$?
438 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
439 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
440 c577a9ce 2019-07-27 stsp return 1
441 c577a9ce 2019-07-27 stsp fi
442 c577a9ce 2019-07-27 stsp
443 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
444 c577a9ce 2019-07-27 stsp
445 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
446 c577a9ce 2019-07-27 stsp
447 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
448 c577a9ce 2019-07-27 stsp
449 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
450 49c543a6 2022-03-31 naddy ret=$?
451 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
452 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
453 c577a9ce 2019-07-27 stsp fi
454 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
455 c577a9ce 2019-07-27 stsp }
456 7154f6ce 2019-03-27 stsp
457 f6cae3ed 2020-09-13 naddy test_status_empty_dir_unversioned_file() {
458 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir_unversioned_file`
459 c577a9ce 2019-07-27 stsp
460 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
461 49c543a6 2022-03-31 naddy ret=$?
462 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
463 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
464 c577a9ce 2019-07-27 stsp return 1
465 c577a9ce 2019-07-27 stsp fi
466 c577a9ce 2019-07-27 stsp
467 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
468 c577a9ce 2019-07-27 stsp touch $testroot/wt/epsilon/unversioned
469 c577a9ce 2019-07-27 stsp
470 c577a9ce 2019-07-27 stsp echo '? epsilon/unversioned' > $testroot/stdout.expected
471 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' >> $testroot/stdout.expected
472 c577a9ce 2019-07-27 stsp
473 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
474 c577a9ce 2019-07-27 stsp
475 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
476 49c543a6 2022-03-31 naddy ret=$?
477 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
478 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
479 7154f6ce 2019-03-27 stsp fi
480 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
481 7154f6ce 2019-03-27 stsp }
482 72ea6654 2019-07-27 stsp
483 f6cae3ed 2020-09-13 naddy test_status_many_paths() {
484 72ea6654 2019-07-27 stsp local testroot=`test_init status_many_paths`
485 7154f6ce 2019-03-27 stsp
486 72ea6654 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
487 49c543a6 2022-03-31 naddy ret=$?
488 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
489 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
490 72ea6654 2019-07-27 stsp return 1
491 72ea6654 2019-07-27 stsp fi
492 72ea6654 2019-07-27 stsp
493 72ea6654 2019-07-27 stsp echo "modified alpha" > $testroot/wt/alpha
494 72ea6654 2019-07-27 stsp (cd $testroot/wt && got rm beta >/dev/null)
495 72ea6654 2019-07-27 stsp echo "unversioned file" > $testroot/wt/foo
496 72ea6654 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
497 72ea6654 2019-07-27 stsp touch $testroot/wt/beta
498 72ea6654 2019-07-27 stsp echo "new file" > $testroot/wt/new
499 72ea6654 2019-07-27 stsp mkdir $testroot/wt/newdir
500 72ea6654 2019-07-27 stsp (cd $testroot/wt && got add new >/dev/null)
501 72ea6654 2019-07-27 stsp
502 10a623df 2021-10-11 stsp (cd $testroot/wt && got status alpha > $testroot/stdout.expected)
503 10a623df 2021-10-11 stsp (cd $testroot/wt && got status beta >> $testroot/stdout.expected)
504 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status epsilon >> $testroot/stdout.expected)
505 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status foo >> $testroot/stdout.expected)
506 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status new >> $testroot/stdout.expected)
507 10a623df 2021-10-11 stsp (cd $testroot/wt && got status newdir >> $testroot/stdout.expected)
508 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status . >> $testroot/stdout.expected)
509 72ea6654 2019-07-27 stsp
510 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status newdir alpha epsilon foo new beta . \
511 72ea6654 2019-07-27 stsp > $testroot/stdout)
512 6841da00 2019-08-08 stsp
513 6841da00 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
514 49c543a6 2022-03-31 naddy ret=$?
515 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
516 6841da00 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
517 6841da00 2019-08-08 stsp fi
518 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
519 6841da00 2019-08-08 stsp }
520 6841da00 2019-08-08 stsp
521 f6cae3ed 2020-09-13 naddy test_status_cvsignore() {
522 6841da00 2019-08-08 stsp local testroot=`test_init status_cvsignore`
523 6841da00 2019-08-08 stsp
524 6841da00 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
525 49c543a6 2022-03-31 naddy ret=$?
526 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
527 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
528 6841da00 2019-08-08 stsp return 1
529 6841da00 2019-08-08 stsp fi
530 72ea6654 2019-07-27 stsp
531 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foo
532 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foop
533 3143d852 2020-06-25 stsp echo "unversioned file" > $testroot/wt/epsilon/foo
534 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
535 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
536 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
537 3143d852 2020-06-25 stsp mkdir -p $testroot/wt/epsilon/new/
538 3143d852 2020-06-25 stsp echo "unversioned file" > $testroot/wt/epsilon/new/foo
539 3143d852 2020-06-25 stsp echo "**/foo" > $testroot/wt/.cvsignore
540 8f2ca62d 2021-10-13 stsp echo "**/gamma" >> $testroot/wt/.cvsignore
541 6841da00 2019-08-08 stsp echo "bar" > $testroot/wt/epsilon/.cvsignore
542 6841da00 2019-08-08 stsp echo "moo" >> $testroot/wt/epsilon/.cvsignore
543 6841da00 2019-08-08 stsp
544 6841da00 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
545 6841da00 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
546 6841da00 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
547 6841da00 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
548 6841da00 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
549 3143d852 2020-06-25 stsp
550 3143d852 2020-06-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
551 49c543a6 2022-03-31 naddy ret=$?
552 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
553 3143d852 2020-06-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
554 3143d852 2020-06-25 stsp test_done "$testroot" "$ret"
555 3143d852 2020-06-25 stsp return 1
556 3143d852 2020-06-25 stsp fi
557 3143d852 2020-06-25 stsp
558 3143d852 2020-06-25 stsp echo '? epsilon/.cvsignore' > $testroot/stdout.expected
559 3143d852 2020-06-25 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
560 3143d852 2020-06-25 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
561 b80270a7 2019-08-08 stsp
562 b80270a7 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
563 49c543a6 2022-03-31 naddy ret=$?
564 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
565 b80270a7 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
566 b80270a7 2019-08-08 stsp test_done "$testroot" "$ret"
567 b80270a7 2019-08-08 stsp return 1
568 b80270a7 2019-08-08 stsp fi
569 5e91dae4 2022-08-30 stsp
570 3143d852 2020-06-25 stsp echo -n '' > $testroot/stdout.expected
571 3143d852 2020-06-25 stsp (cd $testroot/wt && got status epsilon/new > $testroot/stdout)
572 6841da00 2019-08-08 stsp
573 3143d852 2020-06-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
574 49c543a6 2022-03-31 naddy ret=$?
575 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
576 3143d852 2020-06-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
577 3143d852 2020-06-25 stsp test_done "$testroot" "$ret"
578 3143d852 2020-06-25 stsp return 1
579 3143d852 2020-06-25 stsp fi
580 3143d852 2020-06-25 stsp
581 b80270a7 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
582 b80270a7 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
583 b80270a7 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
584 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
585 bd8de430 2019-10-04 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
586 f6343036 2021-06-22 stsp
587 f6343036 2021-06-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
588 49c543a6 2022-03-31 naddy ret=$?
589 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
590 f6343036 2021-06-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
591 f6343036 2021-06-22 stsp test_done "$testroot" "$ret"
592 f6343036 2021-06-22 stsp return 1
593 f6343036 2021-06-22 stsp fi
594 f6343036 2021-06-22 stsp
595 f6343036 2021-06-22 stsp cat > $testroot/stdout.expected <<EOF
596 f6343036 2021-06-22 stsp ? .cvsignore
597 f6343036 2021-06-22 stsp ? epsilon/.cvsignore
598 f6343036 2021-06-22 stsp ? epsilon/bar
599 f6343036 2021-06-22 stsp ? epsilon/boo
600 f6343036 2021-06-22 stsp ? epsilon/foo
601 f6343036 2021-06-22 stsp ? epsilon/moo
602 f6343036 2021-06-22 stsp ? epsilon/new/foo
603 f6343036 2021-06-22 stsp ? foo
604 f6343036 2021-06-22 stsp ? foop
605 f6343036 2021-06-22 stsp EOF
606 f6343036 2021-06-22 stsp (cd $testroot/wt && got status -I > $testroot/stdout)
607 49c543a6 2022-03-31 naddy ret=$?
608 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
609 f6343036 2021-06-22 stsp echo "got status failed unexpectedly" >&2
610 f6343036 2021-06-22 stsp test_done "$testroot" "1"
611 f6343036 2021-06-22 stsp return 1
612 f6343036 2021-06-22 stsp fi
613 bd8de430 2019-10-04 stsp
614 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
615 49c543a6 2022-03-31 naddy ret=$?
616 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
617 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
618 bd8de430 2019-10-04 stsp fi
619 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
620 bd8de430 2019-10-04 stsp }
621 bd8de430 2019-10-04 stsp
622 f6cae3ed 2020-09-13 naddy test_status_gitignore() {
623 bd8de430 2019-10-04 stsp local testroot=`test_init status_gitignore`
624 bd8de430 2019-10-04 stsp
625 bd8de430 2019-10-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
626 49c543a6 2022-03-31 naddy ret=$?
627 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
628 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
629 bd8de430 2019-10-04 stsp return 1
630 bd8de430 2019-10-04 stsp fi
631 bd8de430 2019-10-04 stsp
632 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foo
633 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foop
634 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/barp
635 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
636 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
637 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
638 bd8de430 2019-10-04 stsp mkdir -p $testroot/wt/a/b/c/
639 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/foo
640 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/zoo
641 bd8de430 2019-10-04 stsp echo "foo" > $testroot/wt/.gitignore
642 bd8de430 2019-10-04 stsp echo "bar*" >> $testroot/wt/.gitignore
643 bd8de430 2019-10-04 stsp echo "epsilon/**" >> $testroot/wt/.gitignore
644 bd8de430 2019-10-04 stsp echo "a/**/foo" >> $testroot/wt/.gitignore
645 bd8de430 2019-10-04 stsp echo "**/zoo" >> $testroot/wt/.gitignore
646 bd8de430 2019-10-04 stsp
647 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
648 b80270a7 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
649 bd8de430 2019-10-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
650 bd8de430 2019-10-04 stsp
651 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
652 49c543a6 2022-03-31 naddy ret=$?
653 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
654 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
655 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
656 bd8de430 2019-10-04 stsp return 1
657 bd8de430 2019-10-04 stsp fi
658 bd8de430 2019-10-04 stsp
659 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
660 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
661 b80270a7 2019-08-08 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
662 b80270a7 2019-08-08 stsp
663 72ea6654 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
664 49c543a6 2022-03-31 naddy ret=$?
665 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
666 72ea6654 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
667 f6343036 2021-06-22 stsp test_done "$testroot" "$ret"
668 f6343036 2021-06-22 stsp return 1
669 72ea6654 2019-07-27 stsp fi
670 f6343036 2021-06-22 stsp
671 f6343036 2021-06-22 stsp cat > $testroot/stdout.expected <<EOF
672 f6343036 2021-06-22 stsp ? .gitignore
673 f6343036 2021-06-22 stsp ? a/b/c/foo
674 f6343036 2021-06-22 stsp ? a/b/c/zoo
675 f6343036 2021-06-22 stsp ? barp
676 f6343036 2021-06-22 stsp ? epsilon/bar
677 f6343036 2021-06-22 stsp ? epsilon/boo
678 f6343036 2021-06-22 stsp ? epsilon/moo
679 f6343036 2021-06-22 stsp ? foo
680 f6343036 2021-06-22 stsp ? foop
681 f6343036 2021-06-22 stsp EOF
682 f6343036 2021-06-22 stsp (cd $testroot/wt && got status -I > $testroot/stdout)
683 49c543a6 2022-03-31 naddy ret=$?
684 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
685 f6343036 2021-06-22 stsp echo "got status failed unexpectedly" >&2
686 f6343036 2021-06-22 stsp test_done "$testroot" "1"
687 f6343036 2021-06-22 stsp return 1
688 f6343036 2021-06-22 stsp fi
689 f6343036 2021-06-22 stsp
690 f6343036 2021-06-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
691 49c543a6 2022-03-31 naddy ret=$?
692 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
693 f6343036 2021-06-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
694 f6343036 2021-06-22 stsp fi
695 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
696 72ea6654 2019-07-27 stsp }
697 081470ac 2020-08-13 stsp
698 8a86203b 2023-02-06 stsp test_status_gitignore_trailing_slashes() {
699 8a86203b 2023-02-06 stsp local testroot=`test_init status_gitignore_trailing_slashes`
700 8a86203b 2023-02-06 stsp
701 8a86203b 2023-02-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
702 8a86203b 2023-02-06 stsp ret=$?
703 8a86203b 2023-02-06 stsp if [ $ret -ne 0 ]; then
704 8a86203b 2023-02-06 stsp test_done "$testroot" "$ret"
705 8a86203b 2023-02-06 stsp return 1
706 8a86203b 2023-02-06 stsp fi
707 8a86203b 2023-02-06 stsp
708 8a86203b 2023-02-06 stsp echo "unversioned file" > $testroot/wt/foo
709 8a86203b 2023-02-06 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
710 8a86203b 2023-02-06 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
711 8a86203b 2023-02-06 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
712 249b637c 2023-02-20 stsp echo "unversioned file" > $testroot/wt/upsilon
713 8a86203b 2023-02-06 stsp
714 249b637c 2023-02-20 stsp # Match the directory epsilon but not the regular file upsilon
715 249b637c 2023-02-20 stsp echo "*psilon/" > $testroot/wt/.gitignore
716 249b637c 2023-02-20 stsp
717 8a86203b 2023-02-06 stsp echo '? .gitignore' > $testroot/stdout.expected
718 8a86203b 2023-02-06 stsp echo '? foo' >> $testroot/stdout.expected
719 249b637c 2023-02-20 stsp echo '? upsilon' >> $testroot/stdout.expected
720 8a86203b 2023-02-06 stsp (cd $testroot/wt && got status > $testroot/stdout)
721 8a86203b 2023-02-06 stsp
722 8a86203b 2023-02-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
723 8a86203b 2023-02-06 stsp ret=$?
724 8a86203b 2023-02-06 stsp if [ $ret -ne 0 ]; then
725 249b637c 2023-02-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
726 8a86203b 2023-02-06 stsp fi
727 8a86203b 2023-02-06 stsp test_done "$testroot" "$ret"
728 8a86203b 2023-02-06 stsp }
729 8a86203b 2023-02-06 stsp
730 f6cae3ed 2020-09-13 naddy test_status_status_code() {
731 081470ac 2020-08-13 stsp local testroot=`test_init status_status_code`
732 081470ac 2020-08-13 stsp
733 081470ac 2020-08-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
734 49c543a6 2022-03-31 naddy ret=$?
735 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
736 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
737 081470ac 2020-08-13 stsp return 1
738 081470ac 2020-08-13 stsp fi
739 081470ac 2020-08-13 stsp
740 081470ac 2020-08-13 stsp echo "modified alpha" > $testroot/wt/alpha
741 081470ac 2020-08-13 stsp (cd $testroot/wt && got rm beta >/dev/null)
742 081470ac 2020-08-13 stsp echo "unversioned file" > $testroot/wt/foo
743 081470ac 2020-08-13 stsp rm $testroot/wt/epsilon/zeta
744 081470ac 2020-08-13 stsp touch $testroot/wt/beta
745 081470ac 2020-08-13 stsp echo "new file" > $testroot/wt/new
746 081470ac 2020-08-13 stsp (cd $testroot/wt && got add new >/dev/null)
747 081470ac 2020-08-13 stsp
748 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s xDM \
749 081470ac 2020-08-13 stsp > $testroot/stdout 2> $testroot/stderr)
750 49c543a6 2022-03-31 naddy ret=$?
751 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
752 081470ac 2020-08-13 stsp echo "status succeeded unexpectedly" >&2
753 081470ac 2020-08-13 stsp test_done "$testroot" "1"
754 081470ac 2020-08-13 stsp return 1
755 081470ac 2020-08-13 stsp fi
756 081470ac 2020-08-13 stsp
757 081470ac 2020-08-13 stsp echo "got: invalid status code 'x'" > $testroot/stderr.expected
758 081470ac 2020-08-13 stsp cmp -s $testroot/stderr.expected $testroot/stderr
759 49c543a6 2022-03-31 naddy ret=$?
760 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
761 081470ac 2020-08-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
762 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
763 081470ac 2020-08-13 stsp return 1
764 081470ac 2020-08-13 stsp fi
765 72ea6654 2019-07-27 stsp
766 081470ac 2020-08-13 stsp echo 'M alpha' > $testroot/stdout.expected
767 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s M > $testroot/stdout)
768 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
769 49c543a6 2022-03-31 naddy ret=$?
770 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
771 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
772 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
773 081470ac 2020-08-13 stsp return 1
774 081470ac 2020-08-13 stsp fi
775 081470ac 2020-08-13 stsp
776 081470ac 2020-08-13 stsp echo 'D beta' > $testroot/stdout.expected
777 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s D > $testroot/stdout)
778 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
779 49c543a6 2022-03-31 naddy ret=$?
780 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
781 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
782 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
783 081470ac 2020-08-13 stsp return 1
784 081470ac 2020-08-13 stsp fi
785 081470ac 2020-08-13 stsp
786 081470ac 2020-08-13 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
787 081470ac 2020-08-13 stsp echo '? foo' >> $testroot/stdout.expected
788 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -s !\? > $testroot/stdout)
789 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
790 49c543a6 2022-03-31 naddy ret=$?
791 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
792 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
793 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
794 081470ac 2020-08-13 stsp return 1
795 081470ac 2020-08-13 stsp fi
796 081470ac 2020-08-13 stsp
797 081470ac 2020-08-13 stsp echo 'A new' > $testroot/stdout.expected
798 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
799 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
800 49c543a6 2022-03-31 naddy ret=$?
801 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
802 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
803 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
804 081470ac 2020-08-13 stsp return 1
805 081470ac 2020-08-13 stsp fi
806 081470ac 2020-08-13 stsp
807 081470ac 2020-08-13 stsp (cd $testroot/wt && got stage new > $testroot/stdout)
808 081470ac 2020-08-13 stsp
809 081470ac 2020-08-13 stsp echo ' A new' > $testroot/stdout.expected
810 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
811 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
812 49c543a6 2022-03-31 naddy ret=$?
813 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
814 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
815 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
816 081470ac 2020-08-13 stsp return 1
817 081470ac 2020-08-13 stsp fi
818 081470ac 2020-08-13 stsp
819 081470ac 2020-08-13 stsp echo 'changed file new' > $testroot/wt/new
820 081470ac 2020-08-13 stsp
821 081470ac 2020-08-13 stsp echo 'MA new' > $testroot/stdout.expected
822 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
823 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
824 49c543a6 2022-03-31 naddy ret=$?
825 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
826 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
827 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
828 081470ac 2020-08-13 stsp return 1
829 081470ac 2020-08-13 stsp fi
830 081470ac 2020-08-13 stsp
831 081470ac 2020-08-13 stsp echo 'M alpha' > $testroot/stdout.expected
832 081470ac 2020-08-13 stsp echo 'MA new' >> $testroot/stdout.expected
833 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s M > $testroot/stdout)
834 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
835 49c543a6 2022-03-31 naddy ret=$?
836 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
837 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
838 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
839 67c65ed7 2021-09-14 tracey return 1
840 67c65ed7 2021-09-14 tracey fi
841 67c65ed7 2021-09-14 tracey
842 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
843 67c65ed7 2021-09-14 tracey }
844 67c65ed7 2021-09-14 tracey
845 67c65ed7 2021-09-14 tracey test_status_suppress() {
846 67c65ed7 2021-09-14 tracey local testroot=`test_init status_suppress`
847 67c65ed7 2021-09-14 tracey
848 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
849 49c543a6 2022-03-31 naddy ret=$?
850 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
851 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
852 67c65ed7 2021-09-14 tracey return 1
853 67c65ed7 2021-09-14 tracey fi
854 67c65ed7 2021-09-14 tracey
855 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/wt/alpha
856 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got rm beta >/dev/null)
857 67c65ed7 2021-09-14 tracey echo "unversioned file" > $testroot/wt/foo
858 67c65ed7 2021-09-14 tracey rm $testroot/wt/epsilon/zeta
859 67c65ed7 2021-09-14 tracey touch $testroot/wt/beta
860 67c65ed7 2021-09-14 tracey echo "new file" > $testroot/wt/new
861 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got add new >/dev/null)
862 e3a46353 2021-09-14 stsp
863 e3a46353 2021-09-14 stsp (cd $testroot/wt && got status -S A -s M \
864 e3a46353 2021-09-14 stsp > $testroot/stdout 2> $testroot/stderr)
865 49c543a6 2022-03-31 naddy ret=$?
866 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
867 e3a46353 2021-09-14 stsp echo "status succeeded unexpectedly" >&2
868 e3a46353 2021-09-14 stsp test_done "$testroot" "1"
869 e3a46353 2021-09-14 stsp return 1
870 e3a46353 2021-09-14 stsp fi
871 e3a46353 2021-09-14 stsp
872 e3a46353 2021-09-14 stsp echo "got: -s and -S options are mutually exclusive" \
873 e3a46353 2021-09-14 stsp > $testroot/stderr.expected
874 e3a46353 2021-09-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
875 49c543a6 2022-03-31 naddy ret=$?
876 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
877 e3a46353 2021-09-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
878 e3a46353 2021-09-14 stsp test_done "$testroot" "$ret"
879 e3a46353 2021-09-14 stsp return 1
880 e3a46353 2021-09-14 stsp fi
881 e3a46353 2021-09-14 stsp
882 e3a46353 2021-09-14 stsp (cd $testroot/wt && got status -s A -S M \
883 e3a46353 2021-09-14 stsp > $testroot/stdout 2> $testroot/stderr)
884 49c543a6 2022-03-31 naddy ret=$?
885 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
886 e3a46353 2021-09-14 stsp echo "status succeeded unexpectedly" >&2
887 e3a46353 2021-09-14 stsp test_done "$testroot" "1"
888 e3a46353 2021-09-14 stsp return 1
889 e3a46353 2021-09-14 stsp fi
890 67c65ed7 2021-09-14 tracey
891 e3a46353 2021-09-14 stsp echo "got: -S and -s options are mutually exclusive" \
892 e3a46353 2021-09-14 stsp > $testroot/stderr.expected
893 e3a46353 2021-09-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
894 49c543a6 2022-03-31 naddy ret=$?
895 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
896 e3a46353 2021-09-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
897 e3a46353 2021-09-14 stsp test_done "$testroot" "$ret"
898 e3a46353 2021-09-14 stsp return 1
899 e3a46353 2021-09-14 stsp fi
900 e3a46353 2021-09-14 stsp
901 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got status -S xDM \
902 67c65ed7 2021-09-14 tracey > $testroot/stdout 2> $testroot/stderr)
903 49c543a6 2022-03-31 naddy ret=$?
904 49c543a6 2022-03-31 naddy if [ $ret -eq 0 ]; then
905 67c65ed7 2021-09-14 tracey echo "status succeeded unexpectedly" >&2
906 67c65ed7 2021-09-14 tracey test_done "$testroot" "1"
907 67c65ed7 2021-09-14 tracey return 1
908 67c65ed7 2021-09-14 tracey fi
909 67c65ed7 2021-09-14 tracey
910 67c65ed7 2021-09-14 tracey echo "got: invalid status code 'x'" > $testroot/stderr.expected
911 67c65ed7 2021-09-14 tracey cmp -s $testroot/stderr.expected $testroot/stderr
912 49c543a6 2022-03-31 naddy ret=$?
913 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
914 67c65ed7 2021-09-14 tracey diff -u $testroot/stderr.expected $testroot/stderr
915 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
916 67c65ed7 2021-09-14 tracey return 1
917 67c65ed7 2021-09-14 tracey fi
918 67c65ed7 2021-09-14 tracey
919 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
920 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S D\?A! > $testroot/stdout)
921 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
922 49c543a6 2022-03-31 naddy ret=$?
923 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
924 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
925 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
926 67c65ed7 2021-09-14 tracey return 1
927 67c65ed7 2021-09-14 tracey fi
928 67c65ed7 2021-09-14 tracey
929 67c65ed7 2021-09-14 tracey echo 'D beta' > $testroot/stdout.expected
930 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S M\?A! > $testroot/stdout)
931 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
932 49c543a6 2022-03-31 naddy ret=$?
933 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
934 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
935 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
936 67c65ed7 2021-09-14 tracey return 1
937 67c65ed7 2021-09-14 tracey fi
938 67c65ed7 2021-09-14 tracey
939 67c65ed7 2021-09-14 tracey echo '! epsilon/zeta' > $testroot/stdout.expected
940 67c65ed7 2021-09-14 tracey echo '? foo' >> $testroot/stdout.expected
941 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got status -S MDA > $testroot/stdout)
942 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
943 49c543a6 2022-03-31 naddy ret=$?
944 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
945 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
946 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
947 081470ac 2020-08-13 stsp return 1
948 081470ac 2020-08-13 stsp fi
949 081470ac 2020-08-13 stsp
950 67c65ed7 2021-09-14 tracey echo 'A new' > $testroot/stdout.expected
951 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
952 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
953 49c543a6 2022-03-31 naddy ret=$?
954 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
955 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
956 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
957 67c65ed7 2021-09-14 tracey return 1
958 67c65ed7 2021-09-14 tracey fi
959 67c65ed7 2021-09-14 tracey
960 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got stage new > $testroot/stdout)
961 67c65ed7 2021-09-14 tracey
962 67c65ed7 2021-09-14 tracey echo ' A new' > $testroot/stdout.expected
963 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
964 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
965 49c543a6 2022-03-31 naddy ret=$?
966 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
967 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
968 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
969 67c65ed7 2021-09-14 tracey return 1
970 67c65ed7 2021-09-14 tracey fi
971 67c65ed7 2021-09-14 tracey
972 67c65ed7 2021-09-14 tracey echo 'changed file new' > $testroot/wt/new
973 67c65ed7 2021-09-14 tracey
974 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
975 67c65ed7 2021-09-14 tracey echo 'MA new' >> $testroot/stdout.expected
976 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S D\?! > $testroot/stdout)
977 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
978 49c543a6 2022-03-31 naddy ret=$?
979 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
980 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
981 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
982 67c65ed7 2021-09-14 tracey return 1
983 67c65ed7 2021-09-14 tracey fi
984 67c65ed7 2021-09-14 tracey
985 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
986 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S AD\?! > $testroot/stdout)
987 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
988 49c543a6 2022-03-31 naddy ret=$?
989 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
990 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
991 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
992 67c65ed7 2021-09-14 tracey return 1
993 67c65ed7 2021-09-14 tracey fi
994 67c65ed7 2021-09-14 tracey
995 67c65ed7 2021-09-14 tracey rm $testroot/stdout.expected
996 67c65ed7 2021-09-14 tracey touch $testroot/stdout.expected
997 67c65ed7 2021-09-14 tracey
998 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
999 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
1000 49c543a6 2022-03-31 naddy ret=$?
1001 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1002 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
1003 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
1004 67c65ed7 2021-09-14 tracey return 1
1005 67c65ed7 2021-09-14 tracey fi
1006 67c65ed7 2021-09-14 tracey
1007 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
1008 081470ac 2020-08-13 stsp }
1009 4a26d3f8 2020-10-07 stsp
1010 4a26d3f8 2020-10-07 stsp test_status_empty_file() {
1011 4a26d3f8 2020-10-07 stsp local testroot=`test_init status_empty_file`
1012 4a26d3f8 2020-10-07 stsp
1013 4a26d3f8 2020-10-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1014 49c543a6 2022-03-31 naddy ret=$?
1015 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1016 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1017 4a26d3f8 2020-10-07 stsp return 1
1018 4a26d3f8 2020-10-07 stsp fi
1019 4a26d3f8 2020-10-07 stsp
1020 4a26d3f8 2020-10-07 stsp echo -n "" > $testroot/wt/empty
1021 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got add empty >/dev/null)
1022 4a26d3f8 2020-10-07 stsp
1023 4a26d3f8 2020-10-07 stsp echo 'A empty' > $testroot/stdout.expected
1024 4a26d3f8 2020-10-07 stsp
1025 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1026 4a26d3f8 2020-10-07 stsp
1027 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1028 49c543a6 2022-03-31 naddy ret=$?
1029 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1030 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1031 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1032 4a26d3f8 2020-10-07 stsp return 1
1033 4a26d3f8 2020-10-07 stsp fi
1034 4a26d3f8 2020-10-07 stsp
1035 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got commit -m "empty file" >/dev/null)
1036 4a26d3f8 2020-10-07 stsp
1037 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1038 081470ac 2020-08-13 stsp
1039 4a26d3f8 2020-10-07 stsp echo -n > $testroot/stdout.expected
1040 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1041 49c543a6 2022-03-31 naddy ret=$?
1042 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1043 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1044 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1045 4a26d3f8 2020-10-07 stsp return 1
1046 4a26d3f8 2020-10-07 stsp fi
1047 081470ac 2020-08-13 stsp
1048 4a26d3f8 2020-10-07 stsp # update the timestamp; this used to make the file show up as:
1049 4a26d3f8 2020-10-07 stsp # M empty
1050 4a26d3f8 2020-10-07 stsp # which should not happen
1051 4a26d3f8 2020-10-07 stsp touch $testroot/wt/empty
1052 4a26d3f8 2020-10-07 stsp
1053 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1054 4a26d3f8 2020-10-07 stsp
1055 4a26d3f8 2020-10-07 stsp echo -n > $testroot/stdout.expected
1056 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1057 49c543a6 2022-03-31 naddy ret=$?
1058 49c543a6 2022-03-31 naddy if [ $ret -ne 0 ]; then
1059 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1060 4a26d3f8 2020-10-07 stsp fi
1061 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1062 4a26d3f8 2020-10-07 stsp }
1063 4a26d3f8 2020-10-07 stsp
1064 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1065 35dc4510 2019-02-04 stsp run_test test_status_basic
1066 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods
1067 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods2
1068 0dbc2271 2019-02-05 stsp run_test test_status_obstructed
1069 02c07007 2019-02-10 stsp run_test test_status_shows_local_mods_after_update
1070 18831e78 2019-02-10 stsp run_test test_status_unversioned_subdirs
1071 00bb5ea0 2020-07-23 stsp run_test test_status_symlink
1072 3cbbd752 2019-02-19 stsp run_test test_status_shows_no_mods_after_complete_merge
1073 7154f6ce 2019-03-27 stsp run_test test_status_shows_conflict
1074 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir
1075 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir_unversioned_file
1076 72ea6654 2019-07-27 stsp run_test test_status_many_paths
1077 6841da00 2019-08-08 stsp run_test test_status_cvsignore
1078 bd8de430 2019-10-04 stsp run_test test_status_gitignore
1079 8a86203b 2023-02-06 stsp run_test test_status_gitignore_trailing_slashes
1080 081470ac 2020-08-13 stsp run_test test_status_status_code
1081 67c65ed7 2021-09-14 tracey run_test test_status_suppress
1082 4a26d3f8 2020-10-07 stsp run_test test_status_empty_file