mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-27 02:50:30 +01:00
f2a60bb8b6
## Summary For a repo named `test_repo`, if it is bare cloned without renaming the common dir, the common dir is `test_repo.git`, and Zed treats the directory itself as the identity path: https://github.com/zed-industries/zed/blob/ec86047d67acd6fddd81392f44ed6ebcc6e7f531/crates/project/src/git_store.rs#L10674-L10689 The title bar then uses the identity path to display the project name, with the name determined by the std lib’s method: https://github.com/zed-industries/zed/blob/ec86047d67acd6fddd81392f44ed6ebcc6e7f531/crates/title_bar/src/title_bar.rs#L284-L288 When connecting from a Unix client to a Windows remote host, the identity path could be, for example, `C:\User\test\test_repo.git`. Applying std’s path methods to it yields an extension of `git` and a file stem of `C:\User\test\test_repo`, so the project name is displayed as `C:\User\test\test_repo` instead of `test_repo`. This PR introduces two new `PathStyle` methods to handle retrieving `file_stem()` and `extension()` cross-platform. They mirror the std lib’s behavior using the already introduced Path components. ## Testing New unit tests for `PathStyle::file_stem()` and `PathStyle::extension()` are introduced to guard its behavior. The title bar shown is locally tested: |Before|After| |:--:|:--:| | <img width="390" height="112" alt="Before" src="https://github.com/user-attachments/assets/82c08423-a25e-4cd0-ae74-2614818d47c9" /> |<img width="267" height="147" alt="After" src="https://github.com/user-attachments/assets/b739c801-10ef-49da-90fb-c36233313a66" />| ## 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 project names in the title bar for `repo.git` bare clones on remote Windows hosts.