(branches []api.LinkedBranch, branchRepo ghrepo.Interface, branchName string)
| 288 | } |
| 289 | |
| 290 | func findExistingLinkedBranchName(branches []api.LinkedBranch, branchRepo ghrepo.Interface, branchName string) string { |
| 291 | for _, branch := range branches { |
| 292 | if branch.BranchName != branchName { |
| 293 | continue |
| 294 | } |
| 295 | linkedRepo, err := linkedBranchRepoFromURL(branch.URL) |
| 296 | if err != nil { |
| 297 | continue |
| 298 | } |
| 299 | if ghrepo.IsSame(linkedRepo, branchRepo) { |
| 300 | return branch.BranchName |
| 301 | } |
| 302 | } |
| 303 | return "" |
| 304 | } |
| 305 | |
| 306 | func linkedBranchRepoFromURL(branchURL string) (ghrepo.Interface, error) { |
| 307 | u, err := url.Parse(branchURL) |
no test coverage detected