chris-marsh / pureline

A Pure Bash Powerline PS1 Command Prompt
MIT License
507 stars 95 forks source link

Use git on Windows for Windows folder on WSL #87

Open letrunghieu opened 1 year ago

letrunghieu commented 1 year ago

Due to microsoft/WSL#4401, when we switch to a directory mounted from the Windows filesystem on WSL2, the git segment is very slow. For large repositories, this can hang the whole terminal.

This patch detects if we are in a WSL environment and if the current folder is mounted from the Windows filesystem. If those criteria are true, we use the git.exe binary in the git segment instead of the one installed in Linux.

There is a limitation to this approach. If we mount another filesystem under /mnt in WSL, the changes here also try to use git.exe.