rewrite: drop redundant update of parent_mapping after rebasing commit

In the normal case when we don't abandon a commit because it became
empty, then `CommitBuilder::write()` will have recorded the new commit
as a rewrite of the old commit. We don't need to do that again in
`rebase_one()`.
This commit is contained in:
Martin von Zweigbergk 2024-03-24 13:28:20 -07:00 committed by Martin von Zweigbergk
parent 4406005dce
commit e55ebd4fe6

View file

@ -582,15 +582,15 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
let new_commit = match rebased_commit { let new_commit = match rebased_commit {
RebasedCommit::Rewritten(new_commit) => new_commit, RebasedCommit::Rewritten(new_commit) => new_commit,
RebasedCommit::Abandoned { parent } => { RebasedCommit::Abandoned { parent } => {
self.mut_repo
.parent_mapping
.insert(old_commit_id.clone(), vec![parent.id().clone()]);
self.mut_repo.abandoned.insert(old_commit.id().clone()); self.mut_repo.abandoned.insert(old_commit.id().clone());
parent parent
} }
}; };
self.rebased self.rebased
.insert(old_commit_id.clone(), new_commit.id().clone()); .insert(old_commit_id.clone(), new_commit.id().clone());
self.mut_repo
.parent_mapping
.insert(old_commit_id.clone(), vec![new_commit.id().clone()]);
self.update_references(old_commit_id, vec![new_commit.id().clone()])?; self.update_references(old_commit_id, vec![new_commit.id().clone()])?;
Ok(()) Ok(())
} }