Exemplo n.º 1
0
Arquivo: git.go Projeto: fsouza/gogit
// SetString is used to add a string setting to the config file.
//
// The format of the configuration parameter is the same as in GetBool. If the
// parameter is not declared in the config file, it will be created.
func (c *Config) SetString(name, value string) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))
	if C.git_config_set_string(c.config, cname, cvalue) != C.GIT_OK {
		return lastErr()
	}
	return nil
}
Exemplo n.º 2
0
func (cfg *Config) SetString(name, value string) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))
	ecode := C.git_config_set_string(cfg.git_config, cname, cvalue)
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}
Exemplo n.º 3
0
func (c *Config) Set(name, value string) (err error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

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

	ret := C.git_config_set_string(c.ptr, cname, cvalue)
	if ret < 0 {
		return LastError()
	}

	return nil
}
Exemplo n.º 4
0
Arquivo: config.go Projeto: wid/git2go
func (c *Config) SetString(name, value string) (err error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

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

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

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

	return nil
}