]> git.ipfire.org Git - thirdparty/git.git/blame - t/t8012-blame-colors.sh
The sixth batch
[thirdparty/git.git] / t / t8012-blame-colors.sh
CommitLineData
cdc2d5f1
SB
1#!/bin/sh
2
3test_description='colored git blame'
4. ./test-lib.sh
5
6PROG='git blame -c'
7. "$TEST_DIRECTORY"/annotate-tests.sh
8
9test_expect_success 'colored blame colors contiguous lines' '
10 git -c color.blame.repeatedLines=yellow blame --color-lines --abbrev=12 hello.c >actual.raw &&
0dc95a4d
SB
11 git -c color.blame.repeatedLines=yellow -c blame.coloring=repeatedLines blame --abbrev=12 hello.c >actual.raw.2 &&
12 test_cmp actual.raw actual.raw.2 &&
cdc2d5f1
SB
13 test_decode_color <actual.raw >actual &&
14 grep "<YELLOW>" <actual >darkened &&
15 grep "(F" darkened > F.expect &&
16 grep "(H" darkened > H.expect &&
17 test_line_count = 2 F.expect &&
18 test_line_count = 3 H.expect
19'
20
25d5f529
SB
21test_expect_success 'color by age consistently colors old code' '
22 git blame --color-by-age hello.c >actual.raw &&
0dc95a4d
SB
23 git -c blame.coloring=highlightRecent blame hello.c >actual.raw.2 &&
24 test_cmp actual.raw actual.raw.2 &&
25d5f529
SB
25 test_decode_color <actual.raw >actual &&
26 grep "<BLUE>" <actual >colored &&
27 test_line_count = 10 colored
28'
29
30test_expect_success 'blame color by age: new code is different' '
31 cat >>hello.c <<-EOF &&
32 void qfunc();
33 EOF
34 git add hello.c &&
35 GIT_AUTHOR_DATE="" git commit -m "new commit" &&
36
37 git -c color.blame.highlightRecent="yellow,1 month ago, cyan" blame --color-by-age hello.c >actual.raw &&
38 test_decode_color <actual.raw >actual &&
39
40 grep "<YELLOW>" <actual >colored &&
41 test_line_count = 10 colored &&
42
43 grep "<CYAN>" <actual >colored &&
44 test_line_count = 1 colored &&
45 grep qfunc colored
46'
47
cdc2d5f1 48test_done