mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-20 03:20:08 +00:00
cli: actually test if format_short_change_id() can be parsed
It's usually included in the commit_summary template, but not guaranteed.
This commit is contained in:
parent
62059dd91e
commit
41ef9a76de
1 changed files with 4 additions and 1 deletions
|
@ -169,6 +169,8 @@ use crate::text_util;
|
|||
use crate::ui::ColorChoice;
|
||||
use crate::ui::Ui;
|
||||
|
||||
const SHORT_CHANGE_ID_TEMPLATE_TEXT: &str = "format_short_change_id(self.change_id())";
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ChromeTracingFlushGuard {
|
||||
_inner: Option<Rc<tracing_chrome::FlushGuard>>,
|
||||
|
@ -751,6 +753,7 @@ impl WorkspaceCommandHelper {
|
|||
// Parse commit_summary template early to report error before starting
|
||||
// mutable operation.
|
||||
helper.parse_commit_template(&helper.commit_summary_template_text)?;
|
||||
helper.parse_commit_template(SHORT_CHANGE_ID_TEMPLATE_TEXT)?;
|
||||
Ok(helper)
|
||||
}
|
||||
|
||||
|
@ -1297,7 +1300,7 @@ impl WorkspaceCommandHelper {
|
|||
}
|
||||
|
||||
pub fn short_change_id_template(&self) -> TemplateRenderer<'_, Commit> {
|
||||
self.parse_commit_template("format_short_change_id(self.change_id())")
|
||||
self.parse_commit_template(SHORT_CHANGE_ID_TEMPLATE_TEXT)
|
||||
.expect("parse error should be confined by WorkspaceCommandHelper::new()")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue