From feef4b6b0d5288cadeb6b069dc2616481b0d3f43 Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Mon, 18 Jun 2018 18:17:42 -0700 Subject: [PATCH] devcam hook: correct pathspec for older gits Older git versions (prior to 2.13 / commit https://github.com/git/git/commit/859b7f1d0e742493d2a9396794cd9040213ad846) required a more explicit pattern. This also reorders the gofmt one to put the positive before the negative match for consistency. Fixes #1191 Change-Id: Ie74e3c3d434f667d76d5ebbb76811b4f304800c8 --- dev/devcam/hook.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/devcam/hook.go b/dev/devcam/hook.go index 03fac054f..101bb7c20 100644 --- a/dev/devcam/hook.go +++ b/dev/devcam/hook.go @@ -237,7 +237,7 @@ func (c *hookCmd) hookGofmt() error { func (c *hookCmd) hookTrailingSpace() error { // see 'pathspec' for the ':!' syntax to ignore a directory. - out, _ := cmdOutputDirErr(".", "git", "diff-index", "--check", "--diff-filter=ACM", "--cached", "HEAD", "--", ":!/vendor/") + out, _ := cmdOutputDirErr(".", "git", "diff-index", "--check", "--diff-filter=ACM", "--cached", "HEAD", "--", ".", ":!/vendor/") if out != "" { printf("\n%s", out) printf("Trailing whitespace detected, you need to clean it up manually.\n") @@ -257,7 +257,7 @@ func (c *hookCmd) runGofmt() (files []string, err error) { repo += string(filepath.Separator) } - out, err := cmdOutputDirErr(".", "git", "diff-index", "--name-only", "--diff-filter=ACM", "--cached", "HEAD", "--", ":!/vendor/", ":(glob)**/*.go") + out, err := cmdOutputDirErr(".", "git", "diff-index", "--name-only", "--diff-filter=ACM", "--cached", "HEAD", "--", ":(glob)**/*.go", ":!/vendor/") if err != nil { return nil, err }