Git 2.45
[git/gitster.git] / t / t3205-branch-color.sh
blob0b61da92b37763213e4cee3744f127971cb6fcb1
1 #!/bin/sh
3 test_description='basic branch output coloring'
4 TEST_PASSES_SANITIZE_LEAK=true
5 . ./test-lib.sh
7 test_expect_success 'set up some sample branches' '
8 test_commit foo &&
9 git branch -M main &&
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
15 # is taking effect
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 &&
24 * <CYAN>main<RESET>
25 <BLUE>other<RESET>
26 <YELLOW>remotes/origin/main<RESET>
27 EOF
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) &&
35 cat >expect <<-EOF &&
36 * <CYAN>main <RESET> $oid foo
37 <BLUE>other <RESET> $oid foo
38 <YELLOW>remotes/origin/main<RESET> $oid foo
39 EOF
40 git branch --color -v -a >actual.raw &&
41 test_decode_color <actual.raw >actual &&
42 test_cmp expect actual
45 test_done