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.
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 usegit.exe
.