MCPcopy
hub / github.com/cli/cli / TranslateRemotes

Function TranslateRemotes

context/remote.go:105–123  ·  view source on GitHub ↗
(gitRemotes git.RemoteSet, translator Translator)

Source from the content-addressed store, hash-verified

103}
104
105func TranslateRemotes(gitRemotes git.RemoteSet, translator Translator) (remotes Remotes) {
106 for _, r := range gitRemotes {
107 var repo ghrepo.Interface
108 if r.FetchURL != nil {
109 repo, _ = ghrepo.FromURL(translator.Translate(r.FetchURL))
110 }
111 if r.PushURL != nil && repo == nil {
112 repo, _ = ghrepo.FromURL(translator.Translate(r.PushURL))
113 }
114 if repo == nil {
115 continue
116 }
117 remotes = append(remotes, &Remote{
118 Remote: r,
119 Repo: repo,
120 })
121 }
122 return
123}

Callers 2

ResolverMethod · 0.92
Test_translateRemotesFunction · 0.85

Calls 2

FromURLFunction · 0.92
TranslateMethod · 0.65

Tested by 1

Test_translateRemotesFunction · 0.68