MCPcopy
hub / github.com/cli/cli / RepoNameFromRemote

Function RepoNameFromRemote

internal/skills/registry/registry.go:422–435  ·  view source on GitHub ↗

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

(remote string)

Source from the content-addressed store, hash-verified

420
421// RepoNameFromRemote extracts "owner/repo" from a git remote URL.
422func RepoNameFromRemote(remote string) string {
423 if remote == "" {
424 return ""
425 }
426 u, err := git.ParseURL(remote)
427 if err != nil {
428 return ""
429 }
430 repo, err := ghrepo.FromURL(u)
431 if err != nil {
432 return ""
433 }
434 return ghrepo.FullName(repo)
435}

Callers 1

TestRepoNameFromRemoteFunction · 0.85

Calls 3

ParseURLFunction · 0.92
FromURLFunction · 0.92
FullNameFunction · 0.92

Tested by 1

TestRepoNameFromRemoteFunction · 0.68