From eb3aeb42dcd476788a6f0788476d23caa39ffb58 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 3 Feb 2023 15:11:25 +0900 Subject: [PATCH] cli: do not include separator in labeled log template fields --- src/commands/mod.rs | 4 ++-- tests/test_commit_template.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 93732a8b2..5fa57b678 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -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" )"#, diff --git a/tests/test_commit_template.rs b/tests/test_commit_template.rs index 2213ee4a9..291e87c82 100644 --- a/tests/test_commit_template.rs +++ b/tests/test_commit_template.rs @@ -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) "###); }