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

Function getPrimaryRemote

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

Source from the content-addressed store, hash-verified

289}
290
291func getPrimaryRemote(repoDir string) (string, error) {
292 remotes, err := getRemoteNames(repoDir)
293 if err != nil {
294 return "", err
295 }
296 if len(remotes) == 0 {
297 return "", nil
298 }
299
300 for _, remote := range remotes {
301 if remote == "origin" {
302 return remote, nil
303 }
304 }
305 return remotes[0], nil
306}
307
308func getUpstreamBranch(repoDir string) (string, error) {
309 cmd := exec.Command("git", "-C", repoDir, "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}")

Callers 1

RevParseRepoRefFunction · 0.85

Calls 1

getRemoteNamesFunction · 0.85

Tested by

no test coverage detected