cli: omit log template separator if author.email() is empty

This commit is contained in:
Yuya Nishihara 2023-02-03 15:16:40 +09:00
parent eb3aeb42dc
commit fbd6657e3f
4 changed files with 15 additions and 15 deletions

View file

@ -1426,7 +1426,7 @@ fn log_template(settings: &UserSettings) -> String {
if(divergent,
label("divergent", change_id.{prefix_format} "??"),
change_id.{prefix_format})
" " author.email()
if(author.email(), " " author.email())
" " {committer_timestamp}
if(branches, " " branches)
if(tags, " " tags)

View file

@ -135,7 +135,7 @@ fn test_alias_cannot_override_builtin() {
// Alias should be ignored
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "root"]);
insta::assert_snapshot!(stdout, @r###"
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}

View file

@ -69,7 +69,7 @@ fn test_log_default() {
| (empty) description 1
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -83,7 +83,7 @@ fn test_log_default() {
| (empty) description 1
o 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:08.000 +07:00 4[291e264ae]
| add a file
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
(empty) (no description set)
"###);
@ -102,7 +102,7 @@ fn test_log_default() {
| (empty) description 1
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -116,7 +116,7 @@ fn test_log_default() {
| (empty) description 1
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -127,7 +127,7 @@ fn test_log_default() {
| (empty) description 1
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -138,7 +138,7 @@ fn test_log_default() {
(empty) description 1
9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
add a file
000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}
@ -156,7 +156,7 @@ fn test_log_default_divergence() {
insta::assert_snapshot!(stdout, @r###"
@ 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
| description 1
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -172,7 +172,7 @@ fn test_log_default_divergence() {
| description 2
| @ 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
|/ description 1
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -183,7 +183,7 @@ fn test_log_default_divergence() {
| description 2
| @ 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
|/ description 1
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}
@ -203,7 +203,7 @@ fn test_log_git_head() {
| initial
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:07.000 +07:00 master HEAD@git 230dd059e1b0
| (empty) (no description set)
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}

View file

@ -161,13 +161,13 @@ fn test_alias() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "my-root"]);
insta::assert_snapshot!(stdout, @r###"
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "identity(my-root)"]);
insta::assert_snapshot!(stdout, @r###"
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -263,7 +263,7 @@ fn test_bad_alias_decl() {
.assert()
.success();
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
insta::assert_snapshot!(get_stderr_string(&assert), @r###"