Merge branch 'master' of github.com:Softcatala/git-po
[git/debian.git] / t / t3205-branch-color.sh
blob08bd906173bd6f1c45103ee69608472a0631064d
1 #!/bin/sh
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-lib.sh
9 test_expect_success 'set up some sample branches' '
10 test_commit foo &&
11 git branch -M main &&
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
17 # is taking effect
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 &&
26 * <CYAN>main<RESET>
27 <BLUE>other<RESET>
28 <YELLOW>remotes/origin/main<RESET>
29 EOF
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) &&
37 cat >expect <<-EOF &&
38 * <CYAN>main <RESET> $oid foo
39 <BLUE>other <RESET> $oid foo
40 <YELLOW>remotes/origin/main<RESET> $oid foo
41 EOF
42 git branch --color -v -a >actual.raw &&
43 test_decode_color <actual.raw >actual &&
44 test_cmp expect actual
47 test_done