MCPcopy Index your code
hub / github.com/nikivdev/go / gitRemoteState

Function gitRemoteState

cli/flow/main.go:4949–4965  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

4947}
4948
4949func gitRemoteState(name string) (bool, string, error) {
4950 cmd := exec.Command("git", "remote", "get-url", name)
4951 out, err := cmd.CombinedOutput()
4952 if err != nil {
4953 trimmed := strings.TrimSpace(string(out))
4954 lowered := strings.ToLower(trimmed)
4955 if strings.Contains(lowered, "no such remote") {
4956 return false, "", nil
4957 }
4958 if trimmed != "" {
4959 return false, "", fmt.Errorf("git remote get-url %s: %s", name, trimmed)
4960 }
4961 return false, "", fmt.Errorf("git remote get-url %s: %w", name, err)
4962 }
4963
4964 return true, strings.TrimSpace(string(out)), nil
4965}
4966
4967func detectDefaultBranch() string {
4968 out, err := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD").Output()

Callers 4

runGitFetchUpstreamFunction · 0.85
runGitSyncForkFunction · 0.85
runGitMirrorSetupFunction · 0.85
resolveGitMirrorRemoteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected