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