# Show multiple worktree chips in sidebar for threads with mismatched worktrees \(\#52544\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f3120aca180b26766c08959367e6072bd30d0b6d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f3120aca180b26766c08959367e6072bd30d0b6d

Requested commit: f3120aca180b26766c08959367e6072bd30d0b6d

Commit: f3120aca180b26766c08959367e6072bd30d0b6d

Tree: c18ce93bea0345ee21934e6157357d48ee5bd4e9

Author: Eric Holk

Committer: GitHub

## Message

```
Show multiple worktree chips in sidebar for threads with mismatched worktrees (#52544)

## Summary

When a thread was created in a workspace whose roots span different git
worktrees (e.g. the `olivetti` branch of project_a and the `selectric`
branch of project_b), the sidebar now shows a worktree chip for each
distinct branch name — like `{olivetti} {selectric}` — each with its own
git worktree icon. Same-named worktrees are collapsed into a single
chip. The tooltip on any chip shows the full list of worktree paths.

Previously, only one worktree chip was ever shown (from the first path).

### Implementation

- Introduces `WorktreeInfo` struct replacing the flat
`worktree_name`/`worktree_full_path`/`worktree_highlight_positions`
fields on `ThreadEntry` with `worktrees: Vec<WorktreeInfo>`
- Adds `worktree_info_from_thread_paths` which derives worktree display
info from a thread's own stored `folder_paths` metadata rather than from
the workspace path
- Updates `ThreadItem` in the UI crate to accept
`Vec<ThreadItemWorktree>` and render multiple chips, deduplicating by
name
- Updates fuzzy search to match against all worktree names
- Adds tests for multiple worktree chips and same-name deduplication

Release Notes:

- N/A
```

## Parents

- [6d09eded79111d00c96ea094bca0eb74945b7826](https://git.cafe/gitcafe/zed/commit/6d09eded79111d00c96ea094bca0eb74945b7826?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f3120aca180b26766c08959367e6072bd30d0b6d?format=markdown)
