From 54ae0cf9e85d5861a1f66a3c662a2f277c7d1557 Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Sun, 21 Jul 2024 22:30:24 +0200 Subject: [PATCH] more possible mitigations for the "failed to apply" problemt related to merge conflicts --- .../src/branch_manager/branch_removal.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs b/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs index 039052bb7..3db5d480e 100644 --- a/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs +++ b/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs @@ -80,6 +80,11 @@ impl BranchManager<'_> { .context("failed to get status by branch")? .branches; + // doing this earlier in the flow, in case any of the steps that follow fail + vb_state + .mark_as_not_in_workspace(branch.id) + .context("Failed to remove branch")?; + // go through the other applied branches and merge them into the final tree // then check that out into the working directory let final_tree = applied_statuses @@ -116,10 +121,6 @@ impl BranchManager<'_> { .checkout() .context("failed to checkout tree")?; - vb_state - .mark_as_not_in_workspace(branch.id) - .context("Failed to remove branch")?; - self.project_repository.delete_branch_reference(&branch)?; ensure_selected_for_changes(&vb_state).context("failed to ensure selected for changes")?;