MCPcopy Create free account
hub / github.com/git-bug/git-bug / DefaultBridge

Function DefaultBridge

bridge/core/bridge.go:133–148  ·  view source on GitHub ↗

Attempt to retrieve a default bridge for the given repo. If zero or multiple bridge exist, it fails.

(repo *cache.RepoCache)

Source from the content-addressed store, hash-verified

131// Attempt to retrieve a default bridge for the given repo. If zero or multiple
132// bridge exist, it fails.
133func DefaultBridge(repo *cache.RepoCache) (*Bridge, error) {
134 bridges, err := ConfiguredBridges(repo)
135 if err != nil {
136 return nil, err
137 }
138
139 if len(bridges) == 0 {
140 return nil, fmt.Errorf("no configured bridge")
141 }
142
143 if len(bridges) > 1 {
144 return nil, fmt.Errorf("multiple bridge are configured, you need to select one explicitly")
145 }
146
147 return LoadBridge(repo, bridges[0])
148}
149
150// ConfiguredBridges return the list of bridge that are configured for the given
151// repo

Callers 1

DefaultBridgeFunction · 0.92

Calls 3

ErrorfMethod · 0.80
ConfiguredBridgesFunction · 0.70
LoadBridgeFunction · 0.70

Tested by

no test coverage detected