Skip to content

Commit 1e63b34

Browse files
ak2gitster
authored andcommitted
decorate: use commit color for HEAD arrow
Use the commit color instead of the HEAD color for the arrow or custom symbol in "HEAD -> branch" decorations, for visual consistency with the prefix, separator and suffix symbols, which are also colored with the commit color. This change was triggered by the possibility that one could choose to use the same symbol for the pointer and the separator options in %(decorate), in which case they ought to be the same color. A related precedent is 'ls -l', where the arrow for symlinks gets the default color rather than that of the symlink name. Amend test t4207-log-decoration-colors.sh accordingly. Signed-off-by: Andy Koppe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f1f8a25 commit 1e63b34

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

log-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void format_decorations(struct strbuf *sb,
369369

370370
if (current_and_HEAD &&
371371
decoration->type == DECORATION_REF_HEAD) {
372-
strbuf_addstr(sb, color);
372+
strbuf_addstr(sb, color_commit);
373373
strbuf_addstr(sb, pointer);
374374
strbuf_addstr(sb, color_reset);
375375
strbuf_addstr(sb, decorate_get_color(use_color, current_and_HEAD->type));

t/t4207-log-decoration-colors.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cmp_filtered_decorations () {
5454
test_expect_success 'commit decorations colored correctly' '
5555
cat >expect <<-EOF &&
5656
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}\
57-
${c_HEAD} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
57+
${c_commit} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
5858
${c_reset}${c_tag}tag: ${c_reset}${c_tag}v1.0${c_reset}${c_commit}, \
5959
${c_reset}${c_tag}tag: ${c_reset}${c_tag}B${c_reset}${c_commit})${c_reset} B
6060
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
@@ -79,7 +79,7 @@ test_expect_success 'test coloring with replace-objects' '
7979
8080
cat >expect <<-EOF &&
8181
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}\
82-
${c_HEAD} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
82+
${c_commit} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
8383
${c_reset}${c_tag}tag: ${c_reset}${c_tag}D${c_reset}${c_commit})${c_reset} D
8484
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
8585
${c_tag}tag: ${c_reset}${c_tag}C${c_reset}${c_commit}, \
@@ -105,7 +105,7 @@ test_expect_success 'test coloring with grafted commit' '
105105
106106
cat >expect <<-EOF &&
107107
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}\
108-
${c_HEAD} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
108+
${c_commit} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
109109
${c_reset}${c_tag}tag: ${c_reset}${c_tag}D${c_reset}${c_commit}, \
110110
${c_reset}${c_grafted}replaced${c_reset}${c_commit})${c_reset} D
111111
${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\

0 commit comments

Comments
 (0)