Blob


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