MCPcopy
hub / github.com/cli/cli / resolve

Method resolve

pkg/cmd/pr/shared/find_refs_resolution.go:255–272  ·  view source on GitHub ↗

resolve takes a remote and returns a repository representing it.

(remote remote)

Source from the content-addressed store, hash-verified

253
254// resolve takes a remote and returns a repository representing it.
255func (r remoteToRepoResolver) resolve(remote remote) (ghrepo.Interface, error) {
256 switch v := remote.(type) {
257 case remoteName:
258 repo, err := r.remoteNameToRepo(v.name)
259 if err != nil {
260 return nil, fmt.Errorf("could not resolve remote %q: %w", v.name, err)
261 }
262 return repo, nil
263 case remoteURL:
264 repo, err := ghrepo.FromURL(v.url)
265 if err != nil {
266 return nil, fmt.Errorf("could not parse remote URL %q: %w", v.url, err)
267 }
268 return repo, nil
269 default:
270 return nil, fmt.Errorf("unsupported remote type %T, value: %v", v, remote)
271 }
272}
273
274// A defaultPushTarget represents the remote name or URL and a branch name
275// that we would expect a branch to be pushed to if `git push` were run with

Callers 1

Calls 2

FromURLFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected