resolve takes a remote and returns a repository representing it.
(remote remote)
| 253 | |
| 254 | // resolve takes a remote and returns a repository representing it. |
| 255 | func (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 |
no test coverage detected