MCPcopy Index your code
hub / github.com/git-bug/git-bug / LoadBridge

Function LoadBridge

bridge/core/bridge.go:109–129  ·  view source on GitHub ↗

LoadBridge instantiate a new bridge from a repo configuration

(repo *cache.RepoCache, name string)

Source from the content-addressed store, hash-verified

107
108// LoadBridge instantiate a new bridge from a repo configuration
109func LoadBridge(repo *cache.RepoCache, name string) (*Bridge, error) {
110 conf, err := loadConfig(repo, name)
111 if err != nil {
112 return nil, err
113 }
114
115 target := conf[ConfigKeyTarget]
116 bridge, err := NewBridge(repo, target, name)
117 if err != nil {
118 return nil, err
119 }
120
121 err = bridge.impl.ValidateConfig(conf)
122 if err != nil {
123 return nil, errors.Wrap(err, "invalid configuration")
124 }
125
126 // will avoid reloading configuration before an export or import call
127 bridge.conf = conf
128 return bridge, nil
129}
130
131// Attempt to retrieve a default bridge for the given repo. If zero or multiple
132// bridge exist, it fails.

Callers 2

LoadBridgeFunction · 0.92
DefaultBridgeFunction · 0.70

Calls 3

loadConfigFunction · 0.85
NewBridgeFunction · 0.70
ValidateConfigMethod · 0.65

Tested by

no test coverage detected