MCPcopy
hub / github.com/go-git/go-git / ConfigScoped

Method ConfigScoped

repository.go:573–601  ·  view source on GitHub ↗

ConfigScoped returns the repository config, merged with requested scope and lower. For example if, config.GlobalScope is given the local and global config are returned merged in one config value.

(scope config.Scope)

Source from the content-addressed store, hash-verified

571// lower. For example if, config.GlobalScope is given the local and global config
572// are returned merged in one config value.
573func (r *Repository) ConfigScoped(scope config.Scope) (*config.Config, error) {
574 // TODO(mcuadros): v6, add this as ConfigOptions.Scoped
575
576 var err error
577 system := config.NewConfig()
578 if scope >= config.SystemScope {
579 system, err = config.LoadConfig(config.SystemScope)
580 if err != nil {
581 return nil, err
582 }
583 }
584
585 global := config.NewConfig()
586 if scope >= config.GlobalScope {
587 global, err = config.LoadConfig(config.GlobalScope)
588 if err != nil {
589 return nil, err
590 }
591 }
592
593 local, err := r.Storer.Config()
594 if err != nil {
595 return nil, err
596 }
597
598 _ = mergo.Merge(global, system)
599 _ = mergo.Merge(local, global)
600 return local, nil
601}
602
603// Remote return a remote if exists
604func (r *Repository) Remote(name string) (*Remote, error) {

Callers 3

TestConfigScopedMethod · 0.80
loadConfigTaggerMethod · 0.80

Calls 2

MergeMethod · 0.80
ConfigMethod · 0.65

Tested by 1

TestConfigScopedMethod · 0.64