]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4207-log-decoration-colors.sh
tests: mark tests relying on the current default for `init.defaultBranch`
[thirdparty/git.git] / t / t4207-log-decoration-colors.sh
CommitLineData
56710281
NR
1#!/bin/sh
2#
3# Copyright (c) 2010 Nazri Ramliy
4#
5
6test_description='Test for "git log --decorate" colors'
7
334afbc7
JS
8GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
9export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
56710281
NR
11. ./test-lib.sh
12
56710281
NR
13test_expect_success setup '
14 git config diff.color.commit yellow &&
15 git config color.decorate.branch green &&
16 git config color.decorate.remoteBranch red &&
17 git config color.decorate.tag "reverse bold yellow" &&
18 git config color.decorate.stash magenta &&
19 git config color.decorate.HEAD cyan &&
20
097b681b 21 c_reset="<RESET>" &&
56710281 22
097b681b
JK
23 c_commit="<YELLOW>" &&
24 c_branch="<GREEN>" &&
25 c_remoteBranch="<RED>" &&
26 c_tag="<BOLD;REVERSE;YELLOW>" &&
27 c_stash="<MAGENTA>" &&
28 c_HEAD="<CYAN>" &&
56710281
NR
29
30 test_commit A &&
31 git clone . other &&
32 (
33 cd other &&
34 test_commit A1
35 ) &&
36
37 git remote add -f other ./other &&
38 test_commit B &&
39 git tag v1.0 &&
40 echo >>A.t &&
41 git stash save Changes to A.t
42'
43
44cat >expected <<EOF
a903e233 45${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD ->\
51ff0f27 46 ${c_reset}${c_branch}master${c_reset}${c_commit},\
5ee87585 47 ${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\
51ff0f27 48 ${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B
5ee87585
JH
49${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit},\
50 ${c_reset}${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1
51${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
56710281 52 On master: Changes to A.t
5ee87585 53${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
56710281
NR
54EOF
55
56# We want log to show all, but the second parent to refs/stash is irrelevant
57# to this test since it does not contain any decoration, hence --first-parent
58test_expect_success 'Commit Decorations Colored Correctly' '
59 git log --first-parent --abbrev=10 --all --decorate --oneline --color=always |
097b681b
JK
60 sed "s/[0-9a-f]\{10,10\}/COMMIT_ID/" |
61 test_decode_color >out &&
56710281
NR
62 test_cmp expected out
63'
64
65test_done