1
0
Эх сурвалжийг харах

Run test/lint only when *.go/h/c files are changed

DarthSim 6 жил өмнө
parent
commit
03512c2d0e

+ 5 - 0
.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

+ 5 - 0
.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