MCPcopy Index your code
hub / github.com/google/git-appraise / runGitCommandWithEnv

Method runGitCommandWithEnv

repository/git.go:83–95  ·  view source on GitHub ↗

Run the given git command and return its stdout, or an error if the command fails.

(env []string, args ...string)

Source from the content-addressed store, hash-verified

81
82// Run the given git command and return its stdout, or an error if the command fails.
83func (repo *GitRepo) runGitCommandWithEnv(env []string, args ...string) (string, error) {
84 var stdout bytes.Buffer
85 var stderr bytes.Buffer
86 err := repo.runGitCommandWithIOAndEnv(nil, &stdout, &stderr, env, args...)
87 if err != nil {
88 stderrStr := strings.TrimSpace(stderr.String())
89 if stderrStr == "" {
90 stderrStr = "Error running git command: " + strings.Join(args, " ")
91 }
92 err = fmt.Errorf(stderrStr)
93 }
94 return strings.TrimSpace(stdout.String()), err
95}
96
97// Run the given git command using the same stdin, stdout, and stderr as the review tool.
98func (repo *GitRepo) runGitCommandInline(args ...string) error {

Callers 1

CreateCommitMethod · 0.95

Calls 2

StringMethod · 0.80

Tested by

no test coverage detected