(branches []api.LinkedBranch, branchRepo ghrepo.Interface, branchName string)
| 256 | } |
| 257 | |
| 258 | func findExistingLinkedBranchName(branches []api.LinkedBranch, branchRepo ghrepo.Interface, branchName string) string { |
| 259 | for _, branch := range branches { |
| 260 | if branch.BranchName != branchName { |
| 261 | continue |
| 262 | } |
| 263 | linkedRepo, err := linkedBranchRepoFromURL(branch.URL) |
| 264 | if err != nil { |
| 265 | continue |
| 266 | } |
| 267 | if ghrepo.IsSame(linkedRepo, branchRepo) { |
| 268 | return branch.BranchName |
| 269 | } |
| 270 | } |
| 271 | return "" |
| 272 | } |
| 273 | |
| 274 | func linkedBranchRepoFromURL(branchURL string) (ghrepo.Interface, error) { |
| 275 | u, err := url.Parse(branchURL) |
no test coverage detected