Files
zed/crates/git_ui_core/src
Michele C. Soccio 9fa6fd3f44 Worktree picker: search also by branch name (#66384)
## Summary

In the worktree picker, can now search by both branch and worktree name
instead of only by worktree name.

With the current implementation whenever the worktree and a checked out
branch do not share same name and the user wants to switch worktree,
they have to remember the worktree name, or do some workaround like
launching `zed .` from the worktree. It's not possible to switch
worktree using the branch picker, as it will try to check out the branch
in the current worktree (this change doesn't touch that behaviour).

An example where it exists a branch named `a-random-branch` checked out
in worktree `zed-deliberate-purpose`

Before, when searching by `random` the worktree does not appear:

<img width="696" height="197" alt="image"
src="https://github.com/user-attachments/assets/cd1674c1-3ca6-4337-ad16-439f58df9e03"
/>

After, it is fuzzy matched because of the branch name:

<img width="668" height="189" alt="image"
src="https://github.com/user-attachments/assets/ed521e76-bc1b-4e4e-b662-7caba46ff91a"
/>

## Testing

I manually tested the change, but only on macOS. I have been using it
for a few weeks with megarepos and tens of worktrees/branches.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Added the possibility to search also by branch name in the worktree
picker.
2026-11-04 14:02:39 +00:00
..