completion: add 'symbolic-ref'
[alt-git.git] / t / t8012-blame-colors.sh
blobc3a5f6d01ffe5cff12b868e7cbe5a09dacbef011
1 #!/bin/sh
3 test_description='colored git blame'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 TEST_CREATE_REPO_NO_TEMPLATE=1
8 . ./test-lib.sh
10 PROG='git blame -c'
11 . "$TEST_DIRECTORY"/annotate-tests.sh
13 test_expect_success 'colored blame colors contiguous lines' '
14 git -c color.blame.repeatedLines=yellow blame --color-lines --abbrev=12 hello.c >actual.raw &&
15 git -c color.blame.repeatedLines=yellow -c blame.coloring=repeatedLines blame --abbrev=12 hello.c >actual.raw.2 &&
16 test_cmp actual.raw actual.raw.2 &&
17 test_decode_color <actual.raw >actual &&
18 grep "<YELLOW>" <actual >darkened &&
19 grep "(F" darkened > F.expect &&
20 grep "(H" darkened > H.expect &&
21 test_line_count = 2 F.expect &&
22 test_line_count = 3 H.expect
25 test_expect_success 'color by age consistently colors old code' '
26 git blame --color-by-age hello.c >actual.raw &&
27 git -c blame.coloring=highlightRecent blame hello.c >actual.raw.2 &&
28 test_cmp actual.raw actual.raw.2 &&
29 test_decode_color <actual.raw >actual &&
30 grep "<BLUE>" <actual >colored &&
31 test_line_count = 10 colored
34 test_expect_success 'blame color by age: new code is different' '
35 cat >>hello.c <<-EOF &&
36 void qfunc();
37 EOF
38 git add hello.c &&
39 GIT_AUTHOR_DATE="" git commit -m "new commit" &&
41 git -c color.blame.highlightRecent="yellow,1 month ago, cyan" blame --color-by-age hello.c >actual.raw &&
42 test_decode_color <actual.raw >actual &&
44 grep "<YELLOW>" <actual >colored &&
45 test_line_count = 10 colored &&
47 grep "<CYAN>" <actual >colored &&
48 test_line_count = 1 colored &&
49 grep qfunc colored
52 test_done