MCPcopy Create free account
hub / github.com/cli/cli / findExistingLinkedBranchName

Function findExistingLinkedBranchName

pkg/cmd/issue/develop/develop.go:290–304  ·  view source on GitHub ↗
(branches []api.LinkedBranch, branchRepo ghrepo.Interface, branchName string)

Source from the content-addressed store, hash-verified

288}
289
290func 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
306func linkedBranchRepoFromURL(branchURL string) (ghrepo.Interface, error) {
307 u, err := url.Parse(branchURL)

Callers 1

developRunCreateFunction · 0.85

Calls 2

IsSameFunction · 0.92
linkedBranchRepoFromURLFunction · 0.85

Tested by

no test coverage detected