From db92d6ab5c1cf4b6012463fb3a0614a6663a5e1e Mon Sep 17 00:00:00 2001 From: Guillaume Launay Date: Wed, 6 Aug 2025 11:00:07 +0200 Subject: [PATCH] Create new branch before deleting the current one to prevent delete then panic --- crates/fs/src/fake_git_repo.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fs/src/fake_git_repo.rs b/crates/fs/src/fake_git_repo.rs index f969d0143ed6d7b6382868d8dcf14eb517c587ab..02061ecbb70bf8e323981474deb5ac71d6dbad1b 100644 --- a/crates/fs/src/fake_git_repo.rs +++ b/crates/fs/src/fake_git_repo.rs @@ -353,8 +353,8 @@ impl GitRepository for FakeGitRepository { fn rename_branch(&self, new_name: String) -> BoxFuture<'_, Result<()>> { self.with_state_async(true, move |state| { if let Some(current_branch) = &state.current_branch_name { - state.branches.remove(current_branch); state.branches.insert(new_name.clone()); + state.branches.remove(current_branch); state.current_branch_name = Some(new_name); } Ok(())