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