Skip to content

Commit

Permalink
Handle spaces in file names/paths
Browse files Browse the repository at this point in the history
  • Loading branch information
davebarnwell committed Jan 21, 2015
1 parent 2436acd commit b0f4dc1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Author: Vytautas Povilaitis <[email protected]>
#
# XDebug check added by William Clemens <http://github.com/wesclemens>
# Handle spaces in filenames Dave Barnwell <https://github.com/freshsauce>

ROOT_DIR="$(pwd)/"
LIST=$(git diff-index --cached --name-only --diff-filter=ACMR HEAD)
Expand All @@ -11,7 +12,7 @@ for file in $LIST
do
EXTENSION=$(echo "$file" | grep ".php$")
if [ "$EXTENSION" != "" ]; then
ERRORS=$(php -l $ROOT_DIR$file 2>&1 | grep "Parse error")
ERRORS=$(php -l "$ROOT_DIR$file" 2>&1 | grep "Parse error")
if [ "$ERRORS" != "" ]; then
if [ "$ERRORS_BUFFER" != "" ]; then
ERRORS_BUFFER="$ERRORS_BUFFER\n$ERRORS"
Expand All @@ -22,7 +23,7 @@ do
fi

# Check for xdebug statments
ERRORS=$(grep -nH xdebug_ $ROOT_DIR$file | \
ERRORS=$(grep -nH xdebug_ "$ROOT_DIR$file" | \
sed -e 's/^/Found XDebug Statment : /')
if [ "$ERRORS" != "" ]; then
if [ "$ERRORS_BUFFER" != "" ]; then
Expand Down

0 comments on commit b0f4dc1

Please sign in to comment.