We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0b0a5a commit d33de79Copy full SHA for d33de79
git/realgit/realcmd.go
@@ -21,14 +21,28 @@ func NewGitCmd(cfg *config.Config) *gitcmd {
21
fmt.Println(err)
22
os.Exit(-1)
23
}
24
- rootdir = strings.TrimSpace(rootdir)
+ rootdir = strings.TrimSpace(maybeAdjustPathPerPlatform(rootdir))
25
26
return &gitcmd{
27
config: cfg,
28
rootdir: rootdir,
29
30
31
32
+func maybeAdjustPathPerPlatform(rawRootDir string) string {
33
+ if strings.HasPrefix(rawRootDir, "/cygdrive") {
34
+ // This is safe to run also on "proper" Windows paths
35
+ cmd := exec.Command("cygpath", []string{"-w", rawRootDir}...)
36
+ out, err := cmd.CombinedOutput()
37
+ if err != nil {
38
+ panic(err)
39
+ }
40
+ return string(out)
41
42
+
43
+ return rawRootDir
44
+}
45
46
type gitcmd struct {
47
config *config.Config
48
rootdir string
0 commit comments