MCPcopy Create free account
hub / github.com/github/gh-aw / NormalizeRepoForAPI

Function NormalizeRepoForAPI

pkg/repoutil/repoutil.go:29–35  ·  view source on GitHub ↗

NormalizeRepoForAPI splits a repo string of the form "[HOST/]owner/repo" into the owner/repo portion and an optional host. Most callers pass plain "owner/repo", but GHES and Proxima installs may supply "HOST/owner/repo".

(repo string)

Source from the content-addressed store, hash-verified

27// the owner/repo portion and an optional host. Most callers pass plain
28// "owner/repo", but GHES and Proxima installs may supply "HOST/owner/repo".
29func NormalizeRepoForAPI(repo string) (ownerRepo string, host string) {
30 parts := strings.SplitN(repo, "/", 3)
31 if len(parts) == 3 {
32 return parts[1] + "/" + parts[2], parts[0]
33 }
34 return repo, ""
35}

Callers 7

repoIsLocalFunction · 0.92
TestNormalizeRepoForAPIFunction · 0.92
ghAPIGetFunction · 0.92
ghAPIGetArrayFunction · 0.92
ghAPIGraphQLFunction · 0.92
TestNormalizeRepoForAPIFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestNormalizeRepoForAPIFunction · 0.74
TestNormalizeRepoForAPIFunction · 0.68