Skip to content

Commit 9f8d936

Browse files
committed
cli: color author and commiter names yellow
When `format_short_signature(signature)` is set to `signature.name()` the author names are not yellow like other signature types (eg email and username). When the commit signatures have no colors, they blend in making it hard to distinguish between signatures and commit messages. If just `name` were set to `yellow`, just like email and username, it affects the colorization of branch names making them also yellow despite them being designated as magenta. Setting `author` and `committer` to `yellow` is specific enough to allow branches to keep their colors while still coloring signature names. This is known to affect signatures in both 'log' and 'show'.
1 parent 64e1ae2 commit 9f8d936

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9595
to keeping all changes into the first commit while keeping the current commit
9696
description for the second commit (the newly created empty one).
9797

98+
* Color author and committer names yellow
99+
98100
### Fixed bugs
99101

100102
* Update working copy before reporting changes. This prevents errors during reporting

cli/src/config/colors.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"divergent prefix" = { fg = "red", underline = true }
2222
"hidden prefix" = "default"
2323

24-
"email" = "yellow"
25-
"username" = "yellow"
24+
"author" = "yellow"
25+
"committer" = "yellow"
2626
"timestamp" = "cyan"
2727
"working_copies" = "green"
2828
"bookmark" = "magenta"
@@ -54,7 +54,8 @@
5454
"working_copy change_id" = "bright magenta"
5555
# We do not use bright yellow because of how it looks on xterm's default theme.
5656
# https://github.com/martinvonz/jj/issues/528
57-
"working_copy email" = "yellow"
57+
"working_copy author" = "yellow"
58+
"working_copy committer" = "yellow"
5859
"working_copy timestamp" = "bright cyan"
5960
"working_copy working_copies" = "bright green"
6061
"working_copy bookmark" = "bright magenta"

cli/tests/test_commit_template.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ fn test_log_builtin_templates_colored() {
346346
347347
○ Commit ID: 230dd059e1b059aefc0da06a2e5a7dbf22362f22
348348
│ Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu
349-
│ Author: Test User <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
350-
│ Committer: Test User <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
349+
│ Author: [38;5;3mTest User[39m <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
350+
│ Committer: [38;5;3mTest User[39m <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
351351
352352
│  (no description set)
353353
@@ -415,8 +415,8 @@ fn test_log_builtin_templates_colored_debug() {
415415
│ <<log::>>
416416
<<node::○>> <<log::Commit ID: >><<log commit_id::230dd059e1b059aefc0da06a2e5a7dbf22362f22>><<log::>>
417417
│ <<log::Change ID: >><<log change_id::qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu>><<log::>>
418-
│ <<log::Author: >><<log author name::Test User>><<log:: <>>[38;5;3m<<log author email::[email protected]>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
419-
│ <<log::Committer: >><<log committer name::Test User>><<log:: <>>[38;5;3m<<log committer email::[email protected]>>[39m<<log::> (>>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
418+
│ <<log::Author: >>[38;5;3m<<log author name::Test User>>[39m<<log:: <>>[38;5;3m<<log author email::[email protected]>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
419+
│ <<log::Committer: >>[38;5;3m<<log committer name::Test User>>[39m<<log:: <>>[38;5;3m<<log committer email::[email protected]>>[39m<<log::> (>>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
420420
│ <<log::>>
421421
│ <<log empty description placeholder:: (no description set)>><<log::>>
422422
│ <<log::>>

cli/tests/test_show_command.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ fn test_show_basic() {
8080
"###);
8181

8282
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--color=debug"]);
83-
insta::assert_snapshot!(stdout, @r###"
83+
insta::assert_snapshot!(stdout, @r#"
8484
Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>>
8585
Change ID: <<change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>>
86-
Author: <<author name::Test User>> <[38;5;3m<<author email::[email protected]>>[39m> ([38;5;6m<<author timestamp local format::2001-02-03 08:05:09>>[39m)
87-
Committer: <<committer name::Test User>> <[38;5;3m<<committer email::[email protected]>>[39m> ([38;5;6m<<committer timestamp local format::2001-02-03 08:05:09>>[39m)
86+
Author: [38;5;3m<<author name::Test User>>[39m <[38;5;3m<<author email::[email protected]>>[39m> ([38;5;6m<<author timestamp local format::2001-02-03 08:05:09>>[39m)
87+
Committer: [38;5;3m<<committer name::Test User>>[39m <[38;5;3m<<committer email::[email protected]>>[39m> ([38;5;6m<<committer timestamp local format::2001-02-03 08:05:09>>[39m)
8888
8989
<<description placeholder:: (no description set)>>
9090
@@ -93,7 +93,7 @@ fn test_show_basic() {
9393
<<diff:: >><<diff added line_number:: 2>><<diff::: >><<diff added token::bar>>
9494
<<diff removed line_number:: 2>><<diff:: >><<diff added line_number:: 3>><<diff::: baz >><<diff removed token::qux>><<diff added token::quux>><<diff::>>
9595
<<diff header::Modified regular file file3 (file1 => file3):>>
96-
"###);
96+
"#);
9797

9898
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s"]);
9999
insta::assert_snapshot!(stdout, @r###"
@@ -167,11 +167,11 @@ fn test_show_basic() {
167167
"###);
168168

169169
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git", "--color=debug"]);
170-
insta::assert_snapshot!(stdout, @r###"
170+
insta::assert_snapshot!(stdout, @r#"
171171
Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>>
172172
Change ID: <<change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>>
173-
Author: <<author name::Test User>> <[38;5;3m<<author email::[email protected]>>[39m> ([38;5;6m<<author timestamp local format::2001-02-03 08:05:09>>[39m)
174-
Committer: <<committer name::Test User>> <[38;5;3m<<committer email::[email protected]>>[39m> ([38;5;6m<<committer timestamp local format::2001-02-03 08:05:09>>[39m)
173+
Author: [38;5;3m<<author name::Test User>>[39m <[38;5;3m<<author email::[email protected]>>[39m> ([38;5;6m<<author timestamp local format::2001-02-03 08:05:09>>[39m)
174+
Committer: [38;5;3m<<committer name::Test User>>[39m <[38;5;3m<<committer email::[email protected]>>[39m> ([38;5;6m<<committer timestamp local format::2001-02-03 08:05:09>>[39m)
175175
176176
<<description placeholder:: (no description set)>>
177177
@@ -187,7 +187,7 @@ fn test_show_basic() {
187187
<<diff file_header::diff --git a/file1 b/file3>>
188188
<<diff file_header::rename from file1>>
189189
<<diff file_header::rename to file3>>
190-
"###);
190+
"#);
191191

192192
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s", "--git"]);
193193
insta::assert_snapshot!(stdout, @r###"

0 commit comments

Comments
 (0)