Prevent multibuffer items from switching active repository (#58795)

Fixes the git panel's active repository being silently overridden by the
cursor position in `ProjectDiff`.

Closes #58792
Closes #61530

## Summary

When a multi-buffer item (e.g. `ProjectDiff`) gains focus, the workspace
calls `set_active_repo_for_path` with the cursor's project path to
automatically switch the active git repository. This was safe when
multi-buffer items returned `None` from `active_project_path`, but PR
#57236 changed `ProjectDiff` to return the cursor-based path (for
project panel highlighting), inadvertently allowing the cursor position
to override the user's explicit repository selection.

Fix the issue by restoring the `Singleton` guard that was removed in PR
#57236: only call `set_active_repo_for_path` when the active item is
backed by a single buffer.

## Changes

- **`workspace.rs`**: Only call `set_active_repo_for_path` when the
active item's `buffer_kind` is `Singleton`. Multi-buffer items (e.g.
`ProjectDiff`, diagnostics, search results) span multiple repositories,
so their cursor position should not trigger an automatic repository
switch.

## Before


https://github.com/user-attachments/assets/6ca4fa61-b42a-447b-9de7-8b6ec1f1181a


## After


https://github.com/user-attachments/assets/9b045ad9-2bb5-4862-ac45-41e9fdd3dc96

Closes #58792

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed the Git panel unexpectedly switching repositories when viewing
changes in multi-repository projects.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: dino <dinojoaocosta@gmail.com>
418f897148mengh04 committed on 9/21/2026, 2:25:14 PM· committed by GitHubparent4c7f357
2 files changedLine totals unavailable