Skip to content

Commit

Permalink
refactor: improve dir detect
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Dec 4, 2020
1 parent 5a8d338 commit 2b7c5d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/client/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path"
"regexp"
"runtime"
"sort"
"strings"

Expand Down Expand Up @@ -39,7 +40,11 @@ func NewGitClient(dir string) (*GitClient, error) {
return nil, errors.WithStack(err)
}

if !path.IsAbs(dir) && !winAbsolutePathRegegp.MatchString(dir) {
if runtime.GOOS == "windows" {
if !winAbsolutePathRegegp.MatchString(dir) {
dir = path.Join(cwd, dir)
}
} else if !path.IsAbs(dir) {
dir = path.Join(cwd, dir)
}

Expand Down

0 comments on commit 2b7c5d4

Please sign in to comment.