From 1972eccad1e12df25324832ab8de0303e1486a7a Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 3 Feb 2023 15:05:33 +0900 Subject: [PATCH] cli: leverage separate() function to concatenate log template fields --- src/commands/mod.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index f0e6e917e..0f14f2fd3 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1423,17 +1423,19 @@ fn log_template(settings: &UserSettings) -> String { let default_template = format!( r#" label(if(current_working_copy, "working_copy"), - if(divergent, - label("divergent", change_id.{prefix_format} "??"), - change_id.{prefix_format}) - if(author.email(), " " author.email()) - " " {committer_timestamp} - if(branches, " " branches) - if(tags, " " tags) - if(working_copies, " " working_copies) - if(git_head, " " git_head) - " " commit_id.{prefix_format} - if(conflict, " " label("conflict", "conflict")) + separate(" ", + if(divergent, + label("divergent", change_id.{prefix_format} "??"), + change_id.{prefix_format}), + author.email(), + {committer_timestamp}, + branches, + tags, + working_copies, + git_head, + commit_id.{prefix_format}, + if(conflict, label("conflict", "conflict")) + ) "\n" if(empty, label("empty", "(empty)") " ") if(description, description.first_line(), {DESCRIPTION_PLACEHOLDER_TEMPLATE})