3 cbd1af7a 2019-03-18 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 cbd1af7a 2019-03-18 stsp # Permission to use, copy, modify, and distribute this software for any
6 cbd1af7a 2019-03-18 stsp # purpose with or without fee is hereby granted, provided that the above
7 cbd1af7a 2019-03-18 stsp # copyright notice and this permission notice appear in all copies.
9 cbd1af7a 2019-03-18 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 cbd1af7a 2019-03-18 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 cbd1af7a 2019-03-18 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 cbd1af7a 2019-03-18 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 cbd1af7a 2019-03-18 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 cbd1af7a 2019-03-18 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 cbd1af7a 2019-03-18 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 cbd1af7a 2019-03-18 stsp . ./common.sh
19 e7301579 2019-03-18 stsp function test_log_in_repo {
20 e7301579 2019-03-18 stsp local testroot=`test_init log_in_repo`
21 e7301579 2019-03-18 stsp local head_rev=`git_show_head $testroot/repo`
23 e7301579 2019-03-18 stsp echo "commit $head_rev (master)" > $testroot/stdout.expected
25 e7301579 2019-03-18 stsp for p in "" "." alpha epsilon epsilon/zeta; do
26 e7301579 2019-03-18 stsp (cd $testroot/repo && got log $p | \
27 e7301579 2019-03-18 stsp grep ^commit > $testroot/stdout)
28 e7301579 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
30 e7301579 2019-03-18 stsp if [ "$ret" != "0" ]; then
31 e7301579 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
32 e7301579 2019-03-18 stsp test_done "$testroot" "$ret"
37 b70703ad 2019-03-18 stsp for p in "" "." zeta; do
38 b70703ad 2019-03-18 stsp (cd $testroot/repo/epsilon && got log $p | \
39 b70703ad 2019-03-18 stsp grep ^commit > $testroot/stdout)
40 b70703ad 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
42 b70703ad 2019-03-18 stsp if [ "$ret" != "0" ]; then
43 b70703ad 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
44 b70703ad 2019-03-18 stsp test_done "$testroot" "$ret"
49 e7301579 2019-03-18 stsp test_done "$testroot" "0"
52 b70703ad 2019-03-18 stsp function test_log_in_bare_repo {
53 b70703ad 2019-03-18 stsp local testroot=`test_init log_in_bare_repo`
54 b70703ad 2019-03-18 stsp local head_rev=`git_show_head $testroot/repo`
56 b70703ad 2019-03-18 stsp echo "commit $head_rev (master)" > $testroot/stdout.expected
58 b70703ad 2019-03-18 stsp for p in "" "." alpha epsilon epsilon/zeta; do
59 b70703ad 2019-03-18 stsp (cd $testroot/repo/.git && got log $p | \
60 b70703ad 2019-03-18 stsp grep ^commit > $testroot/stdout)
61 b70703ad 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
63 b70703ad 2019-03-18 stsp if [ "$ret" != "0" ]; then
64 b70703ad 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
65 b70703ad 2019-03-18 stsp test_done "$testroot" "$ret"
70 b70703ad 2019-03-18 stsp test_done "$testroot" "0"
73 cbd1af7a 2019-03-18 stsp function test_log_in_worktree {
74 cbd1af7a 2019-03-18 stsp local testroot=`test_init log_in_worktree`
75 cbd1af7a 2019-03-18 stsp local head_rev=`git_show_head $testroot/repo`
77 cbd1af7a 2019-03-18 stsp got checkout $testroot/repo $testroot/wt > /dev/null
79 cbd1af7a 2019-03-18 stsp if [ "$ret" != "0" ]; then
80 cbd1af7a 2019-03-18 stsp test_done "$testroot" "$ret"
84 cbd1af7a 2019-03-18 stsp echo "commit $head_rev (master)" > $testroot/stdout.expected
86 cbd1af7a 2019-03-18 stsp for p in "" "." alpha epsilon; do
87 cbd1af7a 2019-03-18 stsp (cd $testroot/wt && got log $p | \
88 cbd1af7a 2019-03-18 stsp grep ^commit > $testroot/stdout)
89 cbd1af7a 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
91 cbd1af7a 2019-03-18 stsp if [ "$ret" != "0" ]; then
92 cbd1af7a 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
93 cbd1af7a 2019-03-18 stsp test_done "$testroot" "$ret"
98 cbd1af7a 2019-03-18 stsp for p in "" "." zeta; do
99 cbd1af7a 2019-03-18 stsp (cd $testroot/wt/epsilon && got log $p | \
100 cbd1af7a 2019-03-18 stsp grep ^commit > $testroot/stdout)
101 cbd1af7a 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
103 cbd1af7a 2019-03-18 stsp if [ "$ret" != "0" ]; then
104 cbd1af7a 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
105 cbd1af7a 2019-03-18 stsp test_done "$testroot" "$ret"
110 cbd1af7a 2019-03-18 stsp test_done "$testroot" "0"
113 e7301579 2019-03-18 stsp run_test test_log_in_repo
114 b70703ad 2019-03-18 stsp run_test test_log_in_bare_repo
115 cbd1af7a 2019-03-18 stsp run_test test_log_in_worktree