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

Function RepoNameFromRemote

internal/skills/registry/registry.go:455–468  ·  view source on GitHub ↗

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

(remote string)

Source from the content-addressed store, hash-verified

453
454// RepoNameFromRemote extracts "owner/repo" from a git remote URL.
455func RepoNameFromRemote(remote string) string {
456 if remote == "" {
457 return ""
458 }
459 u, err := git.ParseURL(remote)
460 if err != nil {
461 return ""
462 }
463 repo, err := ghrepo.FromURL(u)
464 if err != nil {
465 return ""
466 }
467 return ghrepo.FullName(repo)
468}

Callers 1

TestRepoNameFromRemoteFunction · 0.85

Calls 3

ParseURLFunction · 0.92
FromURLFunction · 0.92
FullNameFunction · 0.92

Tested by 1

TestRepoNameFromRemoteFunction · 0.68