diff --git a/src/components/commit.rs b/src/components/commit.rs index 1c877c04..3d16643c 100644 --- a/src/components/commit.rs +++ b/src/components/commit.rs @@ -131,6 +131,12 @@ impl Component for CommitComponent { self.input .set_title(strings::commit_title(&self.key_config)); + self.commit_template = + get_config_string(CWD, "commit.template") + .ok() + .flatten() + .and_then(|path| read_to_string(path).ok()); + if self.is_empty() { if let Some(s) = &self.commit_template { self.input.set_text(s.clone()); @@ -170,14 +176,6 @@ impl CommitComponent { pub fn update(&mut self) -> Result<()> { self.git_branch_name.lookup().map(Some).unwrap_or(None); - self.commit_template.get_or_insert_with(|| { - get_config_string(CWD, "commit.template") - .ok() - .unwrap_or(None) - .and_then(|path| read_to_string(path).ok()) - .unwrap_or_else(String::new) - }); - Ok(()) }