]>
Commit | Line | Data |
---|---|---|
34d820ee JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='basic branch output coloring' | |
4 | . ./test-lib.sh | |
5 | ||
6 | test_expect_success 'set up some sample branches' ' | |
7 | test_commit foo && | |
8 | git update-ref refs/remotes/origin/master HEAD && | |
9 | git update-ref refs/heads/other HEAD | |
10 | ' | |
11 | ||
12 | # choose non-default colors to make sure config | |
13 | # is taking effect | |
14 | test_expect_success 'set up some color config' ' | |
34d820ee JK |
15 | git config color.branch.local blue && |
16 | git config color.branch.remote yellow && | |
17 | git config color.branch.current cyan | |
18 | ' | |
19 | ||
20 | test_expect_success 'regular output shows colors' ' | |
21 | cat >expect <<-\EOF && | |
22 | * <CYAN>master<RESET> | |
23 | <BLUE>other<RESET> | |
24 | <YELLOW>remotes/origin/master<RESET> | |
25 | EOF | |
8126b126 | 26 | git branch --color -a >actual.raw && |
34d820ee JK |
27 | test_decode_color <actual.raw >actual && |
28 | test_cmp expect actual | |
29 | ' | |
30 | ||
31 | test_expect_success 'verbose output shows colors' ' | |
32 | oid=$(git rev-parse --short HEAD) && | |
33 | cat >expect <<-EOF && | |
34 | * <CYAN>master <RESET> $oid foo | |
35 | <BLUE>other <RESET> $oid foo | |
36 | <YELLOW>remotes/origin/master<RESET> $oid foo | |
37 | EOF | |
8126b126 | 38 | git branch --color -v -a >actual.raw && |
34d820ee JK |
39 | test_decode_color <actual.raw >actual && |
40 | test_cmp expect actual | |
41 | ' | |
42 | ||
43 | test_done |