From ab86e6369c87d0f2f483788808ee92fcecd6c270 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Fri, 11 Jul 2025 11:08:17 -0600 Subject: [PATCH] Issue::set_state(): better git commit message --- src/issue.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/issue.rs b/src/issue.rs index 5167e4b..9b5ee18 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -261,12 +261,23 @@ impl Issue { } } + /// Change the State of the Issue. pub fn set_state(&mut self, new_state: State) -> Result<(), IssueError> { let mut state_filename = std::path::PathBuf::from(&self.dir); state_filename.push("state"); let mut state_file = std::fs::File::create(&state_filename)?; write!(state_file, "{}", new_state)?; - crate::git::git_commit_file(&state_filename)?; + crate::git::add(&state_filename)?; + if crate::git::worktree_is_dirty(&self.dir.to_string_lossy())? { + crate::git::commit( + &self.dir, + &format!( + "change state of issue {} to {}", + self.dir.file_name().unwrap().to_string_lossy(), + new_state, + ), + )?; + } Ok(()) }