From b0f4dc1f88659f228227491753b3fce0f06c8b6c Mon Sep 17 00:00:00 2001 From: Dave Barnwell Date: Wed, 21 Jan 2015 14:57:17 +0000 Subject: [PATCH] Handle spaces in file names/paths --- pre-commit | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pre-commit b/pre-commit index a29ad76..d17465c 100755 --- a/pre-commit +++ b/pre-commit @@ -3,6 +3,7 @@ # Author: Vytautas Povilaitis # # XDebug check added by William Clemens +# Handle spaces in filenames Dave Barnwell ROOT_DIR="$(pwd)/" LIST=$(git diff-index --cached --name-only --diff-filter=ACMR HEAD) @@ -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" @@ -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