Skip to content

Creating a WSL worktree fails with \\wsl$\... repository path but succeeds with \\wsl.localhost\... #2829

Description

@DanielLaberge

Description

Creating a worktree through Fork fails when a WSL repository is opened using the \\wsl$\Ubuntu\... UNC alias. Fork appears to normalize the destination into //wsl$/..., which wslgit does not translate correctly. Reopening the same repository through \\wsl.localhost\Ubuntu\... makes worktree creation succeed.

This was found while evaluating Fork. The workaround is effective, but the two equivalent WSL UNC aliases behave differently.

Environment

  • Fork 2.21.0.0 for Windows (Develop update channel)
  • Windows 11
  • WSL2, Ubuntu
  • Custom Git executable: C:\Repos\z.Tools\wslgit\bin\git.exe
  • Repository: /home/daniel/repos/ConstructBuy

Reproduction

  1. Configure Fork to use C:\Repos\z.Tools\wslgit\bin\git.exe.
  2. Open the repository as \\wsl$\Ubuntu\home\daniel\repos\ConstructBuy.
  3. Use Fork to create a new branch and worktree named test, with the destination \\wsl$\Ubuntu\home\daniel\repos\ConstructBuy-worktrees\test.

Expected

Fork should create the worktree, just as it does when the same repository and destination are addressed through \\wsl.localhost\Ubuntu\....

Actual

Fork logs this command and failure:

Git request failed 'worktree add -b test //wsl$/Ubuntu/home/daniel/repos/ConstructBuy-worktrees/test 09873c7160a3299863f625695bd25085bf917dad':
wslpath: //wsl\\$/Ubuntu/home/daniel/repos/ConstructBuy-worktrees/test
Preparing worktree (new branch 'test')
BUG: builtin/worktree.c:449: How come '' becomes empty after sanitization?

The worktree is not created.

Workaround

Remove/reopen the repository in Fork using:

\\wsl.localhost\Ubuntu\home\daniel\repos\ConstructBuy

With that alias, Fork can successfully create the worktree.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions