Files
zed/crates/git_ui
Parker Loflin 67c513c8a1 git_ui: Focus the panel when there is no repository (#67389)
## Summary

Without a repository, the Git panel doesn't render its commit editor but
still moves focus to it. `git_panel::ToggleFocus` then leaves the panel
unfocused, and `git_panel::Toggle` can't close it.

Focus now stays on the panel when there is no repository.

Closes #48275
Closes #50117

## Testing

- To reproduce, open a folder without a Git repository and run
`git_panel::Toggle` twice.
- Tested on Linux. The second toggle leaves the panel open on `main` and
closes it on this branch.
- `test_toggle_without_repository` fails without this change.
- `cargo test -p git_ui --lib` and `./script/clippy -p git_ui` pass.

## 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:

- Fixed `git_panel::ToggleFocus` and `git_panel::Toggle` in projects
without a Git repository



https://github.com/user-attachments/assets/10061567-9725-4399-b048-6a30b9e662c0
2026-11-24 18:00:25 +00:00
..
2026-11-24 12:02:03 +00:00