3 8d212112 2023-04-16 mark # Copyright (c) 2023 Mark Jamsek <mark@jamsek.dev>
5 8d212112 2023-04-16 mark # Permission to use, copy, modify, and distribute this software for any
6 8d212112 2023-04-16 mark # purpose with or without fee is hereby granted, provided that the above
7 8d212112 2023-04-16 mark # copyright notice and this permission notice appear in all copies.
9 8d212112 2023-04-16 mark # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 8d212112 2023-04-16 mark # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 8d212112 2023-04-16 mark # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 8d212112 2023-04-16 mark # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 8d212112 2023-04-16 mark # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 8d212112 2023-04-16 mark # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 8d212112 2023-04-16 mark # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 8d212112 2023-04-16 mark . ./common.sh
19 8d212112 2023-04-16 mark test_blame_basic()
21 8d212112 2023-04-16 mark test_init blame_basic 80 8
23 8d212112 2023-04-16 mark local commit_id1=`git_show_head $testroot/repo`
25 8d212112 2023-04-16 mark got checkout $testroot/repo $testroot/wt > /dev/null
27 8d212112 2023-04-16 mark if [ $ret -ne 0 ]; then
28 8d212112 2023-04-16 mark test_done "$testroot" "$ret"
32 8d212112 2023-04-16 mark echo aaaa >> $testroot/wt/alpha
33 8d212112 2023-04-16 mark (cd $testroot/wt && got commit -m "a change" > /dev/null)
34 8d212112 2023-04-16 mark local commit_id2=`git_show_head $testroot/repo`
36 8d212112 2023-04-16 mark echo bbbb >> $testroot/wt/alpha
37 8d212112 2023-04-16 mark (cd $testroot/wt && got commit -m "b change" > /dev/null)
38 8d212112 2023-04-16 mark local commit_id3=`git_show_head $testroot/repo`
40 8d212112 2023-04-16 mark echo cccc >> $testroot/wt/alpha
41 8d212112 2023-04-16 mark (cd $testroot/wt && got commit -m "c change" > /dev/null)
42 8d212112 2023-04-16 mark local commit_id4=`git_show_head $testroot/repo`
43 8d212112 2023-04-16 mark local author_time=`git_show_author_time $testroot/repo`
44 8d212112 2023-04-16 mark local ymd=`date -u -r $author_time +"%G-%m-%d"`
46 8d212112 2023-04-16 mark cat <<EOF >$TOG_TEST_SCRIPT
47 8d212112 2023-04-16 mark WAIT_FOR_UI wait for blame to finish
51 8d212112 2023-04-16 mark local commit_id1_short=`trim_obj_id 32 $commit_id1`
52 8d212112 2023-04-16 mark local commit_id2_short=`trim_obj_id 32 $commit_id2`
53 8d212112 2023-04-16 mark local commit_id3_short=`trim_obj_id 32 $commit_id3`
54 8d212112 2023-04-16 mark local commit_id4_short=`trim_obj_id 32 $commit_id4`
56 8d212112 2023-04-16 mark cat <<EOF >$testroot/view.expected
57 8d212112 2023-04-16 mark commit $commit_id4
58 8d212112 2023-04-16 mark [1/4] /alpha
59 8d212112 2023-04-16 mark $commit_id1_short alpha
60 8d212112 2023-04-16 mark $commit_id2_short aaaa
61 8d212112 2023-04-16 mark $commit_id3_short bbbb
62 8d212112 2023-04-16 mark $commit_id4_short cccc
67 8d212112 2023-04-16 mark cd $testroot/wt && tog blame alpha
68 8d212112 2023-04-16 mark cmp -s $testroot/view.expected $testroot/view
70 8d212112 2023-04-16 mark if [ $ret -ne 0 ]; then
71 8d212112 2023-04-16 mark diff -u $testroot/view.expected $testroot/view
72 8d212112 2023-04-16 mark test_done "$testroot" "$ret"
76 8d212112 2023-04-16 mark test_done "$testroot" "$ret"
79 8d212112 2023-04-16 mark test_parseargs "$@"
80 8d212112 2023-04-16 mark run_test test_blame_basic