MCPcopy Create free account
hub / github.com/LunaSource/Luna / GetStagedFiles

Function GetStagedFiles

git/git.go:11–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9 "strings"
10)
11
12// runGit runs a git command and, on failure, returns git's own stderr
13// message (e.g. "not a git repository", "dubious ownership") instead of
14// just the bare exit status.
15func runGit(args ...string) ([]byte, error) {
16 cmd := exec.Command("git", args...)
17 var stderr bytes.Buffer
18 cmd.Stderr = &stderr
19
20 out, err := cmd.Output()
21 if err != nil {
22 msg := strings.TrimSpace(stderr.String())
23 if msg == "" {
24 msg = err.Error()
25 }
26 return nil, fmt.Errorf("%s", msg)
27 }
28 return out, nil
29}

Callers 1

loadFilesFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected