GetDiffForCommit returns the diff for a single commit using git show.
(dir, commitHash string)
| 127 | |
| 128 | // GetDiffForCommit returns the diff for a single commit using git show. |
| 129 | func GetDiffForCommit(dir, commitHash string) (string, error) { |
| 130 | cmd := exec.Command("git", "show", "--format=", commitHash) |
| 131 | cmd.Dir = dir |
| 132 | output, err := cmd.Output() |
| 133 | if err != nil { |
| 134 | return "", err |
| 135 | } |
| 136 | return string(output), nil |
| 137 | } |
| 138 | |
| 139 | // GetDiffStatsForCommit returns the diffstat for a single commit. |
| 140 | func GetDiffStatsForCommit(dir, commitHash string) (string, error) { |