Debian Codegraph @

gitconfig_windows.go

raw
1 //go:build windows
2
3 package gitconfig
4
5 import (
6 "os/exec"
7 "path/filepath"
8
9 "github.com/gopasspw/gopass/pkg/debug"
10 )
11
12 var systemConfig string
13
14 func init() {
15 gitPath, err := exec.LookPath("git.exe")
16 if err != nil {
17 debug.Log("git not found in PATH. Can not determine system config location")
18
19 return
20 }
21
22 // gitPath is something like C:\Program Files\Git\cmd\git.exe
23 // we need to strip the last two components to get the base path
24 // and then append etc/gitconfig.
25 systemConfig = filepath.Join(filepath.Dir(filepath.Dir(gitPath)), "etc", "gitconfig")
26 }