diff options
| author | Carlos Martín Nieto <[email protected]> | 2016-03-07 11:17:10 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2016-03-07 11:22:53 +0100 |
| commit | 2ae7d13ba1037c7fa579fc52263ea280b37244ea (patch) | |
| tree | f2509df04ec4e6187943aad83ea672e660102a8b /config.go | |
| parent | fa644d2fc9efa3baee93b525212d76dfa17a5db5 (diff) | |
| parent | e095c85fd06b5820d2f0098ff3e66b266553dbd5 (diff) | |
Merge branch 'next'
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -12,6 +12,9 @@ import ( type ConfigLevel int const ( + // System-wide on Windows, for compatibility with portable git + ConfigLevelProgramdata ConfigLevel = C.GIT_CONFIG_LEVEL_PROGRAMDATA + // System-wide configuration file; /etc/gitconfig on Linux systems ConfigLevelSystem ConfigLevel = C.GIT_CONFIG_LEVEL_SYSTEM @@ -412,3 +415,21 @@ func ConfigFindXDG() (string, error) { return C.GoString(buf.ptr), nil } + +// ConfigFindProgramdata locate the path to the configuration file in ProgramData. +// +// Look for the file in %PROGRAMDATA%\Git\config used by portable git. +func ConfigFindProgramdata() (string, error) { + var buf C.git_buf + defer C.git_buf_free(&buf) + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ret := C.git_config_find_programdata(&buf) + if ret < 0 { + return "", MakeGitError(ret) + } + + return C.GoString(buf.ptr), nil +} |
