Run the given git command and return its stdout, or an error if the command fails.
(env []string, args ...string)
| 81 | |
| 82 | // Run the given git command and return its stdout, or an error if the command fails. |
| 83 | func (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. |
| 98 | func (repo *GitRepo) runGitCommandInline(args ...string) error { |
no test coverage detected