Skip to content

Commit

Permalink
cli: color author and commiter names yellow
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
qubitz committed Sep 21, 2024
1 parent 5bd7588 commit 69bf38f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

* `jj squash`: the `-k` flag can be used as a shorthand for `--keep-emptied`.

* Color author and committer names yellow

### Fixed bugs

* Fixed panic when parsing invalid conflict markers of a particular form.
Expand Down
8 changes: 5 additions & 3 deletions cli/src/config/colors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"divergent prefix" = { fg = "red", underline = true }
"hidden prefix" = "default"

"email" = "yellow"
"username" = "yellow"
"author" = "yellow"
"committer" = "yellow"
"timestamp" = "cyan"
"working_copies" = "green"
"bookmark" = "magenta"
Expand Down Expand Up @@ -54,7 +54,9 @@
"working_copy change_id" = "bright magenta"
# We do not use bright yellow because of how it looks on xterm's default theme.
# https://github.com/martinvonz/jj/issues/528
"working_copy email" = "yellow"
"working_copy author" = "yellow"
"working_copy committer" = "yellow"
"working_copy username" = "yellow"
"working_copy timestamp" = "bright cyan"
"working_copy working_copies" = "bright green"
"working_copy bookmark" = "bright magenta"
Expand Down
8 changes: 4 additions & 4 deletions cli/tests/test_commit_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ fn test_log_builtin_templates_colored() {
○ Commit ID: 230dd059e1b059aefc0da06a2e5a7dbf22362f22
│ Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu
│ Author: Test User <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
│ Committer: Test User <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
│ Author: [38;5;3mTest User[39m <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
│ Committer: [38;5;3mTest User[39m <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
│  (no description set)
Expand Down Expand Up @@ -415,8 +415,8 @@ fn test_log_builtin_templates_colored_debug() {
│ <<log::>>
<<node::○>> <<log::Commit ID: >><<log commit_id::230dd059e1b059aefc0da06a2e5a7dbf22362f22>><<log::>>
│ <<log::Change ID: >><<log change_id::qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu>><<log::>>
│ <<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::)>>
│ <<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::)>>
│ <<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::)>>
│ <<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::)>>
│ <<log::>>
│ <<log empty description placeholder:: (no description set)>><<log::>>
│ <<log::>>
Expand Down

0 comments on commit 69bf38f

Please sign in to comment.