3 # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 local testroot=`test_init commit_basic`
22 got checkout $testroot/repo $testroot/wt > /dev/null
24 if [ "$ret" != "0" ]; then
25 test_done "$testroot" "$ret"
29 echo "modified alpha" > $testroot/wt/alpha
30 (cd $testroot/wt && got rm beta >/dev/null)
31 echo "new file" > $testroot/wt/new
32 (cd $testroot/wt && got add new >/dev/null)
34 (cd $testroot/wt && got commit -m 'test commit_basic' > $testroot/stdout)
36 local head_rev=`git_show_head $testroot/repo`
37 echo "A new" > $testroot/stdout.expected
38 echo "M alpha" >> $testroot/stdout.expected
39 echo "D beta" >> $testroot/stdout.expected
40 echo "Created commit $head_rev" >> $testroot/stdout.expected
42 cmp -s $testroot/stdout.expected $testroot/stdout
44 if [ "$ret" != "0" ]; then
45 diff -u $testroot/stdout.expected $testroot/stdout
47 test_done "$testroot" "$ret"
50 test_commit_new_subdir() {
51 local testroot=`test_init commit_new_subdir`
53 got checkout $testroot/repo $testroot/wt > /dev/null
55 if [ "$ret" != "0" ]; then
56 test_done "$testroot" "$ret"
60 mkdir -p $testroot/wt/d
61 echo "new file" > $testroot/wt/d/new
62 echo "another new file" > $testroot/wt/d/new2
63 (cd $testroot/wt && got add d/new >/dev/null)
64 (cd $testroot/wt && got add d/new2 >/dev/null)
67 got commit -m 'test commit_new_subdir' > $testroot/stdout)
69 local head_rev=`git_show_head $testroot/repo`
70 echo "A d/new" > $testroot/stdout.expected
71 echo "A d/new2" >> $testroot/stdout.expected
72 echo "Created commit $head_rev" >> $testroot/stdout.expected
74 cmp -s $testroot/stdout.expected $testroot/stdout
76 if [ "$ret" != "0" ]; then
77 diff -u $testroot/stdout.expected $testroot/stdout
79 test_done "$testroot" "$ret"
82 test_commit_subdir() {
83 local testroot=`test_init commit_subdir`
85 got checkout $testroot/repo $testroot/wt > /dev/null
87 if [ "$ret" != "0" ]; then
88 test_done "$testroot" "$ret"
92 echo "modified alpha" > $testroot/wt/alpha
93 echo "modified zeta" > $testroot/wt/epsilon/zeta
96 got commit -m 'test commit_subdir' epsilon > $testroot/stdout)
98 local head_rev=`git_show_head $testroot/repo`
99 echo "M epsilon/zeta" >> $testroot/stdout.expected
100 echo "Created commit $head_rev" >> $testroot/stdout.expected
102 cmp -s $testroot/stdout.expected $testroot/stdout
104 if [ "$ret" != "0" ]; then
105 diff -u $testroot/stdout.expected $testroot/stdout
107 test_done "$testroot" "$ret"
110 test_commit_single_file() {
111 local testroot=`test_init commit_single_file`
113 got checkout $testroot/repo $testroot/wt > /dev/null
115 if [ "$ret" != "0" ]; then
116 test_done "$testroot" "$ret"
120 echo "modified alpha" > $testroot/wt/alpha
121 echo "modified zeta" > $testroot/wt/epsilon/zeta
123 (cd $testroot/wt && got commit -m 'changed zeta' epsilon/zeta \
126 local head_rev=`git_show_head $testroot/repo`
127 echo "M epsilon/zeta" >> $testroot/stdout.expected
128 echo "Created commit $head_rev" >> $testroot/stdout.expected
130 cmp -s $testroot/stdout.expected $testroot/stdout
132 if [ "$ret" != "0" ]; then
133 diff -u $testroot/stdout.expected $testroot/stdout
135 test_done "$testroot" "$ret"
138 test_commit_out_of_date() {
139 local testroot=`test_init commit_out_of_date`
140 local first_commit=`git_show_head $testroot/repo`
142 got checkout $testroot/repo $testroot/wt > /dev/null
144 if [ "$ret" != "0" ]; then
145 test_done "$testroot" "$ret"
149 echo "modified alpha" > $testroot/repo/alpha
150 git_commit $testroot/repo -m "modified alpha"
152 echo "modified alpha" > $testroot/wt/alpha
154 (cd $testroot/wt && got commit -m 'test commit_out_of_date' \
155 > $testroot/stdout 2> $testroot/stderr)
157 echo -n > $testroot/stdout.expected
158 echo "got: work tree must be updated before these" \
159 "changes can be committed" > $testroot/stderr.expected
161 cmp -s $testroot/stdout.expected $testroot/stdout
163 if [ "$ret" != "0" ]; then
164 diff -u $testroot/stdout.expected $testroot/stdout
165 test_done "$testroot" "$ret"
169 cmp -s $testroot/stderr.expected $testroot/stderr
171 if [ "$ret" != "0" ]; then
172 diff -u $testroot/stderr.expected $testroot/stderr
173 test_done "$testroot" "$ret"
177 echo "alpha" > $testroot/repo/alpha
178 git_commit $testroot/repo -m "reset alpha contents"
179 (cd $testroot/wt && got update -c $first_commit > /dev/null)
181 echo "modified alpha" > $testroot/wt/alpha
183 (cd $testroot/wt && got commit -m 'changed alpha ' > $testroot/stdout)
185 if [ "$ret" != "0" ]; then
186 echo "commit failed unexpectedly" >&2
187 test_done "$testroot" "1"
191 local head_rev=`git_show_head $testroot/repo`
192 echo "M alpha" > $testroot/stdout.expected
193 echo "Created commit $head_rev" >> $testroot/stdout.expected
194 cmp -s $testroot/stdout.expected $testroot/stdout
196 if [ "$ret" != "0" ]; then
197 diff -u $testroot/stdout.expected $testroot/stdout
199 test_done "$testroot" "$ret"
202 test_commit_added_subdirs() {
203 local testroot=`test_init commit_added_subdirs`
205 got checkout $testroot/repo $testroot/wt > /dev/null
207 if [ "$ret" != "0" ]; then
208 test_done "$testroot" "$ret"
212 mkdir -p $testroot/wt/d
213 echo "new file" > $testroot/wt/d/new
214 echo "new file 2" > $testroot/wt/d/new2
215 mkdir -p $testroot/wt/d/f
216 echo "new file 3" > $testroot/wt/d/f/new3
217 mkdir -p $testroot/wt/d/f/g
218 echo "new file 4" > $testroot/wt/d/f/g/new4
220 (cd $testroot/wt && got add $testroot/wt/*/new* \
221 $testroot/wt/*/*/new* $testroot/wt/*/*/*/new* > /dev/null)
223 (cd $testroot/wt && got commit -m 'test commit_added_subdirs' \
224 > $testroot/stdout 2> $testroot/stderr)
226 local head_rev=`git_show_head $testroot/repo`
227 echo "A d/f/g/new4" > $testroot/stdout.expected
228 echo "A d/f/new3" >> $testroot/stdout.expected
229 echo "A d/new" >> $testroot/stdout.expected
230 echo "A d/new2" >> $testroot/stdout.expected
231 echo "Created commit $head_rev" >> $testroot/stdout.expected
233 cmp -s $testroot/stdout.expected $testroot/stdout
235 if [ "$ret" != "0" ]; then
236 diff -u $testroot/stdout.expected $testroot/stdout
238 test_done "$testroot" "$ret"
241 test_commit_deleted_subdirs() {
242 local testroot=`test_init commit_deleted_subdirs`
244 got checkout $testroot/repo $testroot/wt > /dev/null
246 if [ "$ret" != "0" ]; then
247 test_done "$testroot" "$ret"
251 (cd $testroot/wt && \
252 got rm -R $testroot/wt/epsilon $testroot/wt/gamma >/dev/null)
254 (cd $testroot/wt && got commit -m 'test commit_deleted_subdirs' \
255 > $testroot/stdout 2> $testroot/stderr)
257 local head_rev=`git_show_head $testroot/repo`
258 echo "D epsilon/zeta" > $testroot/stdout.expected
259 echo "D gamma/delta" >> $testroot/stdout.expected
260 echo "Created commit $head_rev" >> $testroot/stdout.expected
262 cmp -s $testroot/stdout.expected $testroot/stdout
264 if [ "$ret" != "0" ]; then
265 diff -u $testroot/stdout.expected $testroot/stdout
266 test_done "$testroot" "$ret"
270 got tree -r $testroot/repo > $testroot/stdout
272 echo "alpha" > $testroot/stdout.expected
273 echo "beta" >> $testroot/stdout.expected
275 cmp -s $testroot/stdout.expected $testroot/stdout
277 if [ "$ret" != "0" ]; then
278 diff -u $testroot/stdout.expected $testroot/stdout
280 test_done "$testroot" "$ret"
283 test_commit_rejects_conflicted_file() {
284 local testroot=`test_init commit_rejects_conflicted_file`
286 local initial_rev=`git_show_head $testroot/repo`
288 got checkout $testroot/repo $testroot/wt > /dev/null
290 if [ "$ret" != "0" ]; then
291 test_done "$testroot" "$ret"
295 echo "modified alpha" > $testroot/wt/alpha
296 (cd $testroot/wt && got commit -m "modified alpha" >/dev/null)
298 (cd $testroot/wt && got update -c $initial_rev > /dev/null)
300 echo "modified alpha, too" > $testroot/wt/alpha
302 echo "C alpha" > $testroot/stdout.expected
303 echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
304 git_show_head $testroot/repo >> $testroot/stdout.expected
305 echo >> $testroot/stdout.expected
306 echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
308 (cd $testroot/wt && got update > $testroot/stdout)
310 cmp -s $testroot/stdout.expected $testroot/stdout
312 if [ "$ret" != "0" ]; then
313 diff -u $testroot/stdout.expected $testroot/stdout
314 test_done "$testroot" "$ret"
318 (cd $testroot/wt && got commit -m 'commit it' > $testroot/stdout \
321 echo -n > $testroot/stdout.expected
322 echo "got: cannot commit file in conflicted status" \
323 > $testroot/stderr.expected
325 cmp -s $testroot/stdout.expected $testroot/stdout
327 if [ "$ret" != "0" ]; then
328 diff -u $testroot/stdout.expected $testroot/stdout
329 test_done "$testroot" "$ret"
332 cmp -s $testroot/stderr.expected $testroot/stderr
334 if [ "$ret" != "0" ]; then
335 diff -u $testroot/stderr.expected $testroot/stderr
337 test_done "$testroot" "$ret"
340 test_commit_single_file_multiple() {
341 local testroot=`test_init commit_single_file_multiple`
343 got checkout $testroot/repo $testroot/wt > /dev/null
345 if [ "$ret" != "0" ]; then
346 test_done "$testroot" "$ret"
351 echo "modified alpha" >> $testroot/wt/alpha
353 (cd $testroot/wt && \
354 got commit -m "changed alpha" > $testroot/stdout)
356 local head_rev=`git_show_head $testroot/repo`
357 echo "M alpha" > $testroot/stdout.expected
358 echo "Created commit $head_rev" >> $testroot/stdout.expected
360 cmp -s $testroot/stdout.expected $testroot/stdout
362 if [ "$ret" != "0" ]; then
363 diff -u $testroot/stdout.expected $testroot/stdout
364 test_done "$testroot" "$ret"
369 test_done "$testroot" "0"
372 test_commit_added_and_modified_in_same_dir() {
373 local testroot=`test_init commit_added_and_modified_in_same_dir`
375 got checkout $testroot/repo $testroot/wt > /dev/null
377 if [ "$ret" != "0" ]; then
378 test_done "$testroot" "$ret"
382 echo "modified zeta" > $testroot/wt/epsilon/zeta
383 echo "new file" > $testroot/wt/epsilon/new
384 (cd $testroot/wt && got add epsilon/new >/dev/null)
386 (cd $testroot/wt && got commit \
387 -m 'added and modified in same dir' > $testroot/stdout \
390 local head_rev=`git_show_head $testroot/repo`
391 echo "A epsilon/new" > $testroot/stdout.expected
392 echo "M epsilon/zeta" >> $testroot/stdout.expected
393 echo "Created commit $head_rev" >> $testroot/stdout.expected
395 cmp -s $testroot/stdout.expected $testroot/stdout
397 if [ "$ret" != "0" ]; then
398 diff -u $testroot/stdout.expected $testroot/stdout
400 test_done "$testroot" "$ret"
403 test_commit_path_prefix() {
404 local testroot=`test_init commit_path_prefix`
405 local commit1=`git_show_head $testroot/repo`
407 got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
409 if [ "$ret" != "0" ]; then
410 test_done "$testroot" "$ret"
414 echo "modified delta" > $testroot/wt/delta
416 (cd $testroot/wt && got commit -m 'changed gamma/delta' > $testroot/stdout)
418 local commit2=`git_show_head $testroot/repo`
419 echo "M delta" > $testroot/stdout.expected
420 echo "Created commit $commit2" >> $testroot/stdout.expected
422 cmp -s $testroot/stdout.expected $testroot/stdout
424 if [ "$ret" != "0" ]; then
425 diff -u $testroot/stdout.expected $testroot/stdout
426 test_done "$testroot" "$ret"
430 echo "diff $commit1 $commit2" > $testroot/stdout.expected
431 echo -n 'blob - ' >> $testroot/stdout.expected
432 got tree -r $testroot/repo -c $commit1 -i gamma | grep 'delta$' \
433 | cut -d' ' -f 1 >> $testroot/stdout.expected
434 echo -n 'blob + ' >> $testroot/stdout.expected
435 got tree -r $testroot/repo -c $commit2 -i gamma | grep 'delta$' | \
436 cut -d' ' -f 1 >> $testroot/stdout.expected
437 echo '--- gamma/delta' >> $testroot/stdout.expected
438 echo '+++ gamma/delta' >> $testroot/stdout.expected
439 echo '@@ -1 +1 @@' >> $testroot/stdout.expected
440 echo '-delta' >> $testroot/stdout.expected
441 echo '+modified delta' >> $testroot/stdout.expected
443 got diff -r $testroot/repo $commit1 $commit2 > $testroot/stdout
444 cmp -s $testroot/stdout.expected $testroot/stdout
446 if [ "$ret" != "0" ]; then
447 diff -u $testroot/stdout.expected $testroot/stdout
448 test_done "$testroot" "$ret"
452 (cd $testroot/wt && got rm delta > /dev/null)
453 echo new > $testroot/wt/new
454 (cd $testroot/wt && got add new > /dev/null)
456 (cd $testroot/wt && got commit -m 'remove gamma/delta; add gamma/new' \
459 local commit3=`git_show_head $testroot/repo`
460 echo "A new" > $testroot/stdout.expected
461 echo "D delta" >> $testroot/stdout.expected
462 echo "Created commit $commit3" >> $testroot/stdout.expected
464 cmp -s $testroot/stdout.expected $testroot/stdout
466 if [ "$ret" != "0" ]; then
467 diff -u $testroot/stdout.expected $testroot/stdout
468 test_done "$testroot" "$ret"
472 echo "diff $commit2 $commit3" > $testroot/stdout.expected
473 echo -n 'blob - ' >> $testroot/stdout.expected
474 got tree -r $testroot/repo -c $commit2 -i gamma | grep 'delta$' \
475 | cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \
476 >> $testroot/stdout.expected
477 echo 'blob + /dev/null' >> $testroot/stdout.expected
478 echo '--- gamma/delta' >> $testroot/stdout.expected
479 echo '+++ /dev/null' >> $testroot/stdout.expected
480 echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
481 echo '-modified delta' >> $testroot/stdout.expected
482 echo 'blob - /dev/null' >> $testroot/stdout.expected
483 echo -n 'blob + ' >> $testroot/stdout.expected
484 got tree -r $testroot/repo -c $commit3 -i gamma | grep 'new$' | \
485 cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \
486 >> $testroot/stdout.expected
487 echo '--- /dev/null' >> $testroot/stdout.expected
488 echo '+++ gamma/new' >> $testroot/stdout.expected
489 echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
490 echo '+new' >> $testroot/stdout.expected
492 got diff -r $testroot/repo $commit2 $commit3 > $testroot/stdout
493 cmp -s $testroot/stdout.expected $testroot/stdout
495 if [ "$ret" != "0" ]; then
496 diff -u $testroot/stdout.expected $testroot/stdout
498 test_done "$testroot" "$ret"
502 test_commit_dir_path() {
503 local testroot=`test_init commit_dir_path`
505 got checkout $testroot/repo $testroot/wt > /dev/null
507 if [ "$ret" != "0" ]; then
508 test_done "$testroot" "$ret"
512 echo "modified alpha" > $testroot/wt/alpha
513 echo "modified zeta" > $testroot/wt/epsilon/zeta
515 (cd $testroot/wt && got commit -m 'changed zeta' epsilon \
518 local head_rev=`git_show_head $testroot/repo`
519 echo "M epsilon/zeta" >> $testroot/stdout.expected
520 echo "Created commit $head_rev" >> $testroot/stdout.expected
522 cmp -s $testroot/stdout.expected $testroot/stdout
524 if [ "$ret" != "0" ]; then
525 diff -u $testroot/stdout.expected $testroot/stdout
526 test_done "$testroot" "$ret"
530 echo "M alpha" > $testroot/stdout.expected
531 (cd $testroot/wt && got status > $testroot/stdout)
532 cmp -s $testroot/stdout.expected $testroot/stdout
534 if [ "$ret" != "0" ]; then
535 diff -u $testroot/stdout.expected $testroot/stdout
537 test_done "$testroot" "$ret"
540 test_commit_selected_paths() {
541 local testroot=`test_init commit_selected_paths`
543 got checkout $testroot/repo $testroot/wt > /dev/null
545 if [ "$ret" != "0" ]; then
546 test_done "$testroot" "$ret"
550 echo "modified alpha" > $testroot/wt/alpha
551 echo "modified delta" > $testroot/wt/gamma/delta
552 echo "modified zeta" > $testroot/wt/epsilon/zeta
553 (cd $testroot/wt && got rm beta >/dev/null)
554 echo "new file" > $testroot/wt/new
555 (cd $testroot/wt && got add new >/dev/null)
557 (cd $testroot/wt && got commit -m 'many paths' nonexistent alpha \
558 > $testroot/stdout 2> $testroot/stderr)
560 if [ "$ret" = "0" ]; then
561 echo "commit succeeded unexpectedly" >&2
562 test_done "$testroot" "1"
565 echo "got: nonexistent: bad path" > $testroot/stderr.expected
567 cmp -s $testroot/stderr.expected $testroot/stderr
569 if [ "$ret" != "0" ]; then
570 diff -u $testroot/stderr.expected $testroot/stderr
571 test_done "$testroot" "$ret"
575 (cd $testroot/wt && got commit -m 'many paths' \
576 beta new gamma > $testroot/stdout)
578 local head_rev=`git_show_head $testroot/repo`
579 echo "A new" > $testroot/stdout.expected
580 echo "D beta" >> $testroot/stdout.expected
581 echo "M gamma/delta" >> $testroot/stdout.expected
582 echo "Created commit $head_rev" >> $testroot/stdout.expected
584 cmp -s $testroot/stdout.expected $testroot/stdout
586 if [ "$ret" != "0" ]; then
587 diff -u $testroot/stdout.expected $testroot/stdout
589 test_done "$testroot" "$ret"
592 test_commit_outside_refs_heads() {
593 local testroot=`test_init commit_outside_refs_heads`
595 got ref -r $testroot/repo -c master refs/remotes/origin/master
597 got checkout -b refs/remotes/origin/master \
598 $testroot/repo $testroot/wt > /dev/null
600 if [ "$ret" != "0" ]; then
601 test_done "$testroot" "$ret"
605 echo "modified alpha" > $testroot/wt/alpha
607 (cd $testroot/wt && got commit -m 'change alpha' \
608 > $testroot/stdout 2> $testroot/stderr)
610 if [ "$ret" = "0" ]; then
611 echo "commit succeeded unexpectedly" >&2
612 test_done "$testroot" "1"
616 echo -n > $testroot/stdout.expected
617 cmp -s $testroot/stdout.expected $testroot/stdout
619 if [ "$ret" != "0" ]; then
620 diff -u $testroot/stdout.expected $testroot/stdout
621 test_done "$testroot" "$ret"
625 echo -n "got: will not commit to a branch outside the " \
626 > $testroot/stderr.expected
627 echo '"refs/heads/" reference namespace' \
628 >> $testroot/stderr.expected
629 cmp -s $testroot/stderr.expected $testroot/stderr
631 if [ "$ret" != "0" ]; then
632 diff -u $testroot/stderr.expected $testroot/stderr
634 test_done "$testroot" "$ret"
637 test_commit_no_email() {
638 local testroot=`test_init commit_no_email`
640 got checkout $testroot/repo $testroot/wt > /dev/null
642 if [ "$ret" != "0" ]; then
643 test_done "$testroot" "$ret"
647 echo "modified alpha" > $testroot/wt/alpha
648 (cd $testroot/wt && env GOT_AUTHOR=":flan_hacker:" \
649 got commit -m 'test no email' > $testroot/stdout \
652 echo -n "got: GOT_AUTHOR environment variable contains no email " \
653 > $testroot/stderr.expected
654 echo -n "address; an email address is required for compatibility "\
655 >> $testroot/stderr.expected
656 echo "with Git" >> $testroot/stderr.expected
657 cmp -s $testroot/stderr.expected $testroot/stderr
659 if [ "$ret" != "0" ]; then
660 diff -u $testroot/stderr.expected $testroot/stderr
661 test_done "$testroot" "$ret"
665 echo -n > $testroot/stdout.expected
666 cmp -s $testroot/stdout.expected $testroot/stdout
668 if [ "$ret" != "0" ]; then
669 diff -u $testroot/stdout.expected $testroot/stdout
671 test_done "$testroot" "$ret"
674 test_commit_tree_entry_sorting() {
675 local testroot=`test_init commit_tree_entry_sorting`
677 got checkout $testroot/repo $testroot/wt > /dev/null
679 if [ "$ret" != "0" ]; then
680 test_done "$testroot" "$ret"
684 # Git's index gets corrupted when tree entries are written in the
685 # order defined by got_path_cmp() rather than Git's own ordering.
686 # Create a new tree where a directory "got" and a file "got-version"
687 # would sort in the wrong order according to Git's opinion.
688 mkdir $testroot/wt/got
689 touch $testroot/wt/got/foo
690 echo foo > $testroot/wt/got-version
691 echo zzz > $testroot/wt/zzz
692 (cd $testroot/wt && got add got-version got/foo zzz > /dev/null)
694 (cd $testroot/wt && got commit -m 'test' > /dev/null)
696 # Let git-fsck verify the newly written tree to make sure Git is happy
697 (cd $testroot/repo && git fsck --strict \
698 > $testroot/fsck.stdout 2> $testroot/fsck.stderr)
700 test_done "$testroot" "$ret"
703 test_commit_gotconfig_author() {
704 local testroot=`test_init commit_gotconfig_author`
706 got checkout $testroot/repo $testroot/wt > /dev/null
708 if [ "$ret" != "0" ]; then
709 test_done "$testroot" "$ret"
712 echo 'author "Flan Luck <flan_luck@openbsd.org>"' \
713 > $testroot/repo/.git/got.conf
715 echo "modified alpha" > $testroot/wt/alpha
716 (cd $testroot/wt && got commit -m 'test gotconfig author' > /dev/null)
718 if [ "$ret" != "0" ]; then
719 test_done "$testroot" "$ret"
723 (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
725 if [ "$ret" != "0" ]; then
726 test_done "$testroot" "$ret"
730 echo "from: Flan Luck <flan_luck@openbsd.org>" \
731 > $testroot/stdout.expected
732 cmp -s $testroot/stdout.expected $testroot/stdout
734 if [ "$ret" != "0" ]; then
735 diff -u $testroot/stdout.expected $testroot/stdout
737 test_done "$testroot" "$ret"
740 test_commit_gotconfig_worktree_author() {
741 local testroot=`test_init commit_gotconfig_worktree_author`
743 got checkout $testroot/repo $testroot/wt > /dev/null
745 if [ "$ret" != "0" ]; then
746 test_done "$testroot" "$ret"
749 echo 'author "Flan Luck <flan_luck@openbsd.org>"' \
750 > $testroot/repo/.git/got.conf
751 echo 'author "Flan Squee <flan_squee@openbsd.org>"' \
752 > $testroot/wt/.got/got.conf
754 echo "modified alpha" > $testroot/wt/alpha
755 (cd $testroot/wt && got commit -m 'test gotconfig author' > /dev/null)
757 if [ "$ret" != "0" ]; then
758 test_done "$testroot" "$ret"
762 (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
764 if [ "$ret" != "0" ]; then
765 test_done "$testroot" "$ret"
769 echo "from: Flan Squee <flan_squee@openbsd.org>" \
770 > $testroot/stdout.expected
771 cmp -s $testroot/stdout.expected $testroot/stdout
773 if [ "$ret" != "0" ]; then
774 diff -u $testroot/stdout.expected $testroot/stdout
776 test_done "$testroot" "$ret"
779 test_commit_gitconfig_author() {
780 local testroot=`test_init commit_gitconfig_author`
782 got checkout $testroot/repo $testroot/wt > /dev/null
784 if [ "$ret" != "0" ]; then
785 test_done "$testroot" "$ret"
789 (cd $testroot/repo && git config user.name 'Flan Luck')
790 (cd $testroot/repo && git config user.email 'flan_luck@openbsd.org')
792 echo "modified alpha" > $testroot/wt/alpha
793 (cd $testroot/wt && got commit -m 'test gitconfig author' > /dev/null)
795 if [ "$ret" != "0" ]; then
796 test_done "$testroot" "$ret"
800 (cd $testroot/repo && got log -l1 | grep ^from: > $testroot/stdout)
802 if [ "$ret" != "0" ]; then
803 test_done "$testroot" "$ret"
807 echo "from: Flan Luck <flan_luck@openbsd.org>" \
808 > $testroot/stdout.expected
809 cmp -s $testroot/stdout.expected $testroot/stdout
811 if [ "$ret" != "0" ]; then
812 diff -u $testroot/stdout.expected $testroot/stdout
814 test_done "$testroot" "$ret"
817 test_commit_xbit_change() {
818 local testroot=`test_init commit_xbit_change`
820 got checkout $testroot/repo $testroot/wt > /dev/null
822 if [ "$ret" != "0" ]; then
823 test_done "$testroot" "$ret"
827 chmod +x $testroot/wt/alpha
829 echo 'm alpha' > $testroot/stdout.expected
830 (cd $testroot/wt && got status > $testroot/stdout)
832 cmp -s $testroot/stdout.expected $testroot/stdout
834 if [ "$ret" != "0" ]; then
835 diff -u $testroot/stdout.expected $testroot/stdout
836 test_done "$testroot" "$ret"
840 (cd $testroot/wt && got commit -mx > $testroot/stdout)
842 if [ "$ret" != "0" ]; then
843 echo "got commit failed unexpectedly"
844 test_done "$testroot" "$ret"
848 local commit_id=`git_show_head $testroot/repo`
849 echo 'm alpha' > $testroot/stdout.expected
850 echo "Created commit $commit_id" >> $testroot/stdout.expected
851 cmp -s $testroot/stdout.expected $testroot/stdout
853 if [ "$ret" != "0" ]; then
854 diff -u $testroot/stdout.expected $testroot/stdout
855 test_done "$testroot" "$ret"
859 (cd $testroot/wt && got status > $testroot/stdout)
861 echo -n > $testroot/stdout.expected
862 cmp -s $testroot/stdout.expected $testroot/stdout
864 if [ "$ret" != "0" ]; then
865 diff -u $testroot/stdout.expected $testroot/stdout
866 test_done "$testroot" "$ret"
870 chmod -x $testroot/wt/alpha
872 echo 'm alpha' > $testroot/stdout.expected
873 (cd $testroot/wt && got status > $testroot/stdout)
875 cmp -s $testroot/stdout.expected $testroot/stdout
877 if [ "$ret" != "0" ]; then
878 diff -u $testroot/stdout.expected $testroot/stdout
879 test_done "$testroot" "$ret"
883 (cd $testroot/wt && got commit -mx > $testroot/stdout)
885 if [ "$ret" != "0" ]; then
886 echo "got commit failed unexpectedly"
887 test_done "$testroot" "$ret"
891 local commit_id=`git_show_head $testroot/repo`
892 echo 'm alpha' > $testroot/stdout.expected
893 echo "Created commit $commit_id" >> $testroot/stdout.expected
894 cmp -s $testroot/stdout.expected $testroot/stdout
896 if [ "$ret" != "0" ]; then
897 diff -u $testroot/stdout.expected $testroot/stdout
898 test_done "$testroot" "$ret"
902 chmod +x $testroot/wt/alpha
904 echo 'm alpha' > $testroot/stdout.expected
905 (cd $testroot/wt && got status > $testroot/stdout)
907 cmp -s $testroot/stdout.expected $testroot/stdout
909 if [ "$ret" != "0" ]; then
910 diff -u $testroot/stdout.expected $testroot/stdout
912 test_done "$testroot" "$ret"
915 commit_check_mode() {
917 local expected_mode="$2"
919 chmod 644 $testroot/wt/alpha
920 echo a >> $testroot/wt/alpha
921 chmod $mode $testroot/wt/alpha
923 (cd $testroot/wt && got commit -mm > $testroot/stdout)
925 if [ "$ret" != "0" ]; then
926 echo "got commit failed unexpectedly"
927 test_done "$testroot" "$ret"
931 local commit_id=`git_show_head $testroot/repo`
932 echo 'M alpha' > $testroot/stdout.expected
933 echo "Created commit $commit_id" >> $testroot/stdout.expected
934 cmp -s $testroot/stdout.expected $testroot/stdout
936 if [ "$ret" != "0" ]; then
937 diff -u $testroot/stdout.expected $testroot/stdout
938 test_done "$testroot" "$ret"
942 local tree_id=$(got cat -r $testroot/repo $commit_id | \
943 grep ^tree | cut -d' ' -f2)
944 local alpha_id=$(got cat -r $testroot/repo $tree_id | \
945 grep 'alpha$' | cut -d' ' -f1)
946 echo "$alpha_id $expected_mode alpha" > $testroot/stdout.expected
947 got cat -r $testroot/repo $tree_id | grep 'alpha$' > $testroot/stdout
948 cmp -s $testroot/stdout.expected $testroot/stdout
950 if [ "$ret" != "0" ]; then
951 diff -u $testroot/stdout.expected $testroot/stdout
956 test_commit_normalizes_filemodes() {
957 local testroot=`test_init commit_normalizes_filemodes`
959 got checkout $testroot/repo $testroot/wt > /dev/null
961 if [ "$ret" != "0" ]; then
962 test_done "$testroot" "$ret"
966 modes="600 400 460 640 440 660 444 666"
968 commit_check_mode "$m" "0100644"
970 if [ "$ret" != "0" ]; then
974 if [ "$ret" != "0" ]; then
975 test_done "$testroot" "$ret"
978 modes="700 500 570 750 550 770 555 777"
980 commit_check_mode "$m" "0100755"
982 if [ "$ret" != "0" ]; then
986 if [ "$ret" != "0" ]; then
987 test_done "$testroot" "$ret"
990 test_done "$testroot" "$ret"
993 test_commit_with_unrelated_submodule() {
994 local testroot=`test_init commit_with_unrelated_submodule`
996 make_single_file_repo $testroot/repo2 foo
998 (cd $testroot/repo && git submodule -q add ../repo2)
999 (cd $testroot/repo && git commit -q -m 'adding submodule')
1001 got checkout $testroot/repo $testroot/wt > /dev/null
1003 if [ "$ret" != "0" ]; then
1004 echo "checkout failed unexpectedly" >&2
1005 test_done "$testroot" "$ret"
1009 echo "modified alpha" > $testroot/wt/alpha
1011 echo "" > $testroot/stdout.expected
1013 (cd $testroot/wt && got commit -m 'modify alpha' > $testroot/stdout)
1015 if [ "$ret" != "0" ]; then
1016 echo "commit failed unexpectedly" >&2
1017 test_done "$testroot" "$ret"
1021 local head_rev=`git_show_head $testroot/repo`
1022 echo "M alpha" > $testroot/stdout.expected
1023 echo "Created commit $head_rev" >> $testroot/stdout.expected
1025 cmp -s $testroot/stdout.expected $testroot/stdout
1027 if [ "$ret" != "0" ]; then
1028 diff -u $testroot/stdout.expected $testroot/stdout
1030 test_done "$testroot" "$ret"
1035 if ! [ -h $wtpath/alpha.link ]; then
1036 echo "alpha.link is not a symlink"
1040 readlink $wtpath/alpha.link > $testroot/stdout
1041 echo "alpha" > $testroot/stdout.expected
1042 cmp -s $testroot/stdout.expected $testroot/stdout
1044 if [ "$ret" != "0" ]; then
1045 diff -u $testroot/stdout.expected $testroot/stdout
1049 if ! [ -h $wtpath/epsilon.link ]; then
1050 echo "epsilon.link is not a symlink"
1054 readlink $wtpath/epsilon.link > $testroot/stdout
1055 echo "epsilon" > $testroot/stdout.expected
1056 cmp -s $testroot/stdout.expected $testroot/stdout
1058 if [ "$ret" != "0" ]; then
1059 diff -u $testroot/stdout.expected $testroot/stdout
1063 if [ -h $wtpath/passwd.link ]; then
1064 echo -n "passwd.link is a symlink and points outside of work tree: " >&2
1065 readlink $wtpath/passwd.link >&2
1069 echo -n "/etc/passwd" > $testroot/content.expected
1070 cp $wtpath/passwd.link $testroot/content
1072 if [ "$ret" != "0" ]; then
1073 echo "cp command failed unexpectedly" >&2
1077 cmp -s $testroot/content.expected $testroot/content
1079 if [ "$ret" != "0" ]; then
1080 diff -u $testroot/content.expected $testroot/content
1084 readlink $wtpath/epsilon/beta.link > $testroot/stdout
1085 echo "../beta" > $testroot/stdout.expected
1086 cmp -s $testroot/stdout.expected $testroot/stdout
1088 if [ "$ret" != "0" ]; then
1089 diff -u $testroot/stdout.expected $testroot/stdout
1093 readlink $wtpath/nonexistent.link > $testroot/stdout
1094 echo "nonexistent" > $testroot/stdout.expected
1095 cmp -s $testroot/stdout.expected $testroot/stdout
1097 if [ "$ret" != "0" ]; then
1098 diff -u $testroot/stdout.expected $testroot/stdout
1105 test_commit_symlink() {
1106 local testroot=`test_init commit_symlink`
1108 got checkout $testroot/repo $testroot/wt > /dev/null
1110 if [ "$ret" != "0" ]; then
1111 test_done "$testroot" "$ret"
1115 (cd $testroot/wt && ln -s alpha alpha.link)
1116 (cd $testroot/wt && ln -s epsilon epsilon.link)
1117 (cd $testroot/wt && ln -s /etc/passwd passwd.link)
1118 (cd $testroot/wt && ln -s ../beta epsilon/beta.link)
1119 (cd $testroot/wt && ln -s nonexistent nonexistent.link)
1120 (cd $testroot/wt && got add alpha.link epsilon.link passwd.link \
1121 epsilon/beta.link nonexistent.link > /dev/null)
1123 (cd $testroot/wt && got commit -m 'test commit_symlink' \
1124 > $testroot/stdout 2> $testroot/stderr)
1126 if [ "$ret" = "0" ]; then
1127 echo "got commit succeeded unexpectedly" >&2
1128 test_done "$testroot" "$ret"
1131 echo -n "got: $testroot/wt/passwd.link: " > $testroot/stderr.expected
1132 echo "symbolic link points outside of paths under version control" \
1133 >> $testroot/stderr.expected
1134 cmp -s $testroot/stderr.expected $testroot/stderr
1136 if [ "$ret" != "0" ]; then
1137 diff -u $testroot/stderr.expected $testroot/stderr
1138 test_done "$testroot" "$ret"
1142 (cd $testroot/wt && got commit -S -m 'test commit_symlink' \
1145 local head_rev=`git_show_head $testroot/repo`
1146 echo "A alpha.link" > $testroot/stdout.expected
1147 echo "A epsilon.link" >> $testroot/stdout.expected
1148 echo "A nonexistent.link" >> $testroot/stdout.expected
1149 echo "A passwd.link" >> $testroot/stdout.expected
1150 echo "A epsilon/beta.link" >> $testroot/stdout.expected
1151 echo "Created commit $head_rev" >> $testroot/stdout.expected
1153 cmp -s $testroot/stdout.expected $testroot/stdout
1155 if [ "$ret" != "0" ]; then
1156 diff -u $testroot/stdout.expected $testroot/stdout
1157 test_done "$testroot" "$ret"
1161 # verify created in-repository tree
1162 got checkout $testroot/repo $testroot/wt2 > /dev/null
1164 if [ "$ret" != "0" ]; then
1165 test_done "$testroot" "$ret"
1168 check_symlinks $testroot/wt2
1170 if [ "$ret" != "0" ]; then
1171 test_done "$testroot" "$ret"
1175 if ! [ -h $testroot/wt/passwd.link ]; then
1176 echo 'passwd.link is not a symlink' >&2
1177 test_done "$testroot" 1
1181 # 'got update' should reinstall passwd.link as a regular file
1182 (cd $testroot/wt && got update > /dev/null)
1183 check_symlinks $testroot/wt
1185 if [ "$ret" != "0" ]; then
1186 test_done "$testroot" "$ret"
1190 (cd $testroot/wt && ln -sf beta alpha.link)
1191 (cd $testroot/wt && ln -sfT gamma epsilon.link)
1192 rm $testroot/wt/epsilon/beta.link
1193 echo "this is a regular file" > $testroot/wt/epsilon/beta.link
1194 (cd $testroot/wt && ln -sf .got/bar dotgotbar.link)
1195 (cd $testroot/wt && got add dotgotbar.link > /dev/null)
1196 (cd $testroot/wt && got rm nonexistent.link > /dev/null)
1197 (cd $testroot/wt && ln -sf gamma/delta zeta.link)
1198 (cd $testroot/wt && ln -sf alpha new.link)
1199 (cd $testroot/wt && got add new.link > /dev/null)
1201 (cd $testroot/wt && got commit -m 'test commit_symlink' \
1202 > $testroot/stdout 2> $testroot/stderr)
1204 if [ "$ret" = "0" ]; then
1205 echo "got commit succeeded unexpectedly" >&2
1206 test_done "$testroot" "$ret"
1209 echo -n "got: $testroot/wt/dotgotbar.link: " > $testroot/stderr.expected
1210 echo "symbolic link points outside of paths under version control" \
1211 >> $testroot/stderr.expected
1212 cmp -s $testroot/stderr.expected $testroot/stderr
1214 if [ "$ret" != "0" ]; then
1215 diff -u $testroot/stderr.expected $testroot/stderr
1216 test_done "$testroot" "$ret"
1220 (cd $testroot/wt && got commit -S -m 'test commit_symlink' \
1223 local head_rev=`git_show_head $testroot/repo`
1224 echo "A dotgotbar.link" > $testroot/stdout.expected
1225 echo "A new.link" >> $testroot/stdout.expected
1226 echo "M alpha.link" >> $testroot/stdout.expected
1227 echo "M epsilon/beta.link" >> $testroot/stdout.expected
1228 echo "M epsilon.link" >> $testroot/stdout.expected
1229 echo "D nonexistent.link" >> $testroot/stdout.expected
1230 echo "Created commit $head_rev" >> $testroot/stdout.expected
1232 cmp -s $testroot/stdout.expected $testroot/stdout
1234 if [ "$ret" != "0" ]; then
1235 diff -u $testroot/stdout.expected $testroot/stdout
1236 test_done "$testroot" "$ret"
1240 got tree -r $testroot/repo -c $head_rev -R > $testroot/stdout
1241 cat > $testroot/stdout.expected <<EOF
1245 dotgotbar.link@ -> .got/bar
1249 epsilon.link@ -> gamma
1253 passwd.link@ -> /etc/passwd
1255 cmp -s $testroot/stdout.expected $testroot/stdout
1257 if [ "$ret" != "0" ]; then
1258 diff -u $testroot/stdout.expected $testroot/stdout
1260 test_done "$testroot" "$ret"
1263 test_commit_fix_bad_symlink() {
1264 local testroot=`test_init commit_fix_bad_symlink`
1266 got checkout $testroot/repo $testroot/wt > /dev/null
1268 if [ "$ret" != "0" ]; then
1269 echo "got checkout failed unexpectedly" >&2
1270 test_done "$testroot" "$ret"
1274 (cd $testroot/wt && ln -s /etc/passwd passwd.link)
1275 (cd $testroot/wt && got add passwd.link > /dev/null)
1277 (cd $testroot/wt && got commit -S -m 'commit bad symlink' \
1280 if ! [ -h $testroot/wt/passwd.link ]; then
1281 echo 'passwd.link is not a symlink' >&2
1282 test_done "$testroot" 1
1285 (cd $testroot/wt && got update >/dev/null)
1286 if [ -h $testroot/wt/passwd.link ]; then
1287 echo "passwd.link is a symlink but should be a regular file" >&2
1288 test_done "$testroot" "1"
1292 # create another work tree which will contain the "bad" symlink
1293 got checkout $testroot/repo $testroot/wt2 > /dev/null
1295 if [ "$ret" != "0" ]; then
1296 echo "got checkout failed unexpectedly" >&2
1297 test_done "$testroot" "$ret"
1301 # change "bad" symlink back into a "good" symlink
1302 (cd $testroot/wt && ln -sfT alpha passwd.link)
1304 (cd $testroot/wt && got commit -m 'fix bad symlink' \
1307 local head_rev=`git_show_head $testroot/repo`
1308 echo "M passwd.link" > $testroot/stdout.expected
1309 echo "Created commit $head_rev" >> $testroot/stdout.expected
1311 cmp -s $testroot/stdout.expected $testroot/stdout
1313 if [ "$ret" != "0" ]; then
1314 diff -u $testroot/stdout.expected $testroot/stdout
1315 test_done "$testroot" "$ret"
1319 if ! [ -h $testroot/wt/passwd.link ]; then
1320 echo 'passwd.link is not a symlink' >&2
1321 test_done "$testroot" 1
1325 readlink $testroot/wt/passwd.link > $testroot/stdout
1326 echo "alpha" > $testroot/stdout.expected
1327 cmp -s $testroot/stdout.expected $testroot/stdout
1329 if [ "$ret" != "0" ]; then
1330 diff -u $testroot/stdout.expected $testroot/stdout
1334 # Update the other work tree; the bad symlink should be fixed
1335 (cd $testroot/wt2 && got update > /dev/null)
1337 if [ "$ret" != "0" ]; then
1338 echo "got checkout failed unexpectedly" >&2
1339 test_done "$testroot" "$ret"
1343 if ! [ -h $testroot/wt2/passwd.link ]; then
1344 echo 'passwd.link is not a symlink' >&2
1345 test_done "$testroot" 1
1349 readlink $testroot/wt2/passwd.link > $testroot/stdout
1350 echo "alpha" > $testroot/stdout.expected
1351 cmp -s $testroot/stdout.expected $testroot/stdout
1353 if [ "$ret" != "0" ]; then
1354 diff -u $testroot/stdout.expected $testroot/stdout
1358 test_done "$testroot" "0"
1361 test_commit_prepared_logmsg() {
1362 local testroot=`test_init commit_prepared_logmsg`
1364 got checkout $testroot/repo $testroot/wt > /dev/null
1366 if [ "$ret" != "0" ]; then
1367 test_done "$testroot" "$ret"
1371 echo "modified alpha" > $testroot/wt/alpha
1372 (cd $testroot/wt && got rm beta >/dev/null)
1373 echo "new file" > $testroot/wt/new
1374 (cd $testroot/wt && got add new >/dev/null)
1376 echo 'test commit_prepared_logmsg' > $testroot/logmsg
1378 cat > $testroot/editor.sh <<EOF
1381 [ "\$OSTYPE" = "linux-gnu" ] && SOPTS="-i"
1382 sed "\$SOPTS" -e 's/foo/bar/' "\$1"
1384 chmod +x $testroot/editor.sh
1386 (cd $testroot/wt && env VISUAL="$testroot/editor.sh" \
1387 got commit -F "$testroot/logmsg" > $testroot/stdout)
1389 local head_rev=`git_show_head $testroot/repo`
1390 echo "A new" > $testroot/stdout.expected
1391 echo "M alpha" >> $testroot/stdout.expected
1392 echo "D beta" >> $testroot/stdout.expected
1393 echo "Created commit $head_rev" >> $testroot/stdout.expected
1395 cmp -s $testroot/stdout.expected $testroot/stdout
1397 if [ "$ret" != "0" ]; then
1398 diff -u $testroot/stdout.expected $testroot/stdout
1399 test_done "$testroot" "$ret"
1403 local author_time=`git_show_author_time $testroot/repo`
1404 local prev_LC_TIME="$LC_TIME"
1406 d=`date -u -d "@$author_time" +"%a %b %e %X %Y UTC"`
1407 LC_TIME="$prev_LC_TIME"
1408 echo "-----------------------------------------------" > $testroot/stdout.expected
1409 echo "commit $head_rev (master)" >> $testroot/stdout.expected
1410 echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
1411 echo "date: $d" >> $testroot/stdout.expected
1412 echo " " >> $testroot/stdout.expected
1413 echo " test commit_prepared_logmsg" >> $testroot/stdout.expected
1414 echo " " >> $testroot/stdout.expected
1416 (cd $testroot/wt && got log -l 1 > $testroot/stdout)
1417 cmp -s $testroot/stdout.expected $testroot/stdout
1419 if [ "$ret" != "0" ]; then
1420 diff -u $testroot/stdout.expected $testroot/stdout
1421 test_done "$testroot" "$ret"
1425 echo "modified alpha again" > $testroot/wt/alpha
1427 echo 'test commit_prepared_logmsg non-interactive' \
1430 (cd $testroot/wt && got commit -N -F "$testroot/logmsg" \
1433 local head_rev=`git_show_head $testroot/repo`
1434 echo "M alpha" > $testroot/stdout.expected
1435 echo "Created commit $head_rev" >> $testroot/stdout.expected
1437 cmp -s $testroot/stdout.expected $testroot/stdout
1439 if [ "$ret" != "0" ]; then
1440 diff -u $testroot/stdout.expected $testroot/stdout
1441 test_done "$testroot" "$ret"
1445 local author_time=`git_show_author_time $testroot/repo`
1446 local prev_LC_TIME="$LC_TIME"
1448 d=`date -u -d "@$author_time" +"%a %b %e %X %Y UTC"`
1449 LC_TIME="$prev_LC_TIME"
1450 echo "-----------------------------------------------" \
1451 > $testroot/stdout.expected
1452 echo "commit $head_rev (master)" >> $testroot/stdout.expected
1453 echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
1454 echo "date: $d" >> $testroot/stdout.expected
1455 echo " " >> $testroot/stdout.expected
1456 echo " test commit_prepared_logmsg non-interactive" \
1457 >> $testroot/stdout.expected
1458 echo " " >> $testroot/stdout.expected
1460 (cd $testroot/wt && got log -l 1 > $testroot/stdout)
1461 cmp -s $testroot/stdout.expected $testroot/stdout
1463 if [ "$ret" != "0" ]; then
1464 diff -u $testroot/stdout.expected $testroot/stdout
1466 test_done "$testroot" "$ret"
1469 test_commit_large_file() {
1470 local testroot=`test_init commit_large_file`
1472 got checkout $testroot/repo $testroot/wt > /dev/null
1474 if [ "$ret" != "0" ]; then
1475 test_done "$testroot" "$ret"
1479 dd status=none if=/dev/zero of=$testroot/wt/new bs=1m count=64
1480 (cd $testroot/wt && got add new >/dev/null)
1482 (cd $testroot/wt && got commit -m 'test commit_large_file' \
1485 local head_rev=`git_show_head $testroot/repo`
1486 echo "A new" > $testroot/stdout.expected
1487 echo "Created commit $head_rev" >> $testroot/stdout.expected
1489 cmp -s $testroot/stdout.expected $testroot/stdout
1491 if [ "$ret" != "0" ]; then
1492 diff -u $testroot/stdout.expected $testroot/stdout
1493 test_done "$testroot" "$ret"
1497 new_id=`get_blob_id $testroot/repo "" new`
1498 got cat -r $testroot/repo $new_id > $testroot/new
1500 if [ "$ret" != "0" ]; then
1501 echo "commit failed unexpectedly" >&2
1502 test_done "$testroot" "1"
1506 cmp -s $testroot/new $testroot/wt/new
1508 if [ "$ret" != "0" ]; then
1509 diff -u $testroot/new $testroot/wt/new
1511 test_done "$testroot" "$ret"
1518 run_test test_commit_basic
1519 run_test test_commit_new_subdir
1520 run_test test_commit_subdir
1521 run_test test_commit_single_file
1522 run_test test_commit_out_of_date
1523 run_test test_commit_added_subdirs
1524 run_test test_commit_deleted_subdirs
1525 run_test test_commit_rejects_conflicted_file
1526 run_test test_commit_single_file_multiple
1527 run_test test_commit_added_and_modified_in_same_dir
1528 run_test test_commit_path_prefix
1529 run_test test_commit_dir_path
1530 run_test test_commit_selected_paths
1531 run_test test_commit_outside_refs_heads
1532 run_test test_commit_no_email
1533 run_test test_commit_tree_entry_sorting
1534 run_test test_commit_gotconfig_author
1535 run_test test_commit_gotconfig_worktree_author
1536 run_test test_commit_gitconfig_author
1537 run_test test_commit_xbit_change
1538 run_test test_commit_normalizes_filemodes
1539 run_test test_commit_with_unrelated_submodule
1540 run_test test_commit_symlink
1541 run_test test_commit_fix_bad_symlink
1542 run_test test_commit_prepared_logmsg
1543 run_test test_commit_large_file