From 3ecb4ec16b03a21f124cba9c0ffd741ae0d6b383 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 15 Mar 2021 15:26:09 -0700 Subject: [PATCH] MutableRepo: in fast-path for adding head, simply remove parent heads --- lib/src/repo.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/repo.rs b/lib/src/repo.rs index abfb42d0b..02fe436b8 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -635,7 +635,9 @@ impl<'r> MutableRepo<'r> { { self.index.add_commit(head); self.view.add_head(head.id()); - self.enforce_view_invariants(); + for parent_id in head.parent_ids() { + self.view.remove_head(&parent_id); + } if let Some(evolution) = self.evolution_mut() { evolution.add_commit(head) }