MCPcopy Create free account
hub / github.com/celer-pkg/celer / getRemoteNames

Function getRemoteNames

pkgs/git/local.go:274–289  ·  view source on GitHub ↗
(repoDir string)

Source from the content-addressed store, hash-verified

272}
273
274func 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
291func getPrimaryRemote(repoDir string) (string, error) {
292 remotes, err := getRemoteNames(repoDir)

Callers 1

getPrimaryRemoteFunction · 0.85

Calls 1

CommandMethod · 0.65

Tested by

no test coverage detected