File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if REV=$( git rev-parse -q --verify HEAD) ; then
4+ against=HEAD
5+ else
6+ # Initial commit: diff against an empty tree object
7+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
8+ fi
9+
10+ FILES=$( git diff-index --name-only --cached --diff-filter=ACMR $against -- )
11+
12+ if [ " $FILES " == " " ]; then
13+ echo " No files to check with PHPCS."
14+ exit 0
15+ fi
16+
17+ set -ex
18+
19+ {{PHPCS_BIN}} -s $FILES
Original file line number Diff line number Diff line change 2525pre_commit_file=" $( git rev-parse --git-dir) /hooks/pre-commit"
2626
2727if [[ ! -f " $pre_commit_file " ]]; then
28- echo -e " #!/bin/bash\nset -ex\n $phpcs_bin " > $pre_commit_file
28+ cat utils/git-pre-commit-script | sed ' s|{{PHPCS_BIN}}| ' $phpcs_bin ' | ' > $pre_commit_file
2929 chmod +x $pre_commit_file
3030elif ! grep -q " phpcs" $pre_commit_file ; then
3131 echo -e " hook file already exists: $pre_commit_file \n\nplease add the below command to your pre-commit file:\n\n$phpcs_bin "
You can’t perform that action at this time.
0 commit comments