Пример #1
0
func (cfg *Config) AddFileOnDisk(path string, priority int) error {
	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))
	ecode := C.git_config_add_file_ondisk(cfg.git_config, cpath, C.int(priority))
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}
Пример #2
0
// AddFile adds a file-backed backend to the config object at the specified level.
func (c *Config) AddFile(path string, level ConfigLevel, force bool) error {
	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_config_add_file_ondisk(c.ptr, cpath, C.git_config_level_t(level), cbool(force))
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}