3 test_description
='basic branch output coloring'
4 TEST_PASSES_SANITIZE_LEAK
=true
7 test_expect_success
'set up some sample branches' '
10 git update-ref refs/remotes/origin/main HEAD &&
11 git update-ref refs/heads/other HEAD
14 # choose non-default colors to make sure config
16 test_expect_success
'set up some color config' '
17 git config color.branch.local blue &&
18 git config color.branch.remote yellow &&
19 git config color.branch.current cyan
22 test_expect_success
'regular output shows colors' '
23 cat >expect <<-\EOF &&
26 <YELLOW>remotes/origin/main<RESET>
28 git branch --color -a >actual.raw &&
29 test_decode_color <actual.raw >actual &&
30 test_cmp expect actual
33 test_expect_success
'verbose output shows colors' '
34 oid=$(git rev-parse --short HEAD) &&
36 * <CYAN>main <RESET> $oid foo
37 <BLUE>other <RESET> $oid foo
38 <YELLOW>remotes/origin/main<RESET> $oid foo
40 git branch --color -v -a >actual.raw &&
41 test_decode_color <actual.raw >actual &&
42 test_cmp expect actual