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

Function repoFromPath

pkg/cmd/extension/manager.go:773–798  ·  view source on GitHub ↗
(gitClient gitClient, path string)

Source from the content-addressed store, hash-verified

771}
772
773func repoFromPath(gitClient gitClient, path string) (ghrepo.Interface, error) {
774 scopedClient := gitClient.ForRepo(path)
775 remotes, err := scopedClient.Remotes()
776 if err != nil {
777 return nil, err
778 }
779
780 if len(remotes) == 0 {
781 return nil, fmt.Errorf("no remotes configured for %s", path)
782 }
783
784 var remote *git.Remote
785
786 for _, r := range remotes {
787 if r.Name == "origin" {
788 remote = r
789 break
790 }
791 }
792
793 if remote == nil {
794 remote = remotes[0]
795 }
796
797 return ghrepo.FromURL(remote.FetchURL)
798}
799
800func possibleDists() []string {
801 return []string{

Callers 1

upgradeExtensionMethod · 0.85

Calls 4

FromURLFunction · 0.92
ForRepoMethod · 0.65
RemotesMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected