Skip to content

Commit

Permalink
refactor: create inline function inWSLSharedDrive
Browse files Browse the repository at this point in the history
  • Loading branch information
evilz authored and JanDeDobbeleer committed Mar 10, 2021
1 parent 500cc58 commit 21ecfa4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/segment_git.go
Expand Up @@ -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...)
Expand Down

0 comments on commit 21ecfa4

Please sign in to comment.