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

Method OpenLevel

config.go:331–345  ·  view source on GitHub ↗

OpenLevel creates a single-level focused config object from a multi-level one

(parent *Config, level ConfigLevel)

Source from the content-addressed store, hash-verified

329
330// OpenLevel creates a single-level focused config object from a multi-level one
331func (c *Config) OpenLevel(parent *Config, level ConfigLevel) (*Config, error) {
332 config := new(Config)
333
334 runtime.LockOSThread()
335 defer runtime.UnlockOSThread()
336
337 ret := C.git_config_open_level(&config.ptr, parent.ptr, C.git_config_level_t(level))
338 runtime.KeepAlive(c)
339 runtime.KeepAlive(parent)
340 if ret < 0 {
341 return nil, MakeGitError(ret)
342 }
343
344 return config, nil
345}
346
347// OpenOndisk creates a new config instance containing a single on-disk file
348func OpenOndisk(path string) (*Config, error) {

Callers 1

TestRepositorySetConfigFunction · 0.95

Calls 1

MakeGitErrorFunction · 0.85

Tested by 1

TestRepositorySetConfigFunction · 0.76