wslgit icon indicating copy to clipboard operation
wslgit copied to clipboard

Add path parsing logic to replace "/mount/path/to/rootfs" with "/"

Open FlorianOtel opened this issue 4 years ago • 1 comments

Setup:

I'm running VScode with WSL, but with WSL in a non-standard mount path -- WSL installed on a D:\ drive. In particular, my WSL is installed under D:\Ubuntu-1804-LTS\Ubuntu.

I have WSL installed as a terminal in VScode and git working fine inside WSL -- ssh keys and all.

wslgit is installed and working as D:\wslgit.exe

Problem:

When trying to perform git operations, wslgit.exe tries to use the whole mount path, as follows:

Looking for git in: D:\wslgit.exe
Using git 2.17.1 from D:\wslgit.exe
> git rev-parse --show-toplevel
bash: cd: /mnt/d/Ubuntu-1804-LTS/Ubuntu/rootfs/home/fotel/_AWS/GitHub/hackmd-notes: Permission denied
> git rev-parse --show-toplevel
bash: cd: /mnt/d/Ubuntu-1804-LTS/Ubuntu/rootfs/home/fotel/_AWS/GitHub/hackmd-notes/aws: Permission denied
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git init
bash: cd: /mnt/d/Ubuntu-1804-LTS/Ubuntu/rootfs/home/fotel/_AWS/GitHub/hackmd-notes: Permission denied

The permission denied issue is b/c it's not possible to traverse "rootfs" from inside WSL.

Proposed solution:

Please adjust the path parsing logic such that, if it contains rootfs, all previous path -- up and inculding rootfs -- are simply replaced with /. In my case have /mnt/d/Ubuntu-1804-LTS/Ubuntu/rootfs/ simply replaced with /

If this is a known problem and a solution already exists, please advise.

LMK if you need any additional info.

Thanks,

/Florian

FlorianOtel avatar Nov 20 '19 10:11 FlorianOtel

You may try an alpha build of the upcoming version 0.9.0 available here. In this version, all paths are handled by wslpath, and the working directory is not explicitly changed. Maybe this fixes your issue.

andy-5 avatar Nov 21 '19 19:11 andy-5