(repoDir string)
| 272 | } |
| 273 | |
| 274 | func getRemoteNames(repoDir string) ([]string, error) { |
| 275 | cmd := exec.Command("git", "-C", repoDir, "remote") |
| 276 | output, err := cmd.CombinedOutput() |
| 277 | if err != nil { |
| 278 | return nil, fmt.Errorf("git remote failed: %v", err) |
| 279 | } |
| 280 | |
| 281 | var remotes []string |
| 282 | for line := range strings.SplitSeq(strings.TrimSpace(string(output)), "\n") { |
| 283 | line = strings.TrimSpace(line) |
| 284 | if line != "" { |
| 285 | remotes = append(remotes, line) |
| 286 | } |
| 287 | } |
| 288 | return remotes, nil |
| 289 | } |
| 290 | |
| 291 | func getPrimaryRemote(repoDir string) (string, error) { |
| 292 | remotes, err := getRemoteNames(repoDir) |
no test coverage detected