Skip to content

git: Fix deletion icon button in branch list deleting the wrong branch#45087

Merged
Anthony-Eid merged 1 commit intomainfrom
fix-branch-deletion-icon
Dec 17, 2025
Merged

git: Fix deletion icon button in branch list deleting the wrong branch#45087
Anthony-Eid merged 1 commit intomainfrom
fix-branch-deletion-icon

Conversation

@Anthony-Eid
Copy link
Contributor

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 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 bug happened because the deletion icon would also 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 operations fails. The popover
view wouldn't have a workspace before, so user's wouldn't get error
messages when a git operation failed in that view.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 17, 2025
@Anthony-Eid Anthony-Eid enabled auto-merge (squash) December 17, 2025 10:11
@Anthony-Eid Anthony-Eid merged commit 9324616 into main Dec 17, 2025
24 checks passed
@Anthony-Eid Anthony-Eid deleted the fix-branch-deletion-icon branch December 17, 2025 10:20
HactarCE pushed a commit that referenced this pull request Dec 17, 2025
#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
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
zed-industries#45087)

Closes zed-industries#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
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
zed-industries#45087)

Closes zed-industries#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
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
zed-industries#45087)

Closes zed-industries#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git delete branch does not work

1 participant