From e55ebd4fe63ef95b6df5bffabf4c5ef953753f9c Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 24 Mar 2024 13:28:20 -0700 Subject: [PATCH] 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()`. --- lib/src/rewrite.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/rewrite.rs b/lib/src/rewrite.rs index 2a0cc2340..fbb93fa82 100644 --- a/lib/src/rewrite.rs +++ b/lib/src/rewrite.rs @@ -582,15 +582,15 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> { let new_commit = match rebased_commit { RebasedCommit::Rewritten(new_commit) => new_commit, 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()); parent } }; self.rebased .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()])?; Ok(()) }