refactor: create inline function inWSLSharedDrive

This commit is contained in:
Vincent B 2021-03-10 22:00:50 +01:00 committed by Jan De Dobbeleer
parent 500cc5834d
commit 21ecfa47e0

View file

@ -271,8 +271,11 @@ func (g *git) getStatusColor(defaultValue string) string {
} }
func (g *git) getGitCommandOutput(args ...string) string { func (g *git) getGitCommandOutput(args ...string) string {
inWSLSharedDrive := func(env environmentInfo) bool {
return env.isWsl() && strings.HasPrefix(env.getcwd(), "/mnt/")
}
gitCommand := "git" gitCommand := "git"
if g.env.getRuntimeGOOS() == windowsPlatform || (g.env.isWsl() && strings.HasPrefix(g.env.getcwd(), "/mnt/")) { if g.env.getRuntimeGOOS() == windowsPlatform || inWSLSharedDrive(g.env) {
gitCommand = "git.exe" gitCommand = "git.exe"
} }
args = append([]string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...) args = append([]string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)