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