From 3e938752d1de905ce7a745cd8b3c2267a205ebc4 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 26 Sep 2021 23:38:42 -0700 Subject: [PATCH] cli: also update descendant branches after rewriting working copy commit After writing a new working copy commit, we update branches pointing to it, and we rebase descendants on top. However, we should be doing that in the opposite order, so the branch updates apply to rewritten descendants as well. --- src/commands.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 7325beb4a..8ea1ba9a0 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -382,9 +382,6 @@ impl RepoCommandHelper { .write_to_repo(mut_repo); mut_repo.set_checkout(commit.id().clone()); - // Update branches pointing to the old checkout - update_branches_after_rewrite(mut_repo); - // Evolve descendants (though it currently evolves all commits) let evolve_result = evolve_orphans(&self.settings, mut_repo)?; if evolve_result.num_resolved > 0 { @@ -403,6 +400,10 @@ impl RepoCommandHelper { )?; } + // Update branches pointing to the old checkout and any branches pointing to + // descendants. + update_branches_after_rewrite(mut_repo); + self.repo = tx.commit(); locked_wc.finish(commit); } else {