Blame


1 cbd1af7a 2019-03-18 stsp #!/bin/sh
2 cbd1af7a 2019-03-18 stsp #
3 cbd1af7a 2019-03-18 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 cbd1af7a 2019-03-18 stsp #
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.
8 cbd1af7a 2019-03-18 stsp #
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.
16 cbd1af7a 2019-03-18 stsp
17 cbd1af7a 2019-03-18 stsp . ./common.sh
18 cbd1af7a 2019-03-18 stsp
19 cbd1af7a 2019-03-18 stsp function test_log_in_worktree {
20 cbd1af7a 2019-03-18 stsp local testroot=`test_init log_in_worktree`
21 cbd1af7a 2019-03-18 stsp local head_rev=`git_show_head $testroot/repo`
22 cbd1af7a 2019-03-18 stsp
23 cbd1af7a 2019-03-18 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 cbd1af7a 2019-03-18 stsp ret="$?"
25 cbd1af7a 2019-03-18 stsp if [ "$ret" != "0" ]; then
26 cbd1af7a 2019-03-18 stsp test_done "$testroot" "$ret"
27 cbd1af7a 2019-03-18 stsp return 1
28 cbd1af7a 2019-03-18 stsp fi
29 cbd1af7a 2019-03-18 stsp
30 cbd1af7a 2019-03-18 stsp echo "commit $head_rev (master)" > $testroot/stdout.expected
31 cbd1af7a 2019-03-18 stsp
32 cbd1af7a 2019-03-18 stsp for p in "" "." alpha epsilon; do
33 cbd1af7a 2019-03-18 stsp (cd $testroot/wt && got log $p | \
34 cbd1af7a 2019-03-18 stsp grep ^commit > $testroot/stdout)
35 cbd1af7a 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
36 cbd1af7a 2019-03-18 stsp ret="$?"
37 cbd1af7a 2019-03-18 stsp if [ "$ret" != "0" ]; then
38 cbd1af7a 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
39 cbd1af7a 2019-03-18 stsp test_done "$testroot" "$ret"
40 cbd1af7a 2019-03-18 stsp return 1
41 cbd1af7a 2019-03-18 stsp fi
42 cbd1af7a 2019-03-18 stsp done
43 cbd1af7a 2019-03-18 stsp
44 cbd1af7a 2019-03-18 stsp for p in "" "." zeta; do
45 cbd1af7a 2019-03-18 stsp (cd $testroot/wt/epsilon && got log $p | \
46 cbd1af7a 2019-03-18 stsp grep ^commit > $testroot/stdout)
47 cbd1af7a 2019-03-18 stsp cmp $testroot/stdout.expected $testroot/stdout
48 cbd1af7a 2019-03-18 stsp ret="$?"
49 cbd1af7a 2019-03-18 stsp if [ "$ret" != "0" ]; then
50 cbd1af7a 2019-03-18 stsp diff -u $testroot/stdout.expected $testroot/stdout
51 cbd1af7a 2019-03-18 stsp test_done "$testroot" "$ret"
52 cbd1af7a 2019-03-18 stsp return 1
53 cbd1af7a 2019-03-18 stsp fi
54 cbd1af7a 2019-03-18 stsp done
55 cbd1af7a 2019-03-18 stsp
56 cbd1af7a 2019-03-18 stsp test_done "$testroot" "0"
57 cbd1af7a 2019-03-18 stsp }
58 cbd1af7a 2019-03-18 stsp
59 cbd1af7a 2019-03-18 stsp run_test test_log_in_worktree