]> Cypherpunks repositories - gostls13.git/commitdiff
misc/git: Fix non-literal period in pre-commit grep
authorDerek Shockey <derek.shockey@gmail.com>
Wed, 24 Feb 2016 05:17:25 +0000 (21:17 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 26 Feb 2016 19:06:38 +0000 (19:06 +0000)
Looks like this was intended to match a literal period to restrict
this to `.go` files, but in POSIX grep, the unescaped period matches
any character.

Change-Id: I20e00323baa9e9631792eff5035966297665bbee
Reviewed-on: https://go-review.googlesource.com/19880
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/git/pre-commit

index 18b7f832f36ec4ed349bd71fa67ee15fdf5bbd1c..242159f04af5436702e0880dedd00c8b6796498f 100755 (executable)
@@ -10,7 +10,7 @@
 #
 # This script does not handle file names that contain spaces.
 
-gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '.go$')
+gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
 [ -z "$gofiles" ] && exit 0
 
 unformatted=$(gofmt -l $gofiles)