MCPcopy
hub / github.com/cli/cli / FindByRepo

Method FindByRepo

context/remote.go:28–35  ·  view source on GitHub ↗

FindByRepo returns the first Remote that points to a specific GitHub repository

(owner, name string)

Source from the content-addressed store, hash-verified

26
27// FindByRepo returns the first Remote that points to a specific GitHub repository
28func (r Remotes) FindByRepo(owner, name string) (*Remote, error) {
29 for _, rem := range r {
30 if strings.EqualFold(rem.RepoOwner(), owner) && strings.EqualFold(rem.RepoName(), name) {
31 return rem, nil
32 }
33 }
34 return nil, fmt.Errorf("no matching remote found; looking for %s/%s", owner, name)
35}
36
37// Filter remotes by given hostnames, maintains original order
38func (r Remotes) FilterByHosts(hosts []string) Remotes {

Callers 8

Test_Remotes_FindByRepoFunction · 0.95
checkoutBranchFunction · 0.80
forkRunFunction · 0.80
syncLocalRepoFunction · 0.80
updateRemoteFunction · 0.80
deleteLocalBranchMethod · 0.80
checkoutRunFunction · 0.80

Calls 3

RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
ErrorfMethod · 0.65

Tested by 1

Test_Remotes_FindByRepoFunction · 0.76