Blame


1 c4296144 2019-05-09 stsp #!/bin/sh
2 c4296144 2019-05-09 stsp #
3 c4296144 2019-05-09 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 c4296144 2019-05-09 stsp #
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.
8 c4296144 2019-05-09 stsp #
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.
16 c4296144 2019-05-09 stsp
17 c4296144 2019-05-09 stsp . ./common.sh
18 c4296144 2019-05-09 stsp
19 c4296144 2019-05-09 stsp function test_commit_basic {
20 c4296144 2019-05-09 stsp local testroot=`test_init commit_basic`
21 c4296144 2019-05-09 stsp
22 c4296144 2019-05-09 stsp got checkout $testroot/repo $testroot/wt > /dev/null
23 c4296144 2019-05-09 stsp ret="$?"
24 c4296144 2019-05-09 stsp if [ "$ret" != "0" ]; then
25 c4296144 2019-05-09 stsp test_done "$testroot" "$ret"
26 c4296144 2019-05-09 stsp return 1
27 c4296144 2019-05-09 stsp fi
28 c4296144 2019-05-09 stsp
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 "unversioned file" > $testroot/wt/foo
32 c4296144 2019-05-09 stsp rm $testroot/wt/epsilon/zeta
33 c4296144 2019-05-09 stsp touch $testroot/wt/beta
34 c4296144 2019-05-09 stsp echo "new file" > $testroot/wt/new
35 c4296144 2019-05-09 stsp (cd $testroot/wt && got add new >/dev/null)
36 c4296144 2019-05-09 stsp
37 c4296144 2019-05-09 stsp (cd $testroot/wt && got commit -m 'test commit_basic' > $testroot/stdout)
38 c4296144 2019-05-09 stsp
39 c4296144 2019-05-09 stsp local head_rev=`git_show_head $testroot/repo`
40 c4296144 2019-05-09 stsp echo "M alpha" > $testroot/stdout.expected
41 c4296144 2019-05-09 stsp echo "D beta" >> $testroot/stdout.expected
42 c4296144 2019-05-09 stsp echo "A new" >> $testroot/stdout.expected
43 c4296144 2019-05-09 stsp echo "created commit $head_rev" >> $testroot/stdout.expected
44 c4296144 2019-05-09 stsp
45 c4296144 2019-05-09 stsp cmp $testroot/stdout.expected $testroot/stdout
46 c4296144 2019-05-09 stsp ret="$?"
47 c4296144 2019-05-09 stsp if [ "$ret" != "0" ]; then
48 c4296144 2019-05-09 stsp diff -u $testroot/stdout.expected $testroot/stdout
49 c4296144 2019-05-09 stsp fi
50 c4296144 2019-05-09 stsp test_done "$testroot" "$ret"
51 c4296144 2019-05-09 stsp }
52 c4296144 2019-05-09 stsp
53 c4296144 2019-05-09 stsp run_test test_commit_basic