summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-10-26 21:44:16 +0100
committerCarlos Martín Nieto <[email protected]>2015-10-26 21:44:16 +0100
commit749963ce55c6391bf7222057b037344a0cb837cf (patch)
treeb0b8d11250139b37a76c6ead494114411c2970dc /config.go
parentc4868aef6c3e22a5c339dea4dd5406bfc0bd095b (diff)
parent367cd8eb9b84538933774befa76c099298c32c81 (diff)
Merge pull request #266 from clns/update-libgit2
[next] Update libgit2 to 821131f
Diffstat (limited to 'config.go')
-rw-r--r--config.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/config.go b/config.go
index 9d25e35..73365c8 100644
--- a/config.go
+++ b/config.go
@@ -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
+}