3 c4296144 2019-05-09 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 c4296144 2019-05-09 stsp # Permission to use, copy, modify, and distribute this software for any
6 c4296144 2019-05-09 stsp # purpose with or without fee is hereby granted, provided that the above
7 c4296144 2019-05-09 stsp # copyright notice and this permission notice appear in all copies.
9 c4296144 2019-05-09 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c4296144 2019-05-09 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c4296144 2019-05-09 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c4296144 2019-05-09 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c4296144 2019-05-09 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c4296144 2019-05-09 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c4296144 2019-05-09 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c4296144 2019-05-09 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_commit_basic() {
20 c4296144 2019-05-09 stsp local testroot=`test_init commit_basic`
22 c4296144 2019-05-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
25 c4296144 2019-05-09 stsp test_done "$testroot" "$ret"
29 c4296144 2019-05-09 stsp echo "modified alpha" > $testroot/wt/alpha
30 c4296144 2019-05-09 stsp (cd $testroot/wt && got rm beta >/dev/null)
31 c4296144 2019-05-09 stsp echo "new file" > $testroot/wt/new
32 c4296144 2019-05-09 stsp (cd $testroot/wt && got add new >/dev/null)
34 83a7ae6d 2019-05-10 stsp (cd $testroot/wt && got commit -m 'test commit_basic' > $testroot/stdout)
36 c4296144 2019-05-09 stsp local head_rev=`git_show_head $testroot/repo`
37 afa376bf 2019-05-09 stsp echo "A new" > $testroot/stdout.expected
38 afa376bf 2019-05-09 stsp echo "M alpha" >> $testroot/stdout.expected
39 afa376bf 2019-05-09 stsp echo "D beta" >> $testroot/stdout.expected
40 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
42 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
44 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
45 c4296144 2019-05-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
47 c4296144 2019-05-09 stsp test_done "$testroot" "$ret"
50 f6cae3ed 2020-09-13 naddy test_commit_new_subdir() {
51 baa7dcfa 2019-05-09 stsp local testroot=`test_init commit_new_subdir`
53 baa7dcfa 2019-05-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
55 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
56 baa7dcfa 2019-05-09 stsp test_done "$testroot" "$ret"
60 baa7dcfa 2019-05-09 stsp mkdir -p $testroot/wt/d
61 baa7dcfa 2019-05-09 stsp echo "new file" > $testroot/wt/d/new
62 baa7dcfa 2019-05-09 stsp echo "another new file" > $testroot/wt/d/new2
63 baa7dcfa 2019-05-09 stsp (cd $testroot/wt && got add d/new >/dev/null)
64 baa7dcfa 2019-05-09 stsp (cd $testroot/wt && got add d/new2 >/dev/null)
66 baa7dcfa 2019-05-09 stsp (cd $testroot/wt && \
67 baa7dcfa 2019-05-09 stsp got commit -m 'test commit_new_subdir' > $testroot/stdout)
69 baa7dcfa 2019-05-09 stsp local head_rev=`git_show_head $testroot/repo`
70 baa7dcfa 2019-05-09 stsp echo "A d/new" > $testroot/stdout.expected
71 baa7dcfa 2019-05-09 stsp echo "A d/new2" >> $testroot/stdout.expected
72 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
74 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
76 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
77 baa7dcfa 2019-05-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
79 baa7dcfa 2019-05-09 stsp test_done "$testroot" "$ret"
82 f6cae3ed 2020-09-13 naddy test_commit_subdir() {
83 bc70eb79 2019-05-09 stsp local testroot=`test_init commit_subdir`
85 bc70eb79 2019-05-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
87 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
88 bc70eb79 2019-05-09 stsp test_done "$testroot" "$ret"
92 bc70eb79 2019-05-09 stsp echo "modified alpha" > $testroot/wt/alpha
93 bc70eb79 2019-05-09 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
95 bc70eb79 2019-05-09 stsp (cd $testroot/wt && \
96 bc70eb79 2019-05-09 stsp got commit -m 'test commit_subdir' epsilon > $testroot/stdout)
98 bc70eb79 2019-05-09 stsp local head_rev=`git_show_head $testroot/repo`
99 bc70eb79 2019-05-09 stsp echo "M epsilon/zeta" >> $testroot/stdout.expected
100 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
102 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
104 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
105 bc70eb79 2019-05-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
107 bc70eb79 2019-05-09 stsp test_done "$testroot" "$ret"
110 f6cae3ed 2020-09-13 naddy test_commit_single_file() {
111 5bbcb68b 2019-05-09 stsp local testroot=`test_init commit_single_file`
113 5bbcb68b 2019-05-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
115 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
116 5bbcb68b 2019-05-09 stsp test_done "$testroot" "$ret"
120 5bbcb68b 2019-05-09 stsp echo "modified alpha" > $testroot/wt/alpha
121 5bbcb68b 2019-05-09 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
123 1a36436d 2019-06-10 stsp (cd $testroot/wt && got commit -m 'changed zeta' epsilon/zeta \
124 5bbcb68b 2019-05-09 stsp > $testroot/stdout)
126 5bbcb68b 2019-05-09 stsp local head_rev=`git_show_head $testroot/repo`
127 5bbcb68b 2019-05-09 stsp echo "M epsilon/zeta" >> $testroot/stdout.expected
128 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
130 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
132 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
133 5bbcb68b 2019-05-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
135 5bbcb68b 2019-05-09 stsp test_done "$testroot" "$ret"
138 f6cae3ed 2020-09-13 naddy test_commit_out_of_date() {
139 819f385b 2019-05-10 stsp local testroot=`test_init commit_out_of_date`
140 f0b75401 2019-08-03 stsp local first_commit=`git_show_head $testroot/repo`
142 819f385b 2019-05-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
144 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
145 819f385b 2019-05-10 stsp test_done "$testroot" "$ret"
149 819f385b 2019-05-10 stsp echo "modified alpha" > $testroot/repo/alpha
150 819f385b 2019-05-10 stsp git_commit $testroot/repo -m "modified alpha"
152 819f385b 2019-05-10 stsp echo "modified alpha" > $testroot/wt/alpha
154 819f385b 2019-05-10 stsp (cd $testroot/wt && got commit -m 'test commit_out_of_date' \
155 819f385b 2019-05-10 stsp > $testroot/stdout 2> $testroot/stderr)
157 819f385b 2019-05-10 stsp echo -n > $testroot/stdout.expected
158 819f385b 2019-05-10 stsp echo "got: work tree must be updated before these" \
159 819f385b 2019-05-10 stsp "changes can be committed" > $testroot/stderr.expected
161 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
163 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
164 819f385b 2019-05-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
165 819f385b 2019-05-10 stsp test_done "$testroot" "$ret"
169 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
171 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
172 819f385b 2019-05-10 stsp diff -u $testroot/stderr.expected $testroot/stderr
173 f0b75401 2019-08-03 stsp test_done "$testroot" "$ret"
177 f0b75401 2019-08-03 stsp echo "alpha" > $testroot/repo/alpha
178 f0b75401 2019-08-03 stsp git_commit $testroot/repo -m "reset alpha contents"
179 f0b75401 2019-08-03 stsp (cd $testroot/wt && got update -c $first_commit > /dev/null)
181 f0b75401 2019-08-03 stsp echo "modified alpha" > $testroot/wt/alpha
183 f0b75401 2019-08-03 stsp (cd $testroot/wt && got commit -m 'changed alpha ' > $testroot/stdout)
185 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
186 f0b75401 2019-08-03 stsp echo "commit failed unexpectedly" >&2
187 f0b75401 2019-08-03 stsp test_done "$testroot" "1"
191 f0b75401 2019-08-03 stsp local head_rev=`git_show_head $testroot/repo`
192 f0b75401 2019-08-03 stsp echo "M alpha" > $testroot/stdout.expected
193 f0b75401 2019-08-03 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
194 f0b75401 2019-08-03 stsp cmp -s $testroot/stdout.expected $testroot/stdout
196 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
197 f0b75401 2019-08-03 stsp diff -u $testroot/stdout.expected $testroot/stdout
199 819f385b 2019-05-10 stsp test_done "$testroot" "$ret"
202 f6cae3ed 2020-09-13 naddy test_commit_added_subdirs() {
203 8ba6ba2d 2019-05-14 stsp local testroot=`test_init commit_added_subdirs`
205 8ba6ba2d 2019-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
207 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
208 8ba6ba2d 2019-05-14 stsp test_done "$testroot" "$ret"
212 8ba6ba2d 2019-05-14 stsp mkdir -p $testroot/wt/d
213 8ba6ba2d 2019-05-14 stsp echo "new file" > $testroot/wt/d/new
214 8ba6ba2d 2019-05-14 stsp echo "new file 2" > $testroot/wt/d/new2
215 8ba6ba2d 2019-05-14 stsp mkdir -p $testroot/wt/d/f
216 8ba6ba2d 2019-05-14 stsp echo "new file 3" > $testroot/wt/d/f/new3
217 8ba6ba2d 2019-05-14 stsp mkdir -p $testroot/wt/d/f/g
218 8ba6ba2d 2019-05-14 stsp echo "new file 4" > $testroot/wt/d/f/g/new4
220 8ba6ba2d 2019-05-14 stsp (cd $testroot/wt && got add $testroot/wt/*/new* \
221 8ba6ba2d 2019-05-14 stsp $testroot/wt/*/*/new* $testroot/wt/*/*/*/new* > /dev/null)
223 8ba6ba2d 2019-05-14 stsp (cd $testroot/wt && got commit -m 'test commit_added_subdirs' \
224 8ba6ba2d 2019-05-14 stsp > $testroot/stdout 2> $testroot/stderr)
226 8ba6ba2d 2019-05-14 stsp local head_rev=`git_show_head $testroot/repo`
227 a3df2849 2019-05-20 stsp echo "A d/f/g/new4" > $testroot/stdout.expected
228 a3df2849 2019-05-20 stsp echo "A d/f/new3" >> $testroot/stdout.expected
229 8ba6ba2d 2019-05-14 stsp echo "A d/new" >> $testroot/stdout.expected
230 8ba6ba2d 2019-05-14 stsp echo "A d/new2" >> $testroot/stdout.expected
231 ba580f68 2020-03-22 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
233 ba580f68 2020-03-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
235 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
236 ba580f68 2020-03-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
238 ba580f68 2020-03-22 stsp test_done "$testroot" "$ret"
241 f6cae3ed 2020-09-13 naddy test_commit_deleted_subdirs() {
242 ba580f68 2020-03-22 stsp local testroot=`test_init commit_deleted_subdirs`
244 ba580f68 2020-03-22 stsp got checkout $testroot/repo $testroot/wt > /dev/null
246 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
247 ba580f68 2020-03-22 stsp test_done "$testroot" "$ret"
251 c8c7d149 2020-09-17 naddy (cd $testroot/wt && \
252 c8c7d149 2020-09-17 naddy got rm -R $testroot/wt/epsilon $testroot/wt/gamma >/dev/null)
254 ba580f68 2020-03-22 stsp (cd $testroot/wt && got commit -m 'test commit_deleted_subdirs' \
255 ba580f68 2020-03-22 stsp > $testroot/stdout 2> $testroot/stderr)
257 ba580f68 2020-03-22 stsp local head_rev=`git_show_head $testroot/repo`
258 ba580f68 2020-03-22 stsp echo "D epsilon/zeta" > $testroot/stdout.expected
259 ba580f68 2020-03-22 stsp echo "D gamma/delta" >> $testroot/stdout.expected
260 a7648d7a 2019-06-02 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
262 ba580f68 2020-03-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
264 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
265 ba580f68 2020-03-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 ba580f68 2020-03-22 stsp test_done "$testroot" "$ret"
270 ba580f68 2020-03-22 stsp got tree -r $testroot/repo > $testroot/stdout
272 ba580f68 2020-03-22 stsp echo "alpha" > $testroot/stdout.expected
273 ba580f68 2020-03-22 stsp echo "beta" >> $testroot/stdout.expected
275 8ba6ba2d 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
277 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
278 a3df2849 2019-05-20 stsp diff -u $testroot/stdout.expected $testroot/stdout
280 8ba6ba2d 2019-05-14 stsp test_done "$testroot" "$ret"
283 f6cae3ed 2020-09-13 naddy test_commit_rejects_conflicted_file() {
284 461aee03 2019-06-29 stsp local testroot=`test_init commit_rejects_conflicted_file`
286 f363d663 2019-05-23 stsp local initial_rev=`git_show_head $testroot/repo`
288 f363d663 2019-05-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
290 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
291 f363d663 2019-05-23 stsp test_done "$testroot" "$ret"
295 f363d663 2019-05-23 stsp echo "modified alpha" > $testroot/wt/alpha
296 f363d663 2019-05-23 stsp (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
297 be94c032 2023-02-20 thomas local commit_id1=`git_show_head $testroot/repo`
299 f363d663 2019-05-23 stsp (cd $testroot/wt && got update -c $initial_rev > /dev/null)
301 f363d663 2019-05-23 stsp echo "modified alpha, too" > $testroot/wt/alpha
303 f363d663 2019-05-23 stsp echo "C alpha" > $testroot/stdout.expected
304 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
305 f363d663 2019-05-23 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
306 f363d663 2019-05-23 stsp echo >> $testroot/stdout.expected
307 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
309 f363d663 2019-05-23 stsp (cd $testroot/wt && got update > $testroot/stdout)
311 f363d663 2019-05-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
313 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
314 f363d663 2019-05-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
315 f363d663 2019-05-23 stsp test_done "$testroot" "$ret"
319 f363d663 2019-05-23 stsp (cd $testroot/wt && got commit -m 'commit it' > $testroot/stdout \
320 f363d663 2019-05-23 stsp 2> $testroot/stderr)
322 be94c032 2023-02-20 thomas if [ $ret -eq 0 ]; then
323 be94c032 2023-02-20 thomas echo "got commit succeeded unexpectedly"
324 be94c032 2023-02-20 thomas test_done "$testroot" "$ret"
328 be94c032 2023-02-20 thomas echo "C alpha" > $testroot/stdout.expected
329 f363d663 2019-05-23 stsp echo "got: cannot commit file in conflicted status" \
330 f363d663 2019-05-23 stsp > $testroot/stderr.expected
332 f363d663 2019-05-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
334 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
335 f363d663 2019-05-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
336 f363d663 2019-05-23 stsp test_done "$testroot" "$ret"
339 f363d663 2019-05-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
341 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
342 f363d663 2019-05-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
343 be94c032 2023-02-20 thomas test_done "$testroot" "$ret"
347 be94c032 2023-02-20 thomas (cd $testroot/wt && got commit -C -m 'commit it' > $testroot/stdout \
348 be94c032 2023-02-20 thomas 2> $testroot/stderr)
350 be94c032 2023-02-20 thomas if [ $ret -ne 0 ]; then
351 be94c032 2023-02-20 thomas echo "got commit failed unexpectedly"
352 be94c032 2023-02-20 thomas test_done "$testroot" "$ret"
356 be94c032 2023-02-20 thomas # make sure the conflicted commit produces a diff
357 be94c032 2023-02-20 thomas local conflict_commit=`git_show_head $testroot/repo`
358 be94c032 2023-02-20 thomas local blob_minus=`got tree -r $testroot/repo -c $commit_id1 -i | \
359 be94c032 2023-02-20 thomas grep 'alpha$' | cut -d' ' -f1`
360 be94c032 2023-02-20 thomas local blob_plus=`got tree -r $testroot/repo -c $conflict_commit -i | \
361 be94c032 2023-02-20 thomas grep 'alpha$' | cut -d' ' -f1`
363 be94c032 2023-02-20 thomas echo -n > $testroot/stderr.expected
364 be94c032 2023-02-20 thomas cmp -s $testroot/stderr.expected $testroot/stderr
366 be94c032 2023-02-20 thomas if [ $ret -ne 0 ]; then
367 be94c032 2023-02-20 thomas diff -u $testroot/stderr.expected $testroot/stderr
368 be94c032 2023-02-20 thomas test_done "$testroot" "$ret"
372 be94c032 2023-02-20 thomas (cd $testroot/wt && got diff -c master > $testroot/stdout)
374 be94c032 2023-02-20 thomas echo -n > $testroot/stdout.expected
375 be94c032 2023-02-20 thomas cat > $testroot/stdout.expected <<EOF
376 be94c032 2023-02-20 thomas diff $commit_id1 refs/heads/master
377 be94c032 2023-02-20 thomas commit - $commit_id1
378 be94c032 2023-02-20 thomas commit + $conflict_commit
379 be94c032 2023-02-20 thomas blob - $blob_minus
380 be94c032 2023-02-20 thomas blob + $blob_plus
381 be94c032 2023-02-20 thomas --- alpha
382 be94c032 2023-02-20 thomas +++ alpha
383 be94c032 2023-02-20 thomas @@ -1 +1,7 @@
384 be94c032 2023-02-20 thomas +<<<<<<< merged change: commit $commit_id1
385 be94c032 2023-02-20 thomas modified alpha
386 be94c032 2023-02-20 thomas +||||||| 3-way merge base: commit $initial_rev
389 be94c032 2023-02-20 thomas +modified alpha, too
393 be94c032 2023-02-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
395 be94c032 2023-02-20 thomas if [ $ret -ne 0 ]; then
396 be94c032 2023-02-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
397 be94c032 2023-02-20 thomas test_done "$testroot" "$ret"
401 be94c032 2023-02-20 thomas (cd $testroot/wt && got status > $testroot/stdout)
403 be94c032 2023-02-20 thomas echo -n > $testroot/stdout.expected
404 be94c032 2023-02-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
406 be94c032 2023-02-20 thomas if [ $ret -ne 0 ]; then
407 be94c032 2023-02-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
409 f363d663 2019-05-23 stsp test_done "$testroot" "$ret"
412 f6cae3ed 2020-09-13 naddy test_commit_single_file_multiple() {
413 1a36436d 2019-06-10 stsp local testroot=`test_init commit_single_file_multiple`
415 1a36436d 2019-06-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
417 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
418 1a36436d 2019-06-10 stsp test_done "$testroot" "$ret"
422 1a36436d 2019-06-10 stsp for i in 1 2 3 4; do
423 1a36436d 2019-06-10 stsp echo "modified alpha" >> $testroot/wt/alpha
425 1a36436d 2019-06-10 stsp (cd $testroot/wt && \
426 1a36436d 2019-06-10 stsp got commit -m "changed alpha" > $testroot/stdout)
428 1a36436d 2019-06-10 stsp local head_rev=`git_show_head $testroot/repo`
429 1a36436d 2019-06-10 stsp echo "M alpha" > $testroot/stdout.expected
430 1a36436d 2019-06-10 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
432 1a36436d 2019-06-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
434 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
435 1a36436d 2019-06-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
436 1a36436d 2019-06-10 stsp test_done "$testroot" "$ret"
441 1a36436d 2019-06-10 stsp test_done "$testroot" "0"
444 f6cae3ed 2020-09-13 naddy test_commit_added_and_modified_in_same_dir() {
445 4866d084 2019-07-10 stsp local testroot=`test_init commit_added_and_modified_in_same_dir`
447 4866d084 2019-07-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
449 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
450 4866d084 2019-07-10 stsp test_done "$testroot" "$ret"
454 4866d084 2019-07-10 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
455 4866d084 2019-07-10 stsp echo "new file" > $testroot/wt/epsilon/new
456 4866d084 2019-07-10 stsp (cd $testroot/wt && got add epsilon/new >/dev/null)
458 4866d084 2019-07-10 stsp (cd $testroot/wt && got commit \
459 4866d084 2019-07-10 stsp -m 'added and modified in same dir' > $testroot/stdout \
460 4866d084 2019-07-10 stsp 2> $testroot/stderr)
462 4866d084 2019-07-10 stsp local head_rev=`git_show_head $testroot/repo`
463 4866d084 2019-07-10 stsp echo "A epsilon/new" > $testroot/stdout.expected
464 4866d084 2019-07-10 stsp echo "M epsilon/zeta" >> $testroot/stdout.expected
465 4866d084 2019-07-10 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
467 e0233cea 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
469 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
470 e0233cea 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
472 e0233cea 2019-07-25 stsp test_done "$testroot" "$ret"
475 f6cae3ed 2020-09-13 naddy test_commit_path_prefix() {
476 e0233cea 2019-07-25 stsp local testroot=`test_init commit_path_prefix`
477 e0233cea 2019-07-25 stsp local commit1=`git_show_head $testroot/repo`
479 e0233cea 2019-07-25 stsp got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
481 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
482 e0233cea 2019-07-25 stsp test_done "$testroot" "$ret"
486 e0233cea 2019-07-25 stsp echo "modified delta" > $testroot/wt/delta
488 e0233cea 2019-07-25 stsp (cd $testroot/wt && got commit -m 'changed gamma/delta' > $testroot/stdout)
490 e0233cea 2019-07-25 stsp local commit2=`git_show_head $testroot/repo`
491 e0233cea 2019-07-25 stsp echo "M delta" > $testroot/stdout.expected
492 e0233cea 2019-07-25 stsp echo "Created commit $commit2" >> $testroot/stdout.expected
494 4866d084 2019-07-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
496 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
497 2b496619 2019-07-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
498 e0233cea 2019-07-25 stsp test_done "$testroot" "$ret"
502 e0233cea 2019-07-25 stsp echo "diff $commit1 $commit2" > $testroot/stdout.expected
503 9b4458b4 2022-06-26 thomas echo "commit - $commit1" >> $testroot/stdout.expected
504 9b4458b4 2022-06-26 thomas echo "commit + $commit2" >> $testroot/stdout.expected
505 e0233cea 2019-07-25 stsp echo -n 'blob - ' >> $testroot/stdout.expected
506 e0233cea 2019-07-25 stsp got tree -r $testroot/repo -c $commit1 -i gamma | grep 'delta$' \
507 e0233cea 2019-07-25 stsp | cut -d' ' -f 1 >> $testroot/stdout.expected
508 e0233cea 2019-07-25 stsp echo -n 'blob + ' >> $testroot/stdout.expected
509 e0233cea 2019-07-25 stsp got tree -r $testroot/repo -c $commit2 -i gamma | grep 'delta$' | \
510 e0233cea 2019-07-25 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
511 e0233cea 2019-07-25 stsp echo '--- gamma/delta' >> $testroot/stdout.expected
512 e0233cea 2019-07-25 stsp echo '+++ gamma/delta' >> $testroot/stdout.expected
513 e0233cea 2019-07-25 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
514 e0233cea 2019-07-25 stsp echo '-delta' >> $testroot/stdout.expected
515 e0233cea 2019-07-25 stsp echo '+modified delta' >> $testroot/stdout.expected
517 e0233cea 2019-07-25 stsp got diff -r $testroot/repo $commit1 $commit2 > $testroot/stdout
518 f2b0a8b0 2020-07-31 stsp cmp -s $testroot/stdout.expected $testroot/stdout
520 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
521 f2b0a8b0 2020-07-31 stsp diff -u $testroot/stdout.expected $testroot/stdout
522 f2b0a8b0 2020-07-31 stsp test_done "$testroot" "$ret"
526 f2b0a8b0 2020-07-31 stsp (cd $testroot/wt && got rm delta > /dev/null)
527 f2b0a8b0 2020-07-31 stsp echo new > $testroot/wt/new
528 f2b0a8b0 2020-07-31 stsp (cd $testroot/wt && got add new > /dev/null)
530 f2b0a8b0 2020-07-31 stsp (cd $testroot/wt && got commit -m 'remove gamma/delta; add gamma/new' \
531 f2b0a8b0 2020-07-31 stsp > $testroot/stdout)
533 f2b0a8b0 2020-07-31 stsp local commit3=`git_show_head $testroot/repo`
534 f2b0a8b0 2020-07-31 stsp echo "A new" > $testroot/stdout.expected
535 f2b0a8b0 2020-07-31 stsp echo "D delta" >> $testroot/stdout.expected
536 f2b0a8b0 2020-07-31 stsp echo "Created commit $commit3" >> $testroot/stdout.expected
538 f2b0a8b0 2020-07-31 stsp cmp -s $testroot/stdout.expected $testroot/stdout
540 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
541 f2b0a8b0 2020-07-31 stsp diff -u $testroot/stdout.expected $testroot/stdout
542 f2b0a8b0 2020-07-31 stsp test_done "$testroot" "$ret"
546 f2b0a8b0 2020-07-31 stsp echo "diff $commit2 $commit3" > $testroot/stdout.expected
547 9b4458b4 2022-06-26 thomas echo "commit - $commit2" >> $testroot/stdout.expected
548 9b4458b4 2022-06-26 thomas echo "commit + $commit3" >> $testroot/stdout.expected
549 f2b0a8b0 2020-07-31 stsp echo -n 'blob - ' >> $testroot/stdout.expected
550 f2b0a8b0 2020-07-31 stsp got tree -r $testroot/repo -c $commit2 -i gamma | grep 'delta$' \
551 f2b0a8b0 2020-07-31 stsp | cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \
552 f2b0a8b0 2020-07-31 stsp >> $testroot/stdout.expected
553 f2b0a8b0 2020-07-31 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
554 f2b0a8b0 2020-07-31 stsp echo '--- gamma/delta' >> $testroot/stdout.expected
555 f2b0a8b0 2020-07-31 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
556 f2b0a8b0 2020-07-31 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
557 f2b0a8b0 2020-07-31 stsp echo '-modified delta' >> $testroot/stdout.expected
558 f2b0a8b0 2020-07-31 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
559 f2b0a8b0 2020-07-31 stsp echo -n 'blob + ' >> $testroot/stdout.expected
560 f2b0a8b0 2020-07-31 stsp got tree -r $testroot/repo -c $commit3 -i gamma | grep 'new$' | \
561 f2b0a8b0 2020-07-31 stsp cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \
562 f2b0a8b0 2020-07-31 stsp >> $testroot/stdout.expected
563 f2b0a8b0 2020-07-31 stsp echo '--- /dev/null' >> $testroot/stdout.expected
564 f2b0a8b0 2020-07-31 stsp echo '+++ gamma/new' >> $testroot/stdout.expected
565 f2b0a8b0 2020-07-31 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
566 f2b0a8b0 2020-07-31 stsp echo '+new' >> $testroot/stdout.expected
568 f2b0a8b0 2020-07-31 stsp got diff -r $testroot/repo $commit2 $commit3 > $testroot/stdout
569 e0233cea 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
571 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
572 e0233cea 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
574 4866d084 2019-07-10 stsp test_done "$testroot" "$ret"
575 f2b0a8b0 2020-07-31 stsp return "$ret"
578 f6cae3ed 2020-09-13 naddy test_commit_dir_path() {
579 90e8619e 2019-07-25 stsp local testroot=`test_init commit_dir_path`
581 90e8619e 2019-07-25 stsp got checkout $testroot/repo $testroot/wt > /dev/null
583 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
584 90e8619e 2019-07-25 stsp test_done "$testroot" "$ret"
588 90e8619e 2019-07-25 stsp echo "modified alpha" > $testroot/wt/alpha
589 90e8619e 2019-07-25 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
591 90e8619e 2019-07-25 stsp (cd $testroot/wt && got commit -m 'changed zeta' epsilon \
592 90e8619e 2019-07-25 stsp > $testroot/stdout)
594 90e8619e 2019-07-25 stsp local head_rev=`git_show_head $testroot/repo`
595 90e8619e 2019-07-25 stsp echo "M epsilon/zeta" >> $testroot/stdout.expected
596 90e8619e 2019-07-25 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
598 90e8619e 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
600 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
601 90e8619e 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
602 90e8619e 2019-07-25 stsp test_done "$testroot" "$ret"
606 90e8619e 2019-07-25 stsp echo "M alpha" > $testroot/stdout.expected
607 90e8619e 2019-07-25 stsp (cd $testroot/wt && got status > $testroot/stdout)
608 90e8619e 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
610 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
611 90e8619e 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
613 90e8619e 2019-07-25 stsp test_done "$testroot" "$ret"
616 f6cae3ed 2020-09-13 naddy test_commit_selected_paths() {
617 5c1e53bc 2019-07-28 stsp local testroot=`test_init commit_selected_paths`
619 5c1e53bc 2019-07-28 stsp got checkout $testroot/repo $testroot/wt > /dev/null
621 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
622 5c1e53bc 2019-07-28 stsp test_done "$testroot" "$ret"
626 5c1e53bc 2019-07-28 stsp echo "modified alpha" > $testroot/wt/alpha
627 5c1e53bc 2019-07-28 stsp echo "modified delta" > $testroot/wt/gamma/delta
628 5c1e53bc 2019-07-28 stsp echo "modified zeta" > $testroot/wt/epsilon/zeta
629 5c1e53bc 2019-07-28 stsp (cd $testroot/wt && got rm beta >/dev/null)
630 5c1e53bc 2019-07-28 stsp echo "new file" > $testroot/wt/new
631 5c1e53bc 2019-07-28 stsp (cd $testroot/wt && got add new >/dev/null)
633 5c1e53bc 2019-07-28 stsp (cd $testroot/wt && got commit -m 'many paths' nonexistent alpha \
634 5c1e53bc 2019-07-28 stsp > $testroot/stdout 2> $testroot/stderr)
636 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
637 5c1e53bc 2019-07-28 stsp echo "commit succeeded unexpectedly" >&2
638 5c1e53bc 2019-07-28 stsp test_done "$testroot" "1"
641 5c1e53bc 2019-07-28 stsp echo "got: nonexistent: bad path" > $testroot/stderr.expected
643 5c1e53bc 2019-07-28 stsp cmp -s $testroot/stderr.expected $testroot/stderr
645 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
646 5c1e53bc 2019-07-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
647 5c1e53bc 2019-07-28 stsp test_done "$testroot" "$ret"
651 5c1e53bc 2019-07-28 stsp (cd $testroot/wt && got commit -m 'many paths' \
652 5c1e53bc 2019-07-28 stsp beta new gamma > $testroot/stdout)
654 5c1e53bc 2019-07-28 stsp local head_rev=`git_show_head $testroot/repo`
655 5c1e53bc 2019-07-28 stsp echo "A new" > $testroot/stdout.expected
656 5c1e53bc 2019-07-28 stsp echo "D beta" >> $testroot/stdout.expected
657 5c1e53bc 2019-07-28 stsp echo "M gamma/delta" >> $testroot/stdout.expected
658 5c1e53bc 2019-07-28 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
660 5c1e53bc 2019-07-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
662 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
663 5c1e53bc 2019-07-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
665 5c1e53bc 2019-07-28 stsp test_done "$testroot" "$ret"
668 f6cae3ed 2020-09-13 naddy test_commit_outside_refs_heads() {
669 916f288c 2019-07-30 stsp local testroot=`test_init commit_outside_refs_heads`
671 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c master refs/remotes/origin/master
673 916f288c 2019-07-30 stsp got checkout -b refs/remotes/origin/master \
674 916f288c 2019-07-30 stsp $testroot/repo $testroot/wt > /dev/null
676 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
677 916f288c 2019-07-30 stsp test_done "$testroot" "$ret"
681 916f288c 2019-07-30 stsp echo "modified alpha" > $testroot/wt/alpha
683 916f288c 2019-07-30 stsp (cd $testroot/wt && got commit -m 'change alpha' \
684 916f288c 2019-07-30 stsp > $testroot/stdout 2> $testroot/stderr)
686 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
687 916f288c 2019-07-30 stsp echo "commit succeeded unexpectedly" >&2
688 916f288c 2019-07-30 stsp test_done "$testroot" "1"
692 916f288c 2019-07-30 stsp echo -n > $testroot/stdout.expected
693 916f288c 2019-07-30 stsp cmp -s $testroot/stdout.expected $testroot/stdout
695 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
696 916f288c 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
697 916f288c 2019-07-30 stsp test_done "$testroot" "$ret"
701 916f288c 2019-07-30 stsp echo -n "got: will not commit to a branch outside the " \
702 916f288c 2019-07-30 stsp > $testroot/stderr.expected
703 916f288c 2019-07-30 stsp echo '"refs/heads/" reference namespace' \
704 916f288c 2019-07-30 stsp >> $testroot/stderr.expected
705 916f288c 2019-07-30 stsp cmp -s $testroot/stderr.expected $testroot/stderr
707 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
708 916f288c 2019-07-30 stsp diff -u $testroot/stderr.expected $testroot/stderr
710 916f288c 2019-07-30 stsp test_done "$testroot" "$ret"
713 f6cae3ed 2020-09-13 naddy test_commit_no_email() {
714 84792843 2019-08-09 stsp local testroot=`test_init commit_no_email`
715 ec9b5f0b 2022-07-19 thomas local errmsg=""
717 ec9b5f0b 2022-07-19 thomas errmsg="commit author's email address is required for"
718 ec9b5f0b 2022-07-19 thomas errmsg="$errmsg compatibility with Git"
720 84792843 2019-08-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
722 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
723 84792843 2019-08-09 stsp test_done "$testroot" "$ret"
727 84792843 2019-08-09 stsp echo "modified alpha" > $testroot/wt/alpha
728 84792843 2019-08-09 stsp (cd $testroot/wt && env GOT_AUTHOR=":flan_hacker:" \
729 84792843 2019-08-09 stsp got commit -m 'test no email' > $testroot/stdout \
730 84792843 2019-08-09 stsp 2> $testroot/stderr)
732 ec9b5f0b 2022-07-19 thomas printf "got: :flan_hacker:: %s\n" "$errmsg" > $testroot/stderr.expected
733 84792843 2019-08-09 stsp cmp -s $testroot/stderr.expected $testroot/stderr
735 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
736 84792843 2019-08-09 stsp diff -u $testroot/stderr.expected $testroot/stderr
737 84792843 2019-08-09 stsp test_done "$testroot" "$ret"
741 84792843 2019-08-09 stsp echo -n > $testroot/stdout.expected
742 84792843 2019-08-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
744 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
745 84792843 2019-08-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
746 ec9b5f0b 2022-07-19 thomas test_done "$testroot" $ret
750 ec9b5f0b 2022-07-19 thomas # try again with a newline inside the email
751 ec9b5f0b 2022-07-19 thomas (cd $testroot/wt \
752 ec9b5f0b 2022-07-19 thomas && FS=' ' env GOT_AUTHOR="$(printf "Flan <hack\ner>")" \
753 ec9b5f0b 2022-07-19 thomas got commit -m 'test invalid email' > $testroot/stdout \
754 ec9b5f0b 2022-07-19 thomas 2> $testroot/stderr)
756 ec9b5f0b 2022-07-19 thomas printf "got: Flan <hack\ner>: %s\n" "$errmsg" \
757 ec9b5f0b 2022-07-19 thomas > $testroot/stderr.expected
758 ec9b5f0b 2022-07-19 thomas cmp -s $testroot/stderr.expected $testroot/stderr
760 ec9b5f0b 2022-07-19 thomas if [ $ret -ne 0 ]; then
761 ec9b5f0b 2022-07-19 thomas diff -u $testroot/stderr.expected $testroot/stderr
762 ec9b5f0b 2022-07-19 thomas test_done "$testroot" $ret
766 ec9b5f0b 2022-07-19 thomas echo -n > $testroot/stdout.expected
767 ec9b5f0b 2022-07-19 thomas cmp -s $testroot/stdout.expected $testroot/stdout
769 ec9b5f0b 2022-07-19 thomas if [ $ret -ne 0 ]; then
770 ec9b5f0b 2022-07-19 thomas diff -u $testroot/stdout.expected $testroot/stdout
771 ec9b5f0b 2022-07-19 thomas test_done "$testroot" $ret
775 ec9b5f0b 2022-07-19 thomas # try again with a < inside the email
776 ec9b5f0b 2022-07-19 thomas (cd $testroot/wt && env GOT_AUTHOR="$(printf "Flan <ha<ker>")" \
777 ec9b5f0b 2022-07-19 thomas got commit -m 'test invalid email' > $testroot/stdout \
778 ec9b5f0b 2022-07-19 thomas 2> $testroot/stderr)
780 ec9b5f0b 2022-07-19 thomas printf "got: Flan <ha<ker>: %s\n" "$errmsg" > $testroot/stderr.expected
781 ec9b5f0b 2022-07-19 thomas cmp -s $testroot/stderr.expected $testroot/stderr
783 ec9b5f0b 2022-07-19 thomas if [ $ret -ne 0 ]; then
784 ec9b5f0b 2022-07-19 thomas diff -u $testroot/stderr.expected $testroot/stderr
785 ec9b5f0b 2022-07-19 thomas test_done "$testroot" $ret
789 ec9b5f0b 2022-07-19 thomas echo -n > $testroot/stdout.expected
790 ec9b5f0b 2022-07-19 thomas cmp -s $testroot/stdout.expected $testroot/stdout
792 ec9b5f0b 2022-07-19 thomas if [ $ret -ne 0 ]; then
793 ec9b5f0b 2022-07-19 thomas diff -u $testroot/stdout.expected $testroot/stdout
795 ec9b5f0b 2022-07-19 thomas test_done "$testroot" $ret
798 f6cae3ed 2020-09-13 naddy test_commit_tree_entry_sorting() {
799 6af1ccbd 2019-08-16 stsp local testroot=`test_init commit_tree_entry_sorting`
801 6af1ccbd 2019-08-16 stsp got checkout $testroot/repo $testroot/wt > /dev/null
803 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
804 6af1ccbd 2019-08-16 stsp test_done "$testroot" "$ret"
808 6af1ccbd 2019-08-16 stsp # Git's index gets corrupted when tree entries are written in the
809 6af1ccbd 2019-08-16 stsp # order defined by got_path_cmp() rather than Git's own ordering.
810 6af1ccbd 2019-08-16 stsp # Create a new tree where a directory "got" and a file "got-version"
811 6af1ccbd 2019-08-16 stsp # would sort in the wrong order according to Git's opinion.
812 6af1ccbd 2019-08-16 stsp mkdir $testroot/wt/got
813 6af1ccbd 2019-08-16 stsp touch $testroot/wt/got/foo
814 6af1ccbd 2019-08-16 stsp echo foo > $testroot/wt/got-version
815 6af1ccbd 2019-08-16 stsp echo zzz > $testroot/wt/zzz
816 6af1ccbd 2019-08-16 stsp (cd $testroot/wt && got add got-version got/foo zzz > /dev/null)
818 6af1ccbd 2019-08-16 stsp (cd $testroot/wt && got commit -m 'test' > /dev/null)
820 6af1ccbd 2019-08-16 stsp # Let git-fsck verify the newly written tree to make sure Git is happy
821 6af1ccbd 2019-08-16 stsp (cd $testroot/repo && git fsck --strict \
822 6af1ccbd 2019-08-16 stsp > $testroot/fsck.stdout 2> $testroot/fsck.stderr)
824 257add31 2020-09-09 stsp test_done "$testroot" "$ret"
827 18d1acad 2022-07-20 thomas test_commit_cmdline_author() {
828 18d1acad 2022-07-20 thomas local testroot=`test_init commit_cmdline_author`
830 18d1acad 2022-07-20 thomas got checkout $testroot/repo $testroot/wt > /dev/null
832 18d1acad 2022-07-20 thomas if [ $ret -ne 0 ]; then
833 18d1acad 2022-07-20 thomas test_done "$testroot" $ret
837 18d1acad 2022-07-20 thomas echo "modified alpha" > $testroot/wt/alpha
839 18d1acad 2022-07-20 thomas local author="Foo <foo@example.com>"
840 18d1acad 2022-07-20 thomas (cd $testroot/wt && got commit -A "$author" -m 'edit alpha') \
841 18d1acad 2022-07-20 thomas > /dev/null
843 18d1acad 2022-07-20 thomas if [ $ret -ne 0 ]; then
844 18d1acad 2022-07-20 thomas test_done "$testroot" $ret
848 18d1acad 2022-07-20 thomas (cd $testroot/repo && got log -l1 | egrep '^(from|via):') \
849 18d1acad 2022-07-20 thomas > $testroot/stdout
851 18d1acad 2022-07-20 thomas if [ $ret -ne 0 ]; then
852 18d1acad 2022-07-20 thomas test_done "$testroot" $ret
856 18d1acad 2022-07-20 thomas echo "from: $author" > $testroot/stdout.expected
857 18d1acad 2022-07-20 thomas echo "via: $GOT_AUTHOR" >> $testroot/stdout.expected
858 18d1acad 2022-07-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
860 18d1acad 2022-07-20 thomas if [ $ret -ne 0 ]; then
861 18d1acad 2022-07-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
863 18d1acad 2022-07-20 thomas test_done "$testroot" $ret
866 f6cae3ed 2020-09-13 naddy test_commit_gotconfig_author() {
867 257add31 2020-09-09 stsp local testroot=`test_init commit_gotconfig_author`
869 257add31 2020-09-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
871 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
872 257add31 2020-09-09 stsp test_done "$testroot" "$ret"
875 257add31 2020-09-09 stsp echo 'author "Flan Luck <flan_luck@openbsd.org>"' \
876 257add31 2020-09-09 stsp > $testroot/repo/.git/got.conf
878 257add31 2020-09-09 stsp echo "modified alpha" > $testroot/wt/alpha
879 257add31 2020-09-09 stsp (cd $testroot/wt && got commit -m 'test gotconfig author' > /dev/null)
881 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
882 257add31 2020-09-09 stsp test_done "$testroot" "$ret"
886 257add31 2020-09-09 stsp (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
888 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
889 257add31 2020-09-09 stsp test_done "$testroot" "$ret"
893 257add31 2020-09-09 stsp echo "from: Flan Luck <flan_luck@openbsd.org>" \
894 50b0790e 2020-09-11 stsp > $testroot/stdout.expected
895 50b0790e 2020-09-11 stsp cmp -s $testroot/stdout.expected $testroot/stdout
897 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
898 50b0790e 2020-09-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
900 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
903 f6cae3ed 2020-09-13 naddy test_commit_gotconfig_worktree_author() {
904 50b0790e 2020-09-11 stsp local testroot=`test_init commit_gotconfig_worktree_author`
906 50b0790e 2020-09-11 stsp got checkout $testroot/repo $testroot/wt > /dev/null
908 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
909 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
912 50b0790e 2020-09-11 stsp echo 'author "Flan Luck <flan_luck@openbsd.org>"' \
913 50b0790e 2020-09-11 stsp > $testroot/repo/.git/got.conf
914 50b0790e 2020-09-11 stsp echo 'author "Flan Squee <flan_squee@openbsd.org>"' \
915 50b0790e 2020-09-11 stsp > $testroot/wt/.got/got.conf
917 50b0790e 2020-09-11 stsp echo "modified alpha" > $testroot/wt/alpha
918 50b0790e 2020-09-11 stsp (cd $testroot/wt && got commit -m 'test gotconfig author' > /dev/null)
920 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
921 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
925 50b0790e 2020-09-11 stsp (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
927 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
928 50b0790e 2020-09-11 stsp test_done "$testroot" "$ret"
932 50b0790e 2020-09-11 stsp echo "from: Flan Squee <flan_squee@openbsd.org>" \
933 257add31 2020-09-09 stsp > $testroot/stdout.expected
934 257add31 2020-09-09 stsp cmp -s $testroot/stdout.expected $testroot/stdout
936 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
937 257add31 2020-09-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
939 6af1ccbd 2019-08-16 stsp test_done "$testroot" "$ret"
942 f6cae3ed 2020-09-13 naddy test_commit_gitconfig_author() {
943 aba9c984 2019-09-08 stsp local testroot=`test_init commit_gitconfig_author`
945 aba9c984 2019-09-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
947 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
948 aba9c984 2019-09-08 stsp test_done "$testroot" "$ret"
952 aba9c984 2019-09-08 stsp (cd $testroot/repo && git config user.name 'Flan Luck')
953 aba9c984 2019-09-08 stsp (cd $testroot/repo && git config user.email 'flan_luck@openbsd.org')
955 aba9c984 2019-09-08 stsp echo "modified alpha" > $testroot/wt/alpha
957 1f240092 2022-07-24 thomas # unset in a subshell to avoid affecting our environment
958 1f240092 2022-07-24 thomas (unset GOT_IGNORE_GITCONFIG && cd $testroot/wt && \
959 1f240092 2022-07-24 thomas got commit -m 'test gitconfig author' > /dev/null)
961 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
962 aba9c984 2019-09-08 stsp test_done "$testroot" "$ret"
966 aba9c984 2019-09-08 stsp (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
968 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
969 aba9c984 2019-09-08 stsp test_done "$testroot" "$ret"
973 aba9c984 2019-09-08 stsp echo "from: Flan Luck <flan_luck@openbsd.org>" \
974 aba9c984 2019-09-08 stsp > $testroot/stdout.expected
975 aba9c984 2019-09-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
977 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
978 aba9c984 2019-09-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
979 40d0d6a4 2023-02-20 thomas test_done "$testroot" "$ret"
983 40d0d6a4 2023-02-20 thomas # retry with spaces in the git config
984 40d0d6a4 2023-02-20 thomas ed -s "$testroot/repo/.git/config" <<EOF
988 40d0d6a4 2023-02-20 thomas echo "modified again" > $testroot/wt/alpha
990 40d0d6a4 2023-02-20 thomas # unset in a subshell to avoid affecting our environment
991 40d0d6a4 2023-02-20 thomas (unset GOT_IGNORE_GITCONFIG && cd "$testroot/wt" && \
992 40d0d6a4 2023-02-20 thomas got commit -m 'test gitconfig author again' >/dev/null)
994 40d0d6a4 2023-02-20 thomas if [ $ret -ne 0 ]; then
995 40d0d6a4 2023-02-20 thomas test_done "$testroot" "$ret"
999 40d0d6a4 2023-02-20 thomas (cd "$testroot/repo" && got log -l1 | grep ^from: > $testroot/stdout)
1001 40d0d6a4 2023-02-20 thomas if [ $ret -ne 0 ]; then
1002 40d0d6a4 2023-02-20 thomas test_done "$testroot" "$ret"
1003 40d0d6a4 2023-02-20 thomas return 1
1006 40d0d6a4 2023-02-20 thomas echo "from: Flan Luck <flan_luck@openbsd.org>" \
1007 40d0d6a4 2023-02-20 thomas > $testroot/stdout.expected
1008 40d0d6a4 2023-02-20 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1010 40d0d6a4 2023-02-20 thomas if [ $ret -ne 0 ]; then
1011 40d0d6a4 2023-02-20 thomas diff -u $testroot/stdout.expected $testroot/stdout
1013 aba9c984 2019-09-08 stsp test_done "$testroot" "$ret"
1016 f6cae3ed 2020-09-13 naddy test_commit_xbit_change() {
1017 1ebedb77 2019-10-19 stsp local testroot=`test_init commit_xbit_change`
1019 1ebedb77 2019-10-19 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1021 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1022 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1026 1ebedb77 2019-10-19 stsp chmod +x $testroot/wt/alpha
1028 1ebedb77 2019-10-19 stsp echo 'm alpha' > $testroot/stdout.expected
1029 1ebedb77 2019-10-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
1031 1ebedb77 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1033 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1034 1ebedb77 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1035 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1039 1ebedb77 2019-10-19 stsp (cd $testroot/wt && got commit -mx > $testroot/stdout)
1041 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1042 1ebedb77 2019-10-19 stsp echo "got commit failed unexpectedly"
1043 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1047 1ebedb77 2019-10-19 stsp local commit_id=`git_show_head $testroot/repo`
1048 1ebedb77 2019-10-19 stsp echo 'm alpha' > $testroot/stdout.expected
1049 1ebedb77 2019-10-19 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1050 1ebedb77 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1052 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1053 1ebedb77 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1054 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1058 1ebedb77 2019-10-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
1060 1ebedb77 2019-10-19 stsp echo -n > $testroot/stdout.expected
1061 1ebedb77 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1063 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1064 1ebedb77 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1065 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1069 1ebedb77 2019-10-19 stsp chmod -x $testroot/wt/alpha
1071 1ebedb77 2019-10-19 stsp echo 'm alpha' > $testroot/stdout.expected
1072 1ebedb77 2019-10-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
1074 1ebedb77 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1076 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1077 1ebedb77 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1078 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1082 1ebedb77 2019-10-19 stsp (cd $testroot/wt && got commit -mx > $testroot/stdout)
1084 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1085 1ebedb77 2019-10-19 stsp echo "got commit failed unexpectedly"
1086 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1090 1ebedb77 2019-10-19 stsp local commit_id=`git_show_head $testroot/repo`
1091 1ebedb77 2019-10-19 stsp echo 'm alpha' > $testroot/stdout.expected
1092 1ebedb77 2019-10-19 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1093 1ebedb77 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1095 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1096 1ebedb77 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1097 1ebedb77 2019-10-19 stsp test_done "$testroot" "$ret"
1101 1ebedb77 2019-10-19 stsp chmod +x $testroot/wt/alpha
1103 1ebedb77 2019-10-19 stsp echo 'm alpha' > $testroot/stdout.expected
1104 1ebedb77 2019-10-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
1106 f7b97ccb 2020-04-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1108 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1109 f7b97ccb 2020-04-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1111 f7b97ccb 2020-04-14 stsp test_done "$testroot" "$ret"
1114 f6cae3ed 2020-09-13 naddy commit_check_mode() {
1115 f7b97ccb 2020-04-14 stsp local mode="$1"
1116 f7b97ccb 2020-04-14 stsp local expected_mode="$2"
1118 f7b97ccb 2020-04-14 stsp chmod 644 $testroot/wt/alpha
1119 f7b97ccb 2020-04-14 stsp echo a >> $testroot/wt/alpha
1120 f7b97ccb 2020-04-14 stsp chmod $mode $testroot/wt/alpha
1122 f7b97ccb 2020-04-14 stsp (cd $testroot/wt && got commit -mm > $testroot/stdout)
1124 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1125 f7b97ccb 2020-04-14 stsp echo "got commit failed unexpectedly"
1126 f7b97ccb 2020-04-14 stsp test_done "$testroot" "$ret"
1130 f7b97ccb 2020-04-14 stsp local commit_id=`git_show_head $testroot/repo`
1131 f7b97ccb 2020-04-14 stsp echo 'M alpha' > $testroot/stdout.expected
1132 f7b97ccb 2020-04-14 stsp echo "Created commit $commit_id" >> $testroot/stdout.expected
1133 f7b97ccb 2020-04-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1135 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1136 f7b97ccb 2020-04-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
1137 f7b97ccb 2020-04-14 stsp test_done "$testroot" "$ret"
1141 f7b97ccb 2020-04-14 stsp local tree_id=$(got cat -r $testroot/repo $commit_id | \
1142 f7b97ccb 2020-04-14 stsp grep ^tree | cut -d' ' -f2)
1143 f7b97ccb 2020-04-14 stsp local alpha_id=$(got cat -r $testroot/repo $tree_id | \
1144 f7b97ccb 2020-04-14 stsp grep 'alpha$' | cut -d' ' -f1)
1145 f7b97ccb 2020-04-14 stsp echo "$alpha_id $expected_mode alpha" > $testroot/stdout.expected
1146 f7b97ccb 2020-04-14 stsp got cat -r $testroot/repo $tree_id | grep 'alpha$' > $testroot/stdout
1147 1ebedb77 2019-10-19 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1149 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1150 1ebedb77 2019-10-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
1152 f7b97ccb 2020-04-14 stsp return $ret
1155 f6cae3ed 2020-09-13 naddy test_commit_normalizes_filemodes() {
1156 f7b97ccb 2020-04-14 stsp local testroot=`test_init commit_normalizes_filemodes`
1158 f7b97ccb 2020-04-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1160 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1161 f7b97ccb 2020-04-14 stsp test_done "$testroot" "$ret"
1165 f7b97ccb 2020-04-14 stsp modes="600 400 460 640 440 660 444 666"
1166 f7b97ccb 2020-04-14 stsp for m in $modes; do
1167 f7b97ccb 2020-04-14 stsp commit_check_mode "$m" "0100644"
1169 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1173 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1174 f7b97ccb 2020-04-14 stsp test_done "$testroot" "$ret"
1177 f7b97ccb 2020-04-14 stsp modes="700 500 570 750 550 770 555 777"
1178 f7b97ccb 2020-04-14 stsp for m in $modes; do
1179 f7b97ccb 2020-04-14 stsp commit_check_mode "$m" "0100755"
1181 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1185 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1186 f7b97ccb 2020-04-14 stsp test_done "$testroot" "$ret"
1189 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1192 f6cae3ed 2020-09-13 naddy test_commit_with_unrelated_submodule() {
1193 e7303626 2020-05-14 stsp local testroot=`test_init commit_with_unrelated_submodule`
1195 e7303626 2020-05-14 stsp make_single_file_repo $testroot/repo2 foo
1197 bf3ab206 2022-10-24 thomas (cd $testroot/repo && git -c protocol.file.allow=always \
1198 bf3ab206 2022-10-24 thomas submodule -q add ../repo2)
1199 e7303626 2020-05-14 stsp (cd $testroot/repo && git commit -q -m 'adding submodule')
1201 e7303626 2020-05-14 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1203 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1204 7aadece8 2020-05-17 stsp echo "checkout failed unexpectedly" >&2
1205 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
1209 e7303626 2020-05-14 stsp echo "modified alpha" > $testroot/wt/alpha
1211 7aadece8 2020-05-17 stsp echo "" > $testroot/stdout.expected
1213 74ad335c 2020-06-23 stsp (cd $testroot/wt && got commit -m 'modify alpha' > $testroot/stdout)
1215 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1216 7aadece8 2020-05-17 stsp echo "commit failed unexpectedly" >&2
1217 7aadece8 2020-05-17 stsp test_done "$testroot" "$ret"
1221 7aadece8 2020-05-17 stsp local head_rev=`git_show_head $testroot/repo`
1222 7aadece8 2020-05-17 stsp echo "M alpha" > $testroot/stdout.expected
1223 7aadece8 2020-05-17 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1225 3d9a4ec4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1227 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1228 3d9a4ec4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1230 3d9a4ec4 2020-07-23 stsp test_done "$testroot" "$ret"
1233 f6cae3ed 2020-09-13 naddy check_symlinks() {
1234 bd6aa359 2020-07-23 stsp local wtpath="$1"
1235 bd6aa359 2020-07-23 stsp if ! [ -h $wtpath/alpha.link ]; then
1236 bd6aa359 2020-07-23 stsp echo "alpha.link is not a symlink"
1240 bd6aa359 2020-07-23 stsp readlink $wtpath/alpha.link > $testroot/stdout
1241 bd6aa359 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1242 bd6aa359 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1244 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1245 bd6aa359 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1249 bd6aa359 2020-07-23 stsp if ! [ -h $wtpath/epsilon.link ]; then
1250 bd6aa359 2020-07-23 stsp echo "epsilon.link is not a symlink"
1254 bd6aa359 2020-07-23 stsp readlink $wtpath/epsilon.link > $testroot/stdout
1255 bd6aa359 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1256 3d9a4ec4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1258 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1259 3d9a4ec4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1263 bd6aa359 2020-07-23 stsp if [ -h $wtpath/passwd.link ]; then
1264 bd6aa359 2020-07-23 stsp echo -n "passwd.link is a symlink and points outside of work tree: " >&2
1265 bd6aa359 2020-07-23 stsp readlink $wtpath/passwd.link >&2
1269 bd6aa359 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1270 bd6aa359 2020-07-23 stsp cp $wtpath/passwd.link $testroot/content
1272 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1273 bd6aa359 2020-07-23 stsp echo "cp command failed unexpectedly" >&2
1277 bd6aa359 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1279 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1280 bd6aa359 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1284 bd6aa359 2020-07-23 stsp readlink $wtpath/epsilon/beta.link > $testroot/stdout
1285 bd6aa359 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
1286 3d9a4ec4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1288 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1289 3d9a4ec4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1293 bd6aa359 2020-07-23 stsp readlink $wtpath/nonexistent.link > $testroot/stdout
1294 bd6aa359 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1295 7aadece8 2020-05-17 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1297 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1298 7aadece8 2020-05-17 stsp diff -u $testroot/stdout.expected $testroot/stdout
1305 f6cae3ed 2020-09-13 naddy test_commit_symlink() {
1306 bd6aa359 2020-07-23 stsp local testroot=`test_init commit_symlink`
1308 bd6aa359 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1310 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1311 3d9a4ec4 2020-07-23 stsp test_done "$testroot" "$ret"
1315 bd6aa359 2020-07-23 stsp (cd $testroot/wt && ln -s alpha alpha.link)
1316 bd6aa359 2020-07-23 stsp (cd $testroot/wt && ln -s epsilon epsilon.link)
1317 bd6aa359 2020-07-23 stsp (cd $testroot/wt && ln -s /etc/passwd passwd.link)
1318 bd6aa359 2020-07-23 stsp (cd $testroot/wt && ln -s ../beta epsilon/beta.link)
1319 bd6aa359 2020-07-23 stsp (cd $testroot/wt && ln -s nonexistent nonexistent.link)
1320 bd6aa359 2020-07-23 stsp (cd $testroot/wt && got add alpha.link epsilon.link passwd.link \
1321 bd6aa359 2020-07-23 stsp epsilon/beta.link nonexistent.link > /dev/null)
1323 35213c7c 2020-07-23 stsp (cd $testroot/wt && got commit -m 'test commit_symlink' \
1324 35213c7c 2020-07-23 stsp > $testroot/stdout 2> $testroot/stderr)
1326 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1327 35213c7c 2020-07-23 stsp echo "got commit succeeded unexpectedly" >&2
1328 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
1331 35213c7c 2020-07-23 stsp echo -n "got: $testroot/wt/passwd.link: " > $testroot/stderr.expected
1332 35213c7c 2020-07-23 stsp echo "symbolic link points outside of paths under version control" \
1333 35213c7c 2020-07-23 stsp >> $testroot/stderr.expected
1334 35213c7c 2020-07-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1336 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1337 35213c7c 2020-07-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
1338 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
1342 35213c7c 2020-07-23 stsp (cd $testroot/wt && got commit -S -m 'test commit_symlink' \
1343 35213c7c 2020-07-23 stsp > $testroot/stdout)
1345 bd6aa359 2020-07-23 stsp local head_rev=`git_show_head $testroot/repo`
1346 bd6aa359 2020-07-23 stsp echo "A alpha.link" > $testroot/stdout.expected
1347 bd6aa359 2020-07-23 stsp echo "A epsilon.link" >> $testroot/stdout.expected
1348 bd6aa359 2020-07-23 stsp echo "A nonexistent.link" >> $testroot/stdout.expected
1349 bd6aa359 2020-07-23 stsp echo "A passwd.link" >> $testroot/stdout.expected
1350 bd6aa359 2020-07-23 stsp echo "A epsilon/beta.link" >> $testroot/stdout.expected
1351 bd6aa359 2020-07-23 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1353 3d9a4ec4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1355 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1356 3d9a4ec4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1357 3d9a4ec4 2020-07-23 stsp test_done "$testroot" "$ret"
1361 bd6aa359 2020-07-23 stsp # verify created in-repository tree
1362 bd6aa359 2020-07-23 stsp got checkout $testroot/repo $testroot/wt2 > /dev/null
1364 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1365 bd6aa359 2020-07-23 stsp test_done "$testroot" "$ret"
1368 bd6aa359 2020-07-23 stsp check_symlinks $testroot/wt2
1370 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1371 bd6aa359 2020-07-23 stsp test_done "$testroot" "$ret"
1375 75f0a0fb 2020-07-23 stsp if ! [ -h $testroot/wt/passwd.link ]; then
1376 75f0a0fb 2020-07-23 stsp echo 'passwd.link is not a symlink' >&2
1377 75f0a0fb 2020-07-23 stsp test_done "$testroot" 1
1381 75f0a0fb 2020-07-23 stsp # 'got update' should reinstall passwd.link as a regular file
1382 75f0a0fb 2020-07-23 stsp (cd $testroot/wt && got update > /dev/null)
1383 bd6aa359 2020-07-23 stsp check_symlinks $testroot/wt
1385 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1386 5a1fbc73 2020-07-23 stsp test_done "$testroot" "$ret"
1390 88fb31d4 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
1391 dd6165e4 2021-09-21 thomas.ad (cd $testroot/wt && ln -sfT gamma epsilon.link)
1392 88fb31d4 2020-07-23 stsp rm $testroot/wt/epsilon/beta.link
1393 88fb31d4 2020-07-23 stsp echo "this is a regular file" > $testroot/wt/epsilon/beta.link
1394 88fb31d4 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
1395 35213c7c 2020-07-23 stsp (cd $testroot/wt && got add dotgotbar.link > /dev/null)
1396 88fb31d4 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
1397 88fb31d4 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta zeta.link)
1398 88fb31d4 2020-07-23 stsp (cd $testroot/wt && ln -sf alpha new.link)
1399 88fb31d4 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
1401 35213c7c 2020-07-23 stsp (cd $testroot/wt && got commit -m 'test commit_symlink' \
1402 35213c7c 2020-07-23 stsp > $testroot/stdout 2> $testroot/stderr)
1404 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1405 35213c7c 2020-07-23 stsp echo "got commit succeeded unexpectedly" >&2
1406 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
1409 35213c7c 2020-07-23 stsp echo -n "got: $testroot/wt/dotgotbar.link: " > $testroot/stderr.expected
1410 35213c7c 2020-07-23 stsp echo "symbolic link points outside of paths under version control" \
1411 35213c7c 2020-07-23 stsp >> $testroot/stderr.expected
1412 35213c7c 2020-07-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1414 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1415 35213c7c 2020-07-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
1416 35213c7c 2020-07-23 stsp test_done "$testroot" "$ret"
1420 35213c7c 2020-07-23 stsp (cd $testroot/wt && got commit -S -m 'test commit_symlink' \
1421 35213c7c 2020-07-23 stsp > $testroot/stdout)
1423 88fb31d4 2020-07-23 stsp local head_rev=`git_show_head $testroot/repo`
1424 35213c7c 2020-07-23 stsp echo "A dotgotbar.link" > $testroot/stdout.expected
1425 35213c7c 2020-07-23 stsp echo "A new.link" >> $testroot/stdout.expected
1426 88fb31d4 2020-07-23 stsp echo "M alpha.link" >> $testroot/stdout.expected
1427 88fb31d4 2020-07-23 stsp echo "M epsilon/beta.link" >> $testroot/stdout.expected
1428 88fb31d4 2020-07-23 stsp echo "M epsilon.link" >> $testroot/stdout.expected
1429 88fb31d4 2020-07-23 stsp echo "D nonexistent.link" >> $testroot/stdout.expected
1430 88fb31d4 2020-07-23 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1432 88fb31d4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1434 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1435 88fb31d4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1436 88fb31d4 2020-07-23 stsp test_done "$testroot" "$ret"
1440 88fb31d4 2020-07-23 stsp got tree -r $testroot/repo -c $head_rev -R > $testroot/stdout
1441 88fb31d4 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1443 88fb31d4 2020-07-23 stsp alpha.link@ -> beta
1445 35213c7c 2020-07-23 stsp dotgotbar.link@ -> .got/bar
1447 88fb31d4 2020-07-23 stsp epsilon/beta.link
1448 88fb31d4 2020-07-23 stsp epsilon/zeta
1449 88fb31d4 2020-07-23 stsp epsilon.link@ -> gamma
1451 88fb31d4 2020-07-23 stsp gamma/delta
1452 88fb31d4 2020-07-23 stsp new.link@ -> alpha
1453 88fb31d4 2020-07-23 stsp passwd.link@ -> /etc/passwd
1455 88fb31d4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1457 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1458 88fb31d4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1460 88fb31d4 2020-07-23 stsp test_done "$testroot" "$ret"
1463 f6cae3ed 2020-09-13 naddy test_commit_fix_bad_symlink() {
1464 5a1fbc73 2020-07-23 stsp local testroot=`test_init commit_fix_bad_symlink`
1466 5a1fbc73 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1468 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1469 5a1fbc73 2020-07-23 stsp echo "got checkout failed unexpectedly" >&2
1470 5a1fbc73 2020-07-23 stsp test_done "$testroot" "$ret"
1474 5a1fbc73 2020-07-23 stsp (cd $testroot/wt && ln -s /etc/passwd passwd.link)
1475 5a1fbc73 2020-07-23 stsp (cd $testroot/wt && got add passwd.link > /dev/null)
1477 35213c7c 2020-07-23 stsp (cd $testroot/wt && got commit -S -m 'commit bad symlink' \
1478 35213c7c 2020-07-23 stsp > $testroot/stdout)
1480 75f0a0fb 2020-07-23 stsp if ! [ -h $testroot/wt/passwd.link ]; then
1481 75f0a0fb 2020-07-23 stsp echo 'passwd.link is not a symlink' >&2
1482 75f0a0fb 2020-07-23 stsp test_done "$testroot" 1
1485 75f0a0fb 2020-07-23 stsp (cd $testroot/wt && got update >/dev/null)
1486 5a1fbc73 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1487 5a1fbc73 2020-07-23 stsp echo "passwd.link is a symlink but should be a regular file" >&2
1488 5a1fbc73 2020-07-23 stsp test_done "$testroot" "1"
1492 5a1fbc73 2020-07-23 stsp # create another work tree which will contain the "bad" symlink
1493 5a1fbc73 2020-07-23 stsp got checkout $testroot/repo $testroot/wt2 > /dev/null
1495 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1496 5a1fbc73 2020-07-23 stsp echo "got checkout failed unexpectedly" >&2
1497 5a1fbc73 2020-07-23 stsp test_done "$testroot" "$ret"
1501 5a1fbc73 2020-07-23 stsp # change "bad" symlink back into a "good" symlink
1502 dd6165e4 2021-09-21 thomas.ad (cd $testroot/wt && ln -sfT alpha passwd.link)
1504 5a1fbc73 2020-07-23 stsp (cd $testroot/wt && got commit -m 'fix bad symlink' \
1505 5a1fbc73 2020-07-23 stsp > $testroot/stdout)
1507 5a1fbc73 2020-07-23 stsp local head_rev=`git_show_head $testroot/repo`
1508 5a1fbc73 2020-07-23 stsp echo "M passwd.link" > $testroot/stdout.expected
1509 5a1fbc73 2020-07-23 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1511 5a1fbc73 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1513 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1514 5a1fbc73 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1515 bd6aa359 2020-07-23 stsp test_done "$testroot" "$ret"
1519 5a1fbc73 2020-07-23 stsp if ! [ -h $testroot/wt/passwd.link ]; then
1520 5a1fbc73 2020-07-23 stsp echo 'passwd.link is not a symlink' >&2
1521 5a1fbc73 2020-07-23 stsp test_done "$testroot" 1
1525 5a1fbc73 2020-07-23 stsp readlink $testroot/wt/passwd.link > $testroot/stdout
1526 5a1fbc73 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1527 5a1fbc73 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1529 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1530 5a1fbc73 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1534 5a1fbc73 2020-07-23 stsp # Update the other work tree; the bad symlink should be fixed
1535 5a1fbc73 2020-07-23 stsp (cd $testroot/wt2 && got update > /dev/null)
1537 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1538 5a1fbc73 2020-07-23 stsp echo "got checkout failed unexpectedly" >&2
1539 5a1fbc73 2020-07-23 stsp test_done "$testroot" "$ret"
1543 5a1fbc73 2020-07-23 stsp if ! [ -h $testroot/wt2/passwd.link ]; then
1544 5a1fbc73 2020-07-23 stsp echo 'passwd.link is not a symlink' >&2
1545 5a1fbc73 2020-07-23 stsp test_done "$testroot" 1
1549 5a1fbc73 2020-07-23 stsp readlink $testroot/wt2/passwd.link > $testroot/stdout
1550 5a1fbc73 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1551 5a1fbc73 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1553 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1554 5a1fbc73 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1558 bd6aa359 2020-07-23 stsp test_done "$testroot" "0"
1561 28cf319f 2021-01-28 stsp test_commit_prepared_logmsg() {
1562 28cf319f 2021-01-28 stsp local testroot=`test_init commit_prepared_logmsg`
1564 28cf319f 2021-01-28 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1566 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1567 28cf319f 2021-01-28 stsp test_done "$testroot" "$ret"
1571 28cf319f 2021-01-28 stsp echo "modified alpha" > $testroot/wt/alpha
1572 28cf319f 2021-01-28 stsp (cd $testroot/wt && got rm beta >/dev/null)
1573 28cf319f 2021-01-28 stsp echo "new file" > $testroot/wt/new
1574 28cf319f 2021-01-28 stsp (cd $testroot/wt && got add new >/dev/null)
1576 28cf319f 2021-01-28 stsp echo 'test commit_prepared_logmsg' > $testroot/logmsg
1578 28cf319f 2021-01-28 stsp cat > $testroot/editor.sh <<EOF
1580 c206b220 2021-10-09 thomas SOPTS='-i ""'
1581 c206b220 2021-10-09 thomas [ "\$OSTYPE" = "linux-gnu" ] && SOPTS="-i"
1582 c206b220 2021-10-09 thomas sed "\$SOPTS" -e 's/foo/bar/' "\$1"
1584 28cf319f 2021-01-28 stsp chmod +x $testroot/editor.sh
1586 8e09a168 2021-06-17 tracey (cd $testroot/wt && env VISUAL="$testroot/editor.sh" \
1587 28cf319f 2021-01-28 stsp got commit -F "$testroot/logmsg" > $testroot/stdout)
1589 28cf319f 2021-01-28 stsp local head_rev=`git_show_head $testroot/repo`
1590 28cf319f 2021-01-28 stsp echo "A new" > $testroot/stdout.expected
1591 28cf319f 2021-01-28 stsp echo "M alpha" >> $testroot/stdout.expected
1592 28cf319f 2021-01-28 stsp echo "D beta" >> $testroot/stdout.expected
1593 28cf319f 2021-01-28 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1595 28cf319f 2021-01-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1597 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1598 28cf319f 2021-01-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
1599 28cf319f 2021-01-28 stsp test_done "$testroot" "$ret"
1603 28cf319f 2021-01-28 stsp local author_time=`git_show_author_time $testroot/repo`
1604 fa37079f 2021-10-09 thomas local prev_LC_TIME="$LC_TIME"
1605 fa37079f 2021-10-09 thomas export LC_TIME=C
1606 fa37079f 2021-10-09 thomas d=`date -u -d "@$author_time" +"%a %b %e %X %Y UTC"`
1607 fa37079f 2021-10-09 thomas LC_TIME="$prev_LC_TIME"
1608 28cf319f 2021-01-28 stsp echo "-----------------------------------------------" > $testroot/stdout.expected
1609 28cf319f 2021-01-28 stsp echo "commit $head_rev (master)" >> $testroot/stdout.expected
1610 28cf319f 2021-01-28 stsp echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
1611 28cf319f 2021-01-28 stsp echo "date: $d" >> $testroot/stdout.expected
1612 28cf319f 2021-01-28 stsp echo " " >> $testroot/stdout.expected
1613 28cf319f 2021-01-28 stsp echo " test commit_prepared_logmsg" >> $testroot/stdout.expected
1614 28cf319f 2021-01-28 stsp echo " " >> $testroot/stdout.expected
1616 28cf319f 2021-01-28 stsp (cd $testroot/wt && got log -l 1 > $testroot/stdout)
1617 28cf319f 2021-01-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1619 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1620 28cf319f 2021-01-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
1621 28cf319f 2021-01-28 stsp test_done "$testroot" "$ret"
1625 28cf319f 2021-01-28 stsp echo "modified alpha again" > $testroot/wt/alpha
1627 28cf319f 2021-01-28 stsp echo 'test commit_prepared_logmsg non-interactive' \
1628 28cf319f 2021-01-28 stsp > $testroot/logmsg
1630 28cf319f 2021-01-28 stsp (cd $testroot/wt && got commit -N -F "$testroot/logmsg" \
1631 28cf319f 2021-01-28 stsp > $testroot/stdout)
1633 28cf319f 2021-01-28 stsp local head_rev=`git_show_head $testroot/repo`
1634 28cf319f 2021-01-28 stsp echo "M alpha" > $testroot/stdout.expected
1635 28cf319f 2021-01-28 stsp echo "Created commit $head_rev" >> $testroot/stdout.expected
1637 28cf319f 2021-01-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1639 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1640 28cf319f 2021-01-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
1641 28cf319f 2021-01-28 stsp test_done "$testroot" "$ret"
1645 28cf319f 2021-01-28 stsp local author_time=`git_show_author_time $testroot/repo`
1646 fa37079f 2021-10-09 thomas local prev_LC_TIME="$LC_TIME"
1647 fa37079f 2021-10-09 thomas export LC_TIME=C
1648 fa37079f 2021-10-09 thomas d=`date -u -d "@$author_time" +"%a %b %e %X %Y UTC"`
1649 fa37079f 2021-10-09 thomas LC_TIME="$prev_LC_TIME"
1650 28cf319f 2021-01-28 stsp echo "-----------------------------------------------" \
1651 28cf319f 2021-01-28 stsp > $testroot/stdout.expected
1652 28cf319f 2021-01-28 stsp echo "commit $head_rev (master)" >> $testroot/stdout.expected
1653 28cf319f 2021-01-28 stsp echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
1654 28cf319f 2021-01-28 stsp echo "date: $d" >> $testroot/stdout.expected
1655 28cf319f 2021-01-28 stsp echo " " >> $testroot/stdout.expected
1656 28cf319f 2021-01-28 stsp echo " test commit_prepared_logmsg non-interactive" \
1657 28cf319f 2021-01-28 stsp >> $testroot/stdout.expected
1658 28cf319f 2021-01-28 stsp echo " " >> $testroot/stdout.expected
1660 28cf319f 2021-01-28 stsp (cd $testroot/wt && got log -l 1 > $testroot/stdout)
1661 28cf319f 2021-01-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1663 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1664 28cf319f 2021-01-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
1666 28cf319f 2021-01-28 stsp test_done "$testroot" "$ret"
1669 e8f02263 2022-01-23 thomas test_commit_large_file() {
1670 e8f02263 2022-01-23 thomas local testroot=`test_init commit_large_file`
1672 e8f02263 2022-01-23 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1674 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1675 e8f02263 2022-01-23 thomas test_done "$testroot" "$ret"
1676 e8f02263 2022-01-23 thomas return 1
1679 b9e845cd 2022-07-06 thomas dd status=none if=/dev/zero of=$testroot/wt/new bs=1M count=64
1680 e8f02263 2022-01-23 thomas (cd $testroot/wt && got add new >/dev/null)
1682 e8f02263 2022-01-23 thomas (cd $testroot/wt && got commit -m 'test commit_large_file' \
1683 e8f02263 2022-01-23 thomas > $testroot/stdout)
1685 e8f02263 2022-01-23 thomas local head_rev=`git_show_head $testroot/repo`
1686 e8f02263 2022-01-23 thomas echo "A new" > $testroot/stdout.expected
1687 e8f02263 2022-01-23 thomas echo "Created commit $head_rev" >> $testroot/stdout.expected
1689 e8f02263 2022-01-23 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1691 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1692 e8f02263 2022-01-23 thomas diff -u $testroot/stdout.expected $testroot/stdout
1693 e8f02263 2022-01-23 thomas test_done "$testroot" "$ret"
1694 e8f02263 2022-01-23 thomas return 1
1697 e8f02263 2022-01-23 thomas new_id=`get_blob_id $testroot/repo "" new`
1698 e8f02263 2022-01-23 thomas got cat -r $testroot/repo $new_id > $testroot/new
1700 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1701 e8f02263 2022-01-23 thomas echo "commit failed unexpectedly" >&2
1702 e8f02263 2022-01-23 thomas test_done "$testroot" "1"
1703 e8f02263 2022-01-23 thomas return 1
1706 e8f02263 2022-01-23 thomas cmp -s $testroot/new $testroot/wt/new
1708 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1709 e8f02263 2022-01-23 thomas diff -u $testroot/new $testroot/wt/new
1711 e8f02263 2022-01-23 thomas test_done "$testroot" "$ret"
1716 43896ae6 2022-09-02 thomas test_commit_gitignore() {
1717 43896ae6 2022-09-02 thomas local testroot=`test_init commit_gitignores`
1719 43896ae6 2022-09-02 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1721 43896ae6 2022-09-02 thomas if [ $ret -ne 0 ]; then
1722 43896ae6 2022-09-02 thomas test_done "$testroot" "$ret"
1723 43896ae6 2022-09-02 thomas return 1
1726 43896ae6 2022-09-02 thomas mkdir -p $testroot/wt/tree1/foo
1727 43896ae6 2022-09-02 thomas mkdir -p $testroot/wt/tree2/foo
1728 43896ae6 2022-09-02 thomas echo "tree1/**" > $testroot/wt/.gitignore
1729 43896ae6 2022-09-02 thomas echo "tree2/**" >> $testroot/wt/.gitignore
1730 43896ae6 2022-09-02 thomas echo -n > $testroot/wt/tree1/bar
1731 43896ae6 2022-09-02 thomas echo -n > $testroot/wt/tree1/foo/baz
1732 43896ae6 2022-09-02 thomas echo -n > $testroot/wt/tree2/bar
1733 43896ae6 2022-09-02 thomas echo -n > $testroot/wt/tree2/foo/baz
1734 43896ae6 2022-09-02 thomas echo -n > $testroot/wt/epsilon/zeta1
1735 43896ae6 2022-09-02 thomas echo -n > $testroot/wt/epsilon/zeta2
1737 43896ae6 2022-09-02 thomas (cd $testroot/wt && got add -I -R tree1 > /dev/null)
1738 43896ae6 2022-09-02 thomas (cd $testroot/wt && got add -I tree2/foo/baz > /dev/null)
1739 43896ae6 2022-09-02 thomas (cd $testroot/wt && got commit -m "gitignore add" > /dev/null)
1740 43896ae6 2022-09-02 thomas (cd $testroot/wt && got log -P -l 1 | egrep '^ .' > $testroot/stdout)
1742 43896ae6 2022-09-02 thomas echo ' gitignore add' > $testroot/stdout.expected
1743 43896ae6 2022-09-02 thomas echo ' A tree1/bar' >> $testroot/stdout.expected
1744 43896ae6 2022-09-02 thomas echo ' A tree1/foo/baz' >> $testroot/stdout.expected
1745 43896ae6 2022-09-02 thomas echo ' A tree2/foo/baz' >> $testroot/stdout.expected
1747 43896ae6 2022-09-02 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1749 43896ae6 2022-09-02 thomas if [ $ret -ne 0 ]; then
1750 43896ae6 2022-09-02 thomas diff -u $testroot/stdout.expected $testroot/stdout
1751 43896ae6 2022-09-02 thomas test_done "$testroot" "$ret"
1752 43896ae6 2022-09-02 thomas return 1
1755 43896ae6 2022-09-02 thomas echo touch > $testroot/wt/tree1/bar
1756 43896ae6 2022-09-02 thomas echo touch > $testroot/wt/tree1/foo/baz
1757 43896ae6 2022-09-02 thomas echo touch > $testroot/wt/epsilon/zeta1
1759 43896ae6 2022-09-02 thomas (cd $testroot/wt && got commit -m "gitignore change" > /dev/null)
1760 43896ae6 2022-09-02 thomas (cd $testroot/wt && got log -P -l 1 | egrep '^ .' > $testroot/stdout)
1762 43896ae6 2022-09-02 thomas echo ' gitignore change' > $testroot/stdout.expected
1763 43896ae6 2022-09-02 thomas echo ' M tree1/bar' >> $testroot/stdout.expected
1764 43896ae6 2022-09-02 thomas echo ' M tree1/foo/baz' >> $testroot/stdout.expected
1766 43896ae6 2022-09-02 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1768 43896ae6 2022-09-02 thomas if [ $ret -ne 0 ]; then
1769 43896ae6 2022-09-02 thomas diff -u $testroot/stdout.expected $testroot/stdout
1770 43896ae6 2022-09-02 thomas test_done "$testroot" "$ret"
1771 43896ae6 2022-09-02 thomas return 1
1774 43896ae6 2022-09-02 thomas test_done "$testroot" "$ret"
1777 3d47d5be 2022-10-31 thomas test_commit_bad_author() {
1778 3d47d5be 2022-10-31 thomas local testroot=`test_init commit_bad_author`
1780 3d47d5be 2022-10-31 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1782 3d47d5be 2022-10-31 thomas if [ $ret -ne 0 ]; then
1783 3d47d5be 2022-10-31 thomas test_done "$testroot" $ret
1784 3d47d5be 2022-10-31 thomas return 1
1787 3d47d5be 2022-10-31 thomas echo "modified alpha" > $testroot/wt/alpha
1789 3d47d5be 2022-10-31 thomas (cd $testroot/wt && got commit \
1790 3d47d5be 2022-10-31 thomas -A "${GIT_AUTHOR_NAME}<${GIT_AUTHOR_EMAIL}>" -m 'edit alpha') \
1791 3d47d5be 2022-10-31 thomas > /dev/null 2> $testroot/stderr
1793 3d47d5be 2022-10-31 thomas if [ $ret -eq 0 ]; then
1794 3d47d5be 2022-10-31 thomas test_done "$testroot" 1
1795 3d47d5be 2022-10-31 thomas return 1
1798 3d47d5be 2022-10-31 thomas echo -n "got: ${GIT_AUTHOR_NAME}<${GIT_AUTHOR_EMAIL}>: " \
1799 3d47d5be 2022-10-31 thomas > $testroot/stderr.expected
1800 3d47d5be 2022-10-31 thomas echo -n 'space between author name and email required: ' \
1801 3d47d5be 2022-10-31 thomas >> $testroot/stderr.expected
1802 3d47d5be 2022-10-31 thomas echo 'commit author formatting would make Git unhappy' \
1803 3d47d5be 2022-10-31 thomas >> $testroot/stderr.expected
1804 3d47d5be 2022-10-31 thomas cmp -s $testroot/stderr.expected $testroot/stderr
1806 3d47d5be 2022-10-31 thomas if [ $ret -ne 0 ]; then
1807 3d47d5be 2022-10-31 thomas diff -u $testroot/stderr.expected $testroot/stderr
1808 3d47d5be 2022-10-31 thomas test_done "$testroot" $ret
1809 3d47d5be 2022-10-31 thomas return 1
1812 3d47d5be 2022-10-31 thomas test_done "$testroot" 0
1815 3f4f8b5a 2023-01-31 thomas test_commit_logmsg_ref() {
1816 3f4f8b5a 2023-01-31 thomas local testroot=`test_init commit_logmsg_ref`
1818 3f4f8b5a 2023-01-31 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1820 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1821 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
1822 3f4f8b5a 2023-01-31 thomas return 1
1825 3f4f8b5a 2023-01-31 thomas (cd $testroot/repo && git checkout -q -b newbranch)
1827 3f4f8b5a 2023-01-31 thomas local bo_logmsg_prefix="log message of backed-out commit"
1828 3f4f8b5a 2023-01-31 thomas local cy_logmsg_prefix="log message of cherrypicked commit"
1829 3f4f8b5a 2023-01-31 thomas local branch_rev_logmsg="changes on newbranch to cherrypick"
1830 3f4f8b5a 2023-01-31 thomas local branch_rev2_logmsg="modified zeta on newbranch to cherrypick"
1832 3f4f8b5a 2023-01-31 thomas echo "modified delta on branch" > $testroot/repo/gamma/delta
1833 3f4f8b5a 2023-01-31 thomas echo "modified alpha on branch" > $testroot/repo/alpha
1834 3f4f8b5a 2023-01-31 thomas (cd $testroot/repo && git rm -q beta)
1835 3f4f8b5a 2023-01-31 thomas echo "new file on branch" > $testroot/repo/epsilon/new
1836 3f4f8b5a 2023-01-31 thomas (cd $testroot/repo && git add epsilon/new)
1838 3f4f8b5a 2023-01-31 thomas git_commit $testroot/repo -m "$branch_rev_logmsg"
1839 3f4f8b5a 2023-01-31 thomas local branch_rev=`git_show_head $testroot/repo`
1841 3f4f8b5a 2023-01-31 thomas echo "modified zeta on branch" > $testroot/repo/epsilon/zeta
1843 3f4f8b5a 2023-01-31 thomas git_commit $testroot/repo -m "$branch_rev2_logmsg"
1844 3f4f8b5a 2023-01-31 thomas local branch_rev2=`git_show_head $testroot/repo`
1846 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got cherrypick $branch_rev > /dev/null)
1847 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got cherrypick $branch_rev2 > /dev/null)
1849 3f4f8b5a 2023-01-31 thomas cat > $testroot/editor.sh <<EOF
1850 3f4f8b5a 2023-01-31 thomas #!/bin/sh
1851 3f4f8b5a 2023-01-31 thomas sed -i 's/# l/l/' "\$1"
1853 3f4f8b5a 2023-01-31 thomas chmod +x $testroot/editor.sh
1855 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && env VISUAL="$testroot/editor.sh" \
1856 3f4f8b5a 2023-01-31 thomas got commit > /dev/null)
1858 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1859 3f4f8b5a 2023-01-31 thomas echo "'got commit' failed unexpectedly" >&2
1860 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "1"
1861 3f4f8b5a 2023-01-31 thomas return 1
1864 3f4f8b5a 2023-01-31 thomas # check that multiple cherrypicked log messages populate the editor
1865 3f4f8b5a 2023-01-31 thomas local first=`printf '%s\n%s' $branch_rev $branch_rev2 | sort | head -1`
1866 3f4f8b5a 2023-01-31 thomas local second=`printf '%s\n%s' $branch_rev $branch_rev2 | sort | tail -1`
1868 3f4f8b5a 2023-01-31 thomas if [ $branch_rev == $first ]; then
1869 3f4f8b5a 2023-01-31 thomas local first_msg=$branch_rev_logmsg
1870 3f4f8b5a 2023-01-31 thomas local second_msg=$branch_rev2_logmsg
1872 3f4f8b5a 2023-01-31 thomas local first_msg=$branch_rev2_logmsg
1873 3f4f8b5a 2023-01-31 thomas local second_msg=$branch_rev_logmsg
1876 3f4f8b5a 2023-01-31 thomas echo " $cy_logmsg_prefix $first:" > $testroot/stdout.expected
1877 3f4f8b5a 2023-01-31 thomas echo " $first_msg" >> $testroot/stdout.expected
1878 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
1879 3f4f8b5a 2023-01-31 thomas echo " $cy_logmsg_prefix $second:" >> $testroot/stdout.expected
1880 3f4f8b5a 2023-01-31 thomas echo " $second_msg" >> $testroot/stdout.expected
1881 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
1883 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got log -l2 | \
1884 3f4f8b5a 2023-01-31 thomas grep -A2 'log message' | sed '/^--/d' > $testroot/stdout)
1886 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1888 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1889 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
1890 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
1891 3f4f8b5a 2023-01-31 thomas return 1
1894 3f4f8b5a 2023-01-31 thomas # check that only the relevant log message populates the editor
1895 3f4f8b5a 2023-01-31 thomas # when the changes from one of two backout commits are reverted
1896 3f4f8b5a 2023-01-31 thomas got checkout $testroot/repo $testroot/wt2 > /dev/null
1898 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1899 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
1900 3f4f8b5a 2023-01-31 thomas return 1
1903 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt2 && got backout $branch_rev > /dev/null)
1904 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt2 && got backout $branch_rev2 > /dev/null)
1905 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt2 && got revert epsilon/zeta > /dev/null)
1907 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt2 && env VISUAL="$testroot/editor.sh" \
1908 3f4f8b5a 2023-01-31 thomas got commit > /dev/null)
1910 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1911 3f4f8b5a 2023-01-31 thomas echo "'got commit' failed unexpectedly" >&2
1912 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "1"
1913 3f4f8b5a 2023-01-31 thomas return 1
1916 3f4f8b5a 2023-01-31 thomas echo " $bo_logmsg_prefix $branch_rev:" > $testroot/stdout.expected
1917 3f4f8b5a 2023-01-31 thomas echo " $branch_rev_logmsg" >> $testroot/stdout.expected
1918 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
1920 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt2 && got log -l1 | \
1921 3f4f8b5a 2023-01-31 thomas grep -A2 'log message' > $testroot/stdout)
1923 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1925 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1926 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
1927 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
1928 3f4f8b5a 2023-01-31 thomas return 1
1931 3f4f8b5a 2023-01-31 thomas # check that a cherrypicked log message is still
1932 3f4f8b5a 2023-01-31 thomas # used when its changes are only partially reverted
1933 3f4f8b5a 2023-01-31 thomas branch_rev_logmsg="changes to cherrypick and partially revert"
1935 3f4f8b5a 2023-01-31 thomas echo "newline in alpha" >> $testroot/repo/alpha
1936 3f4f8b5a 2023-01-31 thomas echo "modified epsilon/zeta on branch" > $testroot/repo/epsilon/zeta
1938 3f4f8b5a 2023-01-31 thomas git_commit $testroot/repo -m "$branch_rev_logmsg"
1939 3f4f8b5a 2023-01-31 thomas branch_rev=`git_show_head $testroot/repo`
1941 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got cherrypick $branch_rev > /dev/null)
1942 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got revert alpha > /dev/null)
1944 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && env VISUAL="$testroot/editor.sh" \
1945 3f4f8b5a 2023-01-31 thomas got commit > /dev/null)
1947 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1948 3f4f8b5a 2023-01-31 thomas echo "'got commit' failed unexpectedly" >&2
1949 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "1"
1950 3f4f8b5a 2023-01-31 thomas return 1
1953 3f4f8b5a 2023-01-31 thomas echo " $cy_logmsg_prefix $branch_rev:" > $testroot/stdout.expected
1954 3f4f8b5a 2023-01-31 thomas echo " $branch_rev_logmsg" >> $testroot/stdout.expected
1955 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
1957 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got log -l1 | \
1958 3f4f8b5a 2023-01-31 thomas grep -A2 'log message' > $testroot/stdout)
1960 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1962 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1963 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
1964 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
1965 3f4f8b5a 2023-01-31 thomas return 1
1968 3f4f8b5a 2023-01-31 thomas # check we don't use and consequently delete the logmsg ref of a
1969 3f4f8b5a 2023-01-31 thomas # cherrypicked commit when omitting its changed path from the commit
1970 3f4f8b5a 2023-01-31 thomas branch_rev_logmsg="changes to cherrypick but omit from the commit"
1972 3f4f8b5a 2023-01-31 thomas echo "changed delta" >> $testroot/repo/gamma/delta
1974 3f4f8b5a 2023-01-31 thomas git_commit $testroot/repo -m "$branch_rev_logmsg"
1975 3f4f8b5a 2023-01-31 thomas local author_time=`git_show_author_time $testroot/repo`
1976 3f4f8b5a 2023-01-31 thomas local d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
1977 3f4f8b5a 2023-01-31 thomas branch_rev=`git_show_head $testroot/repo`
1979 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got update > /dev/null)
1981 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1982 3f4f8b5a 2023-01-31 thomas echo "got update failed unexpectedly" >&2
1983 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
1984 3f4f8b5a 2023-01-31 thomas return 1
1987 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got cherrypick $branch_rev > /dev/null)
1989 3f4f8b5a 2023-01-31 thomas echo "changed alpha" >> $testroot/wt/alpha
1991 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got commit -m \
1992 3f4f8b5a 2023-01-31 thomas "don't commit cy change to gamma/delta" alpha > /dev/null)
1994 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
1995 3f4f8b5a 2023-01-31 thomas echo "'got commit' failed unexpectedly" >&2
1996 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "1"
1997 3f4f8b5a 2023-01-31 thomas return 1
2000 3f4f8b5a 2023-01-31 thomas # confirm logmsg ref was not deleted with got cherrypick -l
2001 3f4f8b5a 2023-01-31 thomas echo "-----------------------------------------------" \
2002 3f4f8b5a 2023-01-31 thomas > $testroot/stdout.expected
2003 f35e52a9 2023-01-31 thomas echo "cherrypick $branch_rev (newbranch)" >> $testroot/stdout.expected
2004 3f4f8b5a 2023-01-31 thomas echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
2005 3f4f8b5a 2023-01-31 thomas echo "date: $d" >> $testroot/stdout.expected
2006 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
2007 3f4f8b5a 2023-01-31 thomas echo " $branch_rev_logmsg" >> $testroot/stdout.expected
2008 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
2009 3f4f8b5a 2023-01-31 thomas echo " M gamma/delta" >> $testroot/stdout.expected
2010 3f4f8b5a 2023-01-31 thomas echo >> $testroot/stdout.expected
2012 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got cherrypick -l > $testroot/stdout)
2014 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2016 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
2017 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
2018 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
2019 3f4f8b5a 2023-01-31 thomas return 1
2022 3f4f8b5a 2023-01-31 thomas # confirm a previously unused logmsg ref is picked up
2023 3f4f8b5a 2023-01-31 thomas # when an affected path is actually committed
2024 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && env VISUAL="$testroot/editor.sh" \
2025 3f4f8b5a 2023-01-31 thomas got commit > /dev/null)
2027 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
2028 3f4f8b5a 2023-01-31 thomas echo "'got commit' failed unexpectedly" >&2
2029 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "1"
2030 3f4f8b5a 2023-01-31 thomas return 1
2033 3f4f8b5a 2023-01-31 thomas echo " $cy_logmsg_prefix $branch_rev:" > $testroot/stdout.expected
2034 3f4f8b5a 2023-01-31 thomas echo " $branch_rev_logmsg" >> $testroot/stdout.expected
2035 3f4f8b5a 2023-01-31 thomas echo " " >> $testroot/stdout.expected
2037 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got log -l1 | \
2038 3f4f8b5a 2023-01-31 thomas grep -A2 'log message' > $testroot/stdout)
2040 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2042 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
2043 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
2044 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
2045 3f4f8b5a 2023-01-31 thomas return 1
2048 3f4f8b5a 2023-01-31 thomas # make sure we are not littering work trees
2049 3f4f8b5a 2023-01-31 thomas # by leaving temp got-logmsg-* files behind
2050 3f4f8b5a 2023-01-31 thomas echo -n > $testroot/stdout.expected
2051 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt && got status > $testroot/stdout)
2053 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2055 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
2056 3f4f8b5a 2023-01-31 thomas echo "$testroot/wt is not clean"
2057 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
2058 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
2059 3f4f8b5a 2023-01-31 thomas return 1
2062 3f4f8b5a 2023-01-31 thomas (cd $testroot/wt2 && got status > $testroot/stdout)
2064 3f4f8b5a 2023-01-31 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2066 3f4f8b5a 2023-01-31 thomas if [ $ret -ne 0 ]; then
2067 3f4f8b5a 2023-01-31 thomas echo "$testroot/repo is not clean"
2068 3f4f8b5a 2023-01-31 thomas diff -u $testroot/stdout.expected $testroot/stdout
2070 3f4f8b5a 2023-01-31 thomas test_done "$testroot" "$ret"
2073 7fb414ae 2020-08-08 stsp test_parseargs "$@"
2074 c4296144 2019-05-09 stsp run_test test_commit_basic
2075 83a7ae6d 2019-05-10 stsp run_test test_commit_new_subdir
2076 83a7ae6d 2019-05-10 stsp run_test test_commit_subdir
2077 83a7ae6d 2019-05-10 stsp run_test test_commit_single_file
2078 83a7ae6d 2019-05-10 stsp run_test test_commit_out_of_date
2079 8ba6ba2d 2019-05-14 stsp run_test test_commit_added_subdirs
2080 ba580f68 2020-03-22 stsp run_test test_commit_deleted_subdirs
2081 f363d663 2019-05-23 stsp run_test test_commit_rejects_conflicted_file
2082 1a36436d 2019-06-10 stsp run_test test_commit_single_file_multiple
2083 4866d084 2019-07-10 stsp run_test test_commit_added_and_modified_in_same_dir
2084 e0233cea 2019-07-25 stsp run_test test_commit_path_prefix
2085 90e8619e 2019-07-25 stsp run_test test_commit_dir_path
2086 5c1e53bc 2019-07-28 stsp run_test test_commit_selected_paths
2087 916f288c 2019-07-30 stsp run_test test_commit_outside_refs_heads
2088 84792843 2019-08-09 stsp run_test test_commit_no_email
2089 6af1ccbd 2019-08-16 stsp run_test test_commit_tree_entry_sorting
2090 18d1acad 2022-07-20 thomas run_test test_commit_cmdline_author
2091 257add31 2020-09-09 stsp run_test test_commit_gotconfig_author
2092 50b0790e 2020-09-11 stsp run_test test_commit_gotconfig_worktree_author
2093 aba9c984 2019-09-08 stsp run_test test_commit_gitconfig_author
2094 1ebedb77 2019-10-19 stsp run_test test_commit_xbit_change
2095 f7b97ccb 2020-04-14 stsp run_test test_commit_normalizes_filemodes
2096 e7303626 2020-05-14 stsp run_test test_commit_with_unrelated_submodule
2097 3d9a4ec4 2020-07-23 stsp run_test test_commit_symlink
2098 5a1fbc73 2020-07-23 stsp run_test test_commit_fix_bad_symlink
2099 28cf319f 2021-01-28 stsp run_test test_commit_prepared_logmsg
2100 e8f02263 2022-01-23 thomas run_test test_commit_large_file
2101 43896ae6 2022-09-02 thomas run_test test_commit_gitignore
2102 3d47d5be 2022-10-31 thomas run_test test_commit_bad_author
2103 3f4f8b5a 2023-01-31 thomas run_test test_commit_logmsg_ref