From 21ecfa47e01027f3780f4d0a22ce36865f924469 Mon Sep 17 00:00:00 2001 From: Vincent B Date: Wed, 10 Mar 2021 22:00:50 +0100 Subject: [PATCH] refactor: create inline function inWSLSharedDrive --- src/segment_git.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/segment_git.go b/src/segment_git.go index 68cc32772fc1..1fe81a123ab9 100644 --- a/src/segment_git.go +++ b/src/segment_git.go @@ -271,8 +271,11 @@ func (g *git) getStatusColor(defaultValue string) string { } func (g *git) getGitCommandOutput(args ...string) string { + inWSLSharedDrive := func(env environmentInfo) bool { + return env.isWsl() && strings.HasPrefix(env.getcwd(), "/mnt/") + } 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" } args = append([]string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)