1
0

Improve reword_commits_sequentially robustness by verifying commit hash before interactive rebase

This commit is contained in:
2026-07-12 11:26:20 +02:00
parent 6bf77cebab
commit ce73d0273a

View File

@@ -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 {