MCPcopy Create free account
hub / github.com/mroth/bump / parseGithubRemote

Function parseGithubRemote

git.go:79–86  ·  view source on GitHub ↗

parseGithubRemote parses string remoteURL against known patterns matching GitHub remotes and returns the owner and repo, along with a boolean ok indicating whether a match was found. Possible GitHub remote formats (HTTPS/SSH): https://github.com/mroth/bump.git git@github.com:mroth/bump.git

(remoteURL string)

Source from the content-addressed store, hash-verified

77// https://github.com/mroth/bump.git
78// git@github.com:mroth/bump.git
79func parseGithubRemote(remoteURL string) (owner, repo string, ok bool) {
80 re := regexp.MustCompile(`^(?:https://|git@)github.com[:/](.*)/(.*?)(?:\.git$|$)`)
81 matches := re.FindStringSubmatch(remoteURL)
82 if len(matches) < 3 {
83 return
84 }
85 return matches[1], matches[2], true
86}

Callers 3

githubRepoDetectFunction · 0.85
Test_parseGithubRemoteFunction · 0.85

Calls

no outgoing calls

Tested by 2

Test_parseGithubRemoteFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…