diff --git a/src/cli_util.rs b/src/cli_util.rs index 1533303dd..b2e33b645 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -1598,19 +1598,14 @@ fn parse_commit_summary_template<'a>( workspace_id: &WorkspaceId, aliases_map: &TemplateAliasesMap, settings: &UserSettings, -) -> Result + 'a>, TemplateParseError> { - settings - .config() - .get_string("template.commit_summary") - .ok() - .map(|s| template_parser::parse_commit_template(repo, workspace_id, &s, aliases_map)) - .unwrap_or_else(|| { - let s = r#" - commit_id.short() " " - if(description, description.first_line(), description_placeholder) - "#; - template_parser::parse_commit_template(repo, workspace_id, s, aliases_map) - }) +) -> Result + 'a>, CommandError> { + let template_text = settings.config().get_string("template.commit_summary")?; + Ok(template_parser::parse_commit_template( + repo, + workspace_id, + &template_text, + aliases_map, + )?) } // TODO: Use a proper TOML library to serialize instead. diff --git a/src/config/templates.toml b/src/config/templates.toml index a99d66920..d1f46b9bd 100644 --- a/src/config/templates.toml +++ b/src/config/templates.toml @@ -1,5 +1,10 @@ # TODO: rename section to [templates]? [template] +commit_summary = ''' +commit_id.short() " " +if(description, description.first_line(), description_placeholder) +''' + # TODO: drop '.graph'? log.graph = ''' label(if(current_working_copy, "working_copy"),