MCPcopy
hub / github.com/cli/cli / repoFromPath

Function repoFromPath

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

Source from the content-addressed store, hash-verified

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