3 test_description
='basic branch output coloring'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9 test_expect_success
'set up some sample branches' '
12 git update-ref refs/remotes/origin/main HEAD &&
13 git update-ref refs/heads/other HEAD
16 # choose non-default colors to make sure config
18 test_expect_success
'set up some color config' '
19 git config color.branch.local blue &&
20 git config color.branch.remote yellow &&
21 git config color.branch.current cyan
24 test_expect_success
'regular output shows colors' '
25 cat >expect <<-\EOF &&
28 <YELLOW>remotes/origin/main<RESET>
30 git branch --color -a >actual.raw &&
31 test_decode_color <actual.raw >actual &&
32 test_cmp expect actual
35 test_expect_success
'verbose output shows colors' '
36 oid=$(git rev-parse --short HEAD) &&
38 * <CYAN>main <RESET> $oid foo
39 <BLUE>other <RESET> $oid foo
40 <YELLOW>remotes/origin/main<RESET> $oid foo
42 git branch --color -v -a >actual.raw &&
43 test_decode_color <actual.raw >actual &&
44 test_cmp expect actual