2.36 fast-export regression fix
[git.git] / t / t8012-blame-colors.sh
blob90c75dbb283fce796847f51546a04691e0521de8
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-lib.sh
9 PROG='git blame -c'
10 . "$TEST_DIRECTORY"/annotate-tests.sh
12 test_expect_success 'colored blame colors contiguous lines' '
13 git -c color.blame.repeatedLines=yellow blame --color-lines --abbrev=12 hello.c >actual.raw &&
14 git -c color.blame.repeatedLines=yellow -c blame.coloring=repeatedLines blame --abbrev=12 hello.c >actual.raw.2 &&
15 test_cmp actual.raw actual.raw.2 &&
16 test_decode_color <actual.raw >actual &&
17 grep "<YELLOW>" <actual >darkened &&
18 grep "(F" darkened > F.expect &&
19 grep "(H" darkened > H.expect &&
20 test_line_count = 2 F.expect &&
21 test_line_count = 3 H.expect
24 test_expect_success 'color by age consistently colors old code' '
25 git blame --color-by-age hello.c >actual.raw &&
26 git -c blame.coloring=highlightRecent blame hello.c >actual.raw.2 &&
27 test_cmp actual.raw actual.raw.2 &&
28 test_decode_color <actual.raw >actual &&
29 grep "<BLUE>" <actual >colored &&
30 test_line_count = 10 colored
33 test_expect_success 'blame color by age: new code is different' '
34 cat >>hello.c <<-EOF &&
35 void qfunc();
36 EOF
37 git add hello.c &&
38 GIT_AUTHOR_DATE="" git commit -m "new commit" &&
40 git -c color.blame.highlightRecent="yellow,1 month ago, cyan" blame --color-by-age hello.c >actual.raw &&
41 test_decode_color <actual.raw >actual &&
43 grep "<YELLOW>" <actual >colored &&
44 test_line_count = 10 colored &&
46 grep "<CYAN>" <actual >colored &&
47 test_line_count = 1 colored &&
48 grep qfunc colored
51 test_done