when changing state, include old state in git log message

Before this commit:
    change state of issue f3990ac13cd93a925f2a66e6a72eb0f2 to backlog

After this commit:
    change state of issue 406e2330695040fed5fdbcaae5d2b331, new -> inprogress
This commit is contained in:
Sebastian Kuzminsky 2025-07-12 10:00:22 -06:00
parent 65316da0bd
commit 665f02cbe8

View file

@ -251,6 +251,7 @@ impl Issue {
/// Change the State of the Issue. /// Change the State of the Issue.
pub fn set_state(&mut self, new_state: State) -> Result<(), IssueError> { pub fn set_state(&mut self, new_state: State) -> Result<(), IssueError> {
let old_state = self.state.clone();
let mut state_filename = std::path::PathBuf::from(&self.dir); let mut state_filename = std::path::PathBuf::from(&self.dir);
state_filename.push("state"); state_filename.push("state");
let mut state_file = std::fs::File::create(&state_filename)?; let mut state_file = std::fs::File::create(&state_filename)?;
@ -260,8 +261,9 @@ impl Issue {
crate::git::commit( crate::git::commit(
&self.dir, &self.dir,
&format!( &format!(
"change state of issue {} to {}", "change state of issue {}, {} -> {}",
self.dir.file_name().unwrap().to_string_lossy(), self.dir.file_name().unwrap().to_string_lossy(),
old_state,
new_state, new_state,
), ),
)?; )?;