diff --git a/cli/src/commands/branch.rs b/cli/src/commands/branch.rs index acb35caa1..8efc91271 100644 --- a/cli/src/commands/branch.rs +++ b/cli/src/commands/branch.rs @@ -368,12 +368,18 @@ fn cmd_branch_list( }); } + let no_branches_template = workspace_command.parse_commit_template( + &command + .settings() + .config() + .get_string("templates.commit_summary_no_branches")?, + )?; let print_branch_target = |formatter: &mut dyn Formatter, target: &RefTarget| -> Result<(), CommandError> { if let Some(id) = target.as_normal() { write!(formatter, ": ")?; let commit = repo.store().get_commit(id)?; - workspace_command.write_commit_summary(formatter, &commit)?; + no_branches_template.format(&commit, formatter)?; writeln!(formatter)?; } else { write!(formatter, " ")?; @@ -382,13 +388,13 @@ fn cmd_branch_list( for id in target.removed_ids() { let commit = repo.store().get_commit(id)?; write!(formatter, " - ")?; - workspace_command.write_commit_summary(formatter, &commit)?; + no_branches_template.format(&commit, formatter)?; writeln!(formatter)?; } for id in target.added_ids() { let commit = repo.store().get_commit(id)?; write!(formatter, " + ")?; - workspace_command.write_commit_summary(formatter, &commit)?; + no_branches_template.format(&commit, formatter)?; writeln!(formatter)?; } } diff --git a/cli/src/config/templates.toml b/cli/src/config/templates.toml index 2fc75e3d2..74ff0e11a 100644 --- a/cli/src/config/templates.toml +++ b/cli/src/config/templates.toml @@ -9,6 +9,16 @@ separate(" ", ) ''' +commit_summary_no_branches = ''' +separate(" ", + format_short_change_id(change_id), + format_short_commit_id(commit_id), + if(conflict, label("conflict", "(conflict)")), + if(empty, label("empty", "(empty)")), + if(description, description.first_line(), description_placeholder), +) +''' + log = 'builtin_log_compact' op_log = 'builtin_op_log_compact' show = 'builtin_log_detailed'