cli: do not include separator in labeled log template fields

This commit is contained in:
Yuya Nishihara 2023-02-03 15:11:25 +09:00
parent 13b5661094
commit eb3aeb42dc
2 changed files with 11 additions and 11 deletions

View file

@ -1433,9 +1433,9 @@ fn log_template(settings: &UserSettings) -> String {
if(working_copies, " " working_copies)
if(git_head, " " git_head)
" " commit_id.{prefix_format}
if(conflict, label("conflict", " conflict"))
if(conflict, " " label("conflict", "conflict"))
"\n"
if(empty, label("empty", "(empty) "))
if(empty, label("empty", "(empty)") " ")
if(description, description.first_line(), {DESCRIPTION_PLACEHOLDER_TEMPLATE})
"\n"
)"#,

View file

@ -99,11 +99,11 @@ fn test_log_default() {
);
insta::assert_snapshot!(stdout, @r###"
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
| (empty) description 1
| (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
(empty) (no description set)
(empty) (no description set)
"###);
// Test default log output format with prefixes explicitly disabled
@ -124,22 +124,22 @@ fn test_log_default() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
| (empty) description 1
| (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
(empty) (no description set)
(empty) (no description set)
"###);
// Color without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always", "--no-graph"]);
insta::assert_snapshot!(stdout, @r###"
ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
(empty) description 1
(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
(empty) (no description set)
(empty) (no description set)
"###);
}
@ -184,7 +184,7 @@ fn test_log_default_divergence() {
| @ 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
(empty) (no description set)
(empty) (no description set)
"###);
}
@ -202,8 +202,8 @@ fn test_log_git_head() {
@ 8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 50aaf4754c1e
| initial
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:07.000 +07:00 master HEAD@git 230dd059e1b0
| (empty) (no description set)
| (empty) (no description set)
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
(empty) (no description set)
"###);
}