git: Fix deletion icon button in branch list deleting the wrong branch (#45087)
Closes #45033 This bug happened because the deletion icon would use the selected entry index to choose what branch to delete. This works for all cases except when hovering on an entry, so the fix was passing in the entry index to the deletion button on_click handler. I also disabled the deletion button from working if a branch is HEAD, because it's an illegal operation to delete a branch a user is currently on. Finally, I made WeakEntity<Workspace> a non-optional field on `BranchList` because a workspace should always be present, and it's used to show toast notifications when a git operation fails. The popover view wouldn't have a workspace before, so users wouldn't get error messages when a git operation failed in that view. Release Notes: - git: Fix bug where branch list deletion button would delete the wrong branch
This commit is contained in:
1 parent
af441f3b3c
commit
c8cca9ce38
3 files changed
+101
-65
No files matched your search
@@ -337,6 +337,7 @@ impl CommitModal {
|
||||
active_repo,
|
||||
is_amend_pending,
|
||||
is_signoff_enabled,
|
||||
workspace,
|
||||
) = self.git_panel.update(cx, |git_panel, cx| {
|
||||
let (can_commit, tooltip) = git_panel.configure_commit_button(cx);
|
||||
let title = git_panel.commit_button_title();
|
||||
@@ -354,6 +355,7 @@ impl CommitModal {
|
||||
active_repo,
|
||||
is_amend_pending,
|
||||
is_signoff_enabled,
|
||||
git_panel.workspace.clone(),
|
||||
)
|
||||
});
|
||||
|
||||
@@ -375,7 +377,14 @@ impl CommitModal {
|
||||
.style(ButtonStyle::Transparent);
|
||||
|
||||
let branch_picker = PopoverMenu::new("popover-button")
|
||||
.menu(move |window, cx| Some(branch_picker::popover(active_repo.clone(), window, cx)))
|
||||
.menu(move |window, cx| {
|
||||
Some(branch_picker::popover(
|
||||
workspace.clone(),
|
||||
active_repo.clone(),
|
||||
window,
|
||||
cx,
|
||||
))
|
||||
})
|
||||
.with_handle(self.branch_list_handle.clone())
|
||||
.trigger_with_tooltip(
|
||||
branch_picker_button,
|
||||
|
||||
Reference in new issue
Block a user