mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
![Johannes Schindelin](/assets/img/avatar_default.png)
Carefully excluding t4013 and t4015, which see independent development elsewhere at the time of writing, we use `main` as the default branch name in t4*. This trick was performed via $ (cd t && sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \ -e 's/Master/Main/g' -- t4*.sh t4211/*.export && git checkout HEAD -- t4013\*) This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
66 lines
1.9 KiB
Bash
Executable file
66 lines
1.9 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2010 Nazri Ramliy
|
|
#
|
|
|
|
test_description='Test for "git log --decorate" colors'
|
|
|
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
git config diff.color.commit yellow &&
|
|
git config color.decorate.branch green &&
|
|
git config color.decorate.remoteBranch red &&
|
|
git config color.decorate.tag "reverse bold yellow" &&
|
|
git config color.decorate.stash magenta &&
|
|
git config color.decorate.HEAD cyan &&
|
|
|
|
c_reset="<RESET>" &&
|
|
|
|
c_commit="<YELLOW>" &&
|
|
c_branch="<GREEN>" &&
|
|
c_remoteBranch="<RED>" &&
|
|
c_tag="<BOLD;REVERSE;YELLOW>" &&
|
|
c_stash="<MAGENTA>" &&
|
|
c_HEAD="<CYAN>" &&
|
|
|
|
test_commit A &&
|
|
git clone . other &&
|
|
(
|
|
cd other &&
|
|
test_commit A1
|
|
) &&
|
|
|
|
git remote add -f other ./other &&
|
|
test_commit B &&
|
|
git tag v1.0 &&
|
|
echo >>A.t &&
|
|
git stash save Changes to A.t
|
|
'
|
|
|
|
cat >expected <<EOF
|
|
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD ->\
|
|
${c_reset}${c_branch}main${c_reset}${c_commit},\
|
|
${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\
|
|
${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B
|
|
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit},\
|
|
${c_reset}${c_remoteBranch}other/main${c_reset}${c_commit})${c_reset} A1
|
|
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
|
|
On main: Changes to A.t
|
|
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
|
|
EOF
|
|
|
|
# We want log to show all, but the second parent to refs/stash is irrelevant
|
|
# to this test since it does not contain any decoration, hence --first-parent
|
|
test_expect_success 'Commit Decorations Colored Correctly' '
|
|
git log --first-parent --abbrev=10 --all --decorate --oneline --color=always |
|
|
sed "s/[0-9a-f]\{10,10\}/COMMIT_ID/" |
|
|
test_decode_color >out &&
|
|
test_cmp expected out
|
|
'
|
|
|
|
test_done
|