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

Function repoFromPath

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

Source from the content-addressed store, hash-verified

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