We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b5bf2d commit 4579d16Copy full SHA for 4579d16
.githooks/pre-commit
@@ -0,0 +1,26 @@
1
+#!/bin/sh
2
+FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
3
+PROJECT=`php -r "echo dirname(dirname(realpath('$0')));"`
4
+
5
+# Determine if a file list is passed
6
+if [ "$#" -eq 1 ]
7
+then
8
+ oIFS=$IFS
9
+ IFS='
10
+ '
11
+ SFILES="$1"
12
+ IFS=$oIFS
13
+fi
14
+SFILES=${SFILES:-$FILES}
15
16
+for FILE in $SFILES
17
+do
18
+ php -l -n -d display_errors=0 $PROJECT/$FILE 1> /dev/null
19
+ if [ $? != 0 ]
20
+ then
21
+ echo
22
+ echo "Fix the error before commit."
23
+ exit 1
24
+ fi
25
+ FILES="$FILES $PROJECT/$FILE"
26
+done
deploy.sh
@@ -146,6 +146,7 @@ README.md
146
CHANGELOG.md
147
.git
148
.gitignore
149
+.githooks
150
tests
151
test
152
phpunit.xml
0 commit comments