Exemplo n.º 1
0
func (cfg *Config) SetMultivar(name, regexp, value string) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	cregexp := C.CString(regexp)
	defer C.free(unsafe.Pointer(cregexp))
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))
	ecode := C.git_config_set_multivar(cfg.git_config, cname, cregexp, cvalue)
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}
Exemplo n.º 2
0
Arquivo: config.go Projeto: wid/git2go
func (c *Config) SetMultivar(name, regexp, value string) (err error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	cregexp := C.CString(regexp)
	defer C.free(unsafe.Pointer(cregexp))

	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_config_set_multivar(c.ptr, cname, cregexp, cvalue)
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}