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.
()
| 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. |
| 218 | func 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. |