Improve reword_commits_sequentially robustness by verifying commit hash before interactive rebase
This commit is contained in:
@@ -1044,12 +1044,17 @@ fn reword_commits_sequentially(
|
|||||||
"GIT_EDITOR".to_string(),
|
"GIT_EDITOR".to_string(),
|
||||||
message_path.to_string_lossy().to_string(),
|
message_path.to_string_lossy().to_string(),
|
||||||
);
|
);
|
||||||
run_git_owned(
|
let rebase_args = if run_git(
|
||||||
repo_path,
|
repo_path,
|
||||||
&["rebase".into(), "-i".into(), format!("{full_hash}^")],
|
&["rev-parse", "--verify", &format!("{full_hash}^")],
|
||||||
Some(&env),
|
)
|
||||||
None,
|
.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 {
|
if stashed {
|
||||||
|
|||||||
Reference in New Issue
Block a user