diff --git a/.lefthook/pre-commit/lint b/.lefthook/pre-commit/lint index 0b20ba82..bb8a241e 100755 --- a/.lefthook/pre-commit/lint +++ b/.lefthook/pre-commit/lint @@ -1,5 +1,10 @@ #!/bin/sh +if ! git diff --name-only | grep -qe ".*\.go$"; then + echo "Nothing to lint" + exit 0; +fi + if [ -x "$(which brew)" ]; then export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix libffi)/lib/pkgconfig" fi diff --git a/.lefthook/pre-push/test b/.lefthook/pre-push/test index f91b8ce9..6c99bec7 100755 --- a/.lefthook/pre-push/test +++ b/.lefthook/pre-push/test @@ -1,5 +1,10 @@ #!/bin/sh +if ! git diff --name-only | grep -qe ".*\.(go|h|c)$"; then + echo "Nothing to test" + exit 0; +fi + if [ -x "$(which brew)" ]; then export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix libffi)/lib/pkgconfig" fi