diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-10-26 21:44:16 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-10-26 21:44:16 +0100 |
| commit | 749963ce55c6391bf7222057b037344a0cb837cf (patch) | |
| tree | b0b8d11250139b37a76c6ead494114411c2970dc /config.go | |
| parent | c4868aef6c3e22a5c339dea4dd5406bfc0bd095b (diff) | |
| parent | 367cd8eb9b84538933774befa76c099298c32c81 (diff) | |
Merge pull request #266 from clns/update-libgit2
[next] Update libgit2 to 821131f
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 @@ -410,3 +413,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 +} |
