test-line-buffer: simplify command parsing
[git.git] / t / t3205-branch-color.sh
blob9343550f50a011ff563c1455384cd1b14fd83888
1 #!/bin/sh
3 test_description='basic branch output coloring'
4 . ./test-lib.sh
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
12 # choose non-default colors to make sure config
13 # is taking effect
14 test_expect_success 'set up some color config' '
15 git config color.branch always &&
16 git config color.branch.local blue &&
17 git config color.branch.remote yellow &&
18 git config color.branch.current cyan
21 test_expect_success 'regular output shows colors' '
22 cat >expect <<-\EOF &&
23 * <CYAN>master<RESET>
24 <BLUE>other<RESET>
25 <YELLOW>remotes/origin/master<RESET>
26 EOF
27 git branch -a >actual.raw &&
28 test_decode_color <actual.raw >actual &&
29 test_cmp expect actual
32 test_expect_success 'verbose output shows colors' '
33 oid=$(git rev-parse --short HEAD) &&
34 cat >expect <<-EOF &&
35 * <CYAN>master <RESET> $oid foo
36 <BLUE>other <RESET> $oid foo
37 <YELLOW>remotes/origin/master<RESET> $oid foo
38 EOF
39 git branch -v -a >actual.raw &&
40 test_decode_color <actual.raw >actual &&
41 test_cmp expect actual
44 test_done