MCPcopy
hub / github.com/mislav/hub / NewProjectFromURL

Function NewProjectFromURL

github/project.go:116–132  ·  view source on GitHub ↗
(url *url.URL)

Source from the content-addressed store, hash-verified

114}
115
116func NewProjectFromURL(url *url.URL) (p *Project, err error) {
117 if !knownGitHubHostsInclude(url.Host) {
118 err = &GithubHostError{url}
119 return
120 }
121
122 parts := strings.SplitN(url.Path, "/", 4)
123 if len(parts) <= 2 {
124 err = fmt.Errorf("Invalid GitHub URL: %s", url)
125 return
126 }
127
128 name := strings.TrimSuffix(parts[2], ".git")
129 p = newProject(parts[1], name, url.Host, url.Scheme)
130
131 return
132}
133
134func NewProject(owner, name, host string) *Project {
135 return newProject(owner, name, host, "")

Callers 5

findPushTargetFunction · 0.92
NewProjectFromRepoFunction · 0.85
ProjectMethod · 0.85
ParseURLFunction · 0.85

Calls 3

knownGitHubHostsIncludeFunction · 0.85
newProjectFunction · 0.85
ErrorfMethod · 0.65

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…