MCPcopy Index your code
hub / github.com/cli/cli / findExistingLinkedBranchName

Function findExistingLinkedBranchName

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

Source from the content-addressed store, hash-verified

256}
257
258func 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
274func linkedBranchRepoFromURL(branchURL string) (ghrepo.Interface, error) {
275 u, err := url.Parse(branchURL)

Callers 1

developRunCreateFunction · 0.85

Calls 2

IsSameFunction · 0.92
linkedBranchRepoFromURLFunction · 0.85

Tested by

no test coverage detected