# Fix remote worktree path separators \(\#55486\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7b2acab0404684ad55da064b74a323e154231374

Requested commit: 7b2acab0404684ad55da064b74a323e154231374

Commit: 7b2acab0404684ad55da064b74a323e154231374

Tree: 9d0a3f16677e9c4c20dfab2984707b64c22b2c5f

Author: hayatosc

Committer: GitHub

## Message

```
Fix remote worktree path separators (#55486)

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

Closes #54641

Release Notes:

- Fixed creating git worktrees in WSL remote projects from Windows.

## Summary

- Preserve the repository `PathStyle` when constructing git worktree
paths.
- Avoid using local OS path separators when creating worktrees for
remote Posix projects such as WSL.
- Keep worktree archive path checks aligned with the same
path-style-aware worktree directory calculation.

## Root Cause

Remote repository paths are stored as `PathBuf`s, but `PathBuf::join`
and related path operations use the client OS separator. On Windows
clients connected to WSL, this could turn a remote Linux path into a
mixed path like `/home/<user>/\home\<user>\dev\worktrees\...`, causing
worktree creation and opening to fail.

## Validation

- `cargo fmt --all --check`
- `git diff --check`
- `cargo test -p project
test_new_worktree_path_uses_posix_style_for_remote_paths`
- `cargo test -p project test_worktree_directory_uses_remote_path_style`
- `cargo test -p project test_join_path_for_style_uses_remote_separator`

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
```

## Parents

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

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