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

Function repoFromPath

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

Source from the content-addressed store, hash-verified

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