1
0
Fork 0
mirror of https://github.com/vbatts/git-validation.git synced 2025-07-26 17:00:29 +00:00

whitespace: switch to cheaper check

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-04-06 12:33:31 -04:00
parent 8193a24bc4
commit 3969e46e2b
2 changed files with 18 additions and 26 deletions

View file

@ -57,17 +57,21 @@ var FieldNames = map[string]string{
"%G?": "verification_flag",
}
// Check warns if changes introduce whitespace errors.
// Returns non-zero if any issues are found.
func Check(commit string) ([]byte, error) {
cmd := exec.Command("git", "show", "--check", commit)
cmd.Stderr = os.Stderr
return cmd.Output()
}
// Show returns the diff of a commit.
//
// NOTE: This could be expensive for very large commits.
func Show(commit string) ([]byte, error) {
cmd := exec.Command("git", "show", commit)
cmd.Stderr = os.Stderr
out, err := cmd.Output()
if err != nil {
return nil, err
}
return out, nil
return cmd.Output()
}
// CommitEntry represents a single commit's information from `git`.