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

Function RepoNameFromRemote

internal/skills/registry/registry.go:447–460  ·  view source on GitHub ↗

RepoNameFromRemote extracts "owner/repo" from a git remote URL.

(remote string)

Source from the content-addressed store, hash-verified

445
446// RepoNameFromRemote extracts "owner/repo" from a git remote URL.
447func RepoNameFromRemote(remote string) string {
448 if remote == "" {
449 return ""
450 }
451 u, err := git.ParseURL(remote)
452 if err != nil {
453 return ""
454 }
455 repo, err := ghrepo.FromURL(u)
456 if err != nil {
457 return ""
458 }
459 return ghrepo.FullName(repo)
460}

Callers 1

TestRepoNameFromRemoteFunction · 0.85

Calls 3

ParseURLFunction · 0.92
FromURLFunction · 0.92
FullNameFunction · 0.92

Tested by 1

TestRepoNameFromRemoteFunction · 0.68