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