Skip to content

Commit 21ecfa4

Browse files
evilzJanDeDobbeleer
authored andcommitted
refactor: create inline function inWSLSharedDrive
1 parent 500cc58 commit 21ecfa4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/segment_git.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,11 @@ func (g *git) getStatusColor(defaultValue string) string {
271271
}
272272

273273
func (g *git) getGitCommandOutput(args ...string) string {
274+
inWSLSharedDrive := func(env environmentInfo) bool {
275+
return env.isWsl() && strings.HasPrefix(env.getcwd(), "/mnt/")
276+
}
274277
gitCommand := "git"
275-
if g.env.getRuntimeGOOS() == windowsPlatform || (g.env.isWsl() && strings.HasPrefix(g.env.getcwd(), "/mnt/")) {
278+
if g.env.getRuntimeGOOS() == windowsPlatform || inWSLSharedDrive(g.env) {
276279
gitCommand = "git.exe"
277280
}
278281
args = append([]string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)

0 commit comments

Comments
 (0)