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