MCPcopy Create free account
hub / github.com/libgit2/git2go / LookupString

Method LookupString

config.go:124–141  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

122}
123
124func (c *Config) LookupString(name string) (string, error) {
125 cname := C.CString(name)
126 defer C.free(unsafe.Pointer(cname))
127
128 valBuf := C.git_buf{}
129
130 runtime.LockOSThread()
131 defer runtime.UnlockOSThread()
132
133 ret := C.git_config_get_string_buf(&valBuf, c.ptr, cname)
134 runtime.KeepAlive(c)
135 if ret < 0 {
136 return "", MakeGitError(ret)
137 }
138 defer C.git_buf_dispose(&valBuf)
139
140 return C.GoString(valBuf.ptr), nil
141}
142
143func (c *Config) LookupBool(name string) (bool, error) {
144 var out C.int

Callers 1

config_test.goFile · 0.80

Calls 2

MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected