Exemple #1
0
func OpenConfigOnDisk(path string) (*Config, error) {
	cfg := new(Config)
	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))
	ecode := C.git_config_open_ondisk(&cfg.git_config, cpath)
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return cfg, nil
}
Exemple #2
0
// OpenOndisk creates a new config instance containing a single on-disk file
func OpenOndisk(parent *Config, path string) (*Config, error) {
	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))

	config := new(Config)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	if ret := C.git_config_open_ondisk(&config.ptr, cpath); ret < 0 {
		return nil, MakeGitError(ret)
	}

	return config, nil
}