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

Function getRepositorySlugFromRemote

pkg/cli/git.go:218–233  ·  view source on GitHub ↗

getRepositorySlugFromRemote extracts the repository slug (owner/repo) from git remote URL. It prefers the 'origin' remote for backward compatibility. If 'origin' is not configured but exactly one other remote exists, that remote is used instead.

()

Source from the content-addressed store, hash-verified

216// It prefers the 'origin' remote for backward compatibility. If 'origin' is not
217// configured but exactly one other remote exists, that remote is used instead.
218func getRepositorySlugFromRemote() string {
219 gitLog.Print("Getting repository slug from git remote")
220
221 remoteURL, _, err := resolveRemoteURL("")
222 if err != nil {
223 gitLog.Printf("Failed to resolve remote URL: %v", err)
224 return ""
225 }
226
227 slug := parseGitHubRepoSlugFromURL(remoteURL)
228 if slug != "" {
229 gitLog.Printf("Repository slug: %s", slug)
230 }
231
232 return slug
233}
234
235// getRepositorySlugFromRemotePreferringUpstream extracts the repository slug (owner/repo)
236// from git remotes, preferring the 'upstream' remote when available.

Calls 4

resolveRemoteURLFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45