summaryrefslogtreecommitdiff
path: root/t/t4207-log-decoration-colors.sh
diff options
context:
space:
mode:
authorNazri Ramliy <ayiehere@gmail.com>2010-06-29 07:47:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-30 18:14:44 (GMT)
commit567102819ac56ccf7eb638ea8b5c975c03e88558 (patch)
tree2ca11d28c1290433726b1ee40cf4668552bc1215 /t/t4207-log-decoration-colors.sh
parent5e11bee65f601ba97dc4c61c75fcb2f448fdcb1c (diff)
downloadgit-567102819ac56ccf7eb638ea8b5c975c03e88558.zip
git-567102819ac56ccf7eb638ea8b5c975c03e88558.tar.gz
git-567102819ac56ccf7eb638ea8b5c975c03e88558.tar.bz2
Add test for correct coloring of git log --decoration
Signed-off-by: Nazri Ramliy <ayiehere@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4207-log-decoration-colors.sh')
-rwxr-xr-xt/t4207-log-decoration-colors.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/t/t4207-log-decoration-colors.sh b/t/t4207-log-decoration-colors.sh
new file mode 100755
index 0000000..bbde31b
--- /dev/null
+++ b/t/t4207-log-decoration-colors.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Nazri Ramliy
+#
+
+test_description='Test for "git log --decorate" colors'
+
+. ./test-lib.sh
+
+get_color ()
+{
+ git config --get-color no.such.slot "$1"
+}
+
+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=$(get_color reset) &&
+
+ c_commit=$(get_color yellow) &&
+ c_branch=$(get_color green) &&
+ c_remoteBranch=$(get_color red) &&
+ c_tag=$(get_color "reverse bold yellow") &&
+ c_stash=$(get_color magenta) &&
+ c_HEAD=$(get_color 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_HEAD}HEAD${c_reset}${c_commit},\
+ ${c_tag}tag: v1.0${c_reset}${c_commit},\
+ ${c_tag}tag: B${c_reset}${c_commit},\
+ ${c_branch}master${c_reset}${c_commit})${c_reset} B
+${c_commit}COMMIT_ID (${c_tag}tag: A1${c_reset}${c_commit},\
+ ${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1
+${c_commit}COMMIT_ID (${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
+ On master: Changes to A.t
+${c_commit}COMMIT_ID (${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/" >out &&
+ test_cmp expected out
+'
+
+test_done