From ce73d0273a3ad5e6ece0d87fec768e607a2c4ae4 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 12 Jul 2026 11:26:20 +0200 Subject: [PATCH] Improve reword_commits_sequentially robustness by verifying commit hash before interactive rebase --- src-tauri/src/main.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a2dc4ad..c1851da 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1044,12 +1044,17 @@ fn reword_commits_sequentially( "GIT_EDITOR".to_string(), message_path.to_string_lossy().to_string(), ); - run_git_owned( + let rebase_args = if run_git( repo_path, - &["rebase".into(), "-i".into(), format!("{full_hash}^")], - Some(&env), - None, - )?; + &["rev-parse", "--verify", &format!("{full_hash}^")], + ) + .is_ok() + { + vec!["rebase".into(), "-i".into(), format!("{full_hash}^")] + } else { + vec!["rebase".into(), "-i".into(), "--root".into()] + }; + run_git_owned(repo_path, &rebase_args, Some(&env), None)?; } if stashed {