]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3205-branch-color.sh
The third batch
[thirdparty/git.git] / t / t3205-branch-color.sh
CommitLineData
34d820ee
JK
1#!/bin/sh
2
3test_description='basic branch output coloring'
288a4806 4TEST_PASSES_SANITIZE_LEAK=true
34d820ee
JK
5. ./test-lib.sh
6
7test_expect_success 'set up some sample branches' '
8 test_commit foo &&
654bd7e8
JS
9 git branch -M main &&
10 git update-ref refs/remotes/origin/main HEAD &&
34d820ee
JK
11 git update-ref refs/heads/other HEAD
12'
13
14# choose non-default colors to make sure config
15# is taking effect
16test_expect_success 'set up some color config' '
34d820ee
JK
17 git config color.branch.local blue &&
18 git config color.branch.remote yellow &&
19 git config color.branch.current cyan
20'
21
22test_expect_success 'regular output shows colors' '
23 cat >expect <<-\EOF &&
654bd7e8 24 * <CYAN>main<RESET>
34d820ee 25 <BLUE>other<RESET>
654bd7e8 26 <YELLOW>remotes/origin/main<RESET>
34d820ee 27 EOF
8126b126 28 git branch --color -a >actual.raw &&
34d820ee
JK
29 test_decode_color <actual.raw >actual &&
30 test_cmp expect actual
31'
32
654bd7e8 33test_expect_success 'verbose output shows colors' '
34d820ee
JK
34 oid=$(git rev-parse --short HEAD) &&
35 cat >expect <<-EOF &&
66713e84
JS
36 * <CYAN>main <RESET> $oid foo
37 <BLUE>other <RESET> $oid foo
38 <YELLOW>remotes/origin/main<RESET> $oid foo
34d820ee 39 EOF
8126b126 40 git branch --color -v -a >actual.raw &&
34d820ee
JK
41 test_decode_color <actual.raw >actual &&
42 test_cmp expect actual
43'
44
45test_done