MCPcopy
hub / github.com/nikivdev/go / ensureGitRepository

Function ensureGitRepository

cli/flow/main.go:5071–5087  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5069}
5070
5071func ensureGitRepository() error {
5072 cmd := exec.Command("git", "rev-parse", "--is-inside-work-tree")
5073 out, err := cmd.CombinedOutput()
5074 if err != nil {
5075 trimmed := strings.TrimSpace(string(out))
5076 if trimmed != "" {
5077 return fmt.Errorf("%s", trimmed)
5078 }
5079 return fmt.Errorf("git rev-parse --is-inside-work-tree: %w", err)
5080 }
5081
5082 if strings.TrimSpace(string(out)) != "true" {
5083 return fmt.Errorf("not inside a git repository")
5084 }
5085
5086 return nil
5087}
5088
5089func listGitRemotes() ([]string, error) {
5090 out, err := exec.Command("git", "remote").Output()

Callers 11

runBranchFromClipboardFunction · 0.85
prepareCommitFunction · 0.85
runCreateRepoFromRemoteFunction · 0.85
runGitIgnoreFunction · 0.85
runGitDiffSizeFunction · 0.85
runSmartCherryPickFunction · 0.85
runGitFetchUpstreamFunction · 0.85
runGitSyncForkFunction · 0.85
runGitMirrorFunction · 0.85
runGitCheckoutFunction · 0.85
runGitCheckoutRemoteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected