Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config.dist
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ PHPMD_SUFFIXES=php

# PHP Mess Detector list of files/folders to exclude
PHPMD_EXCLUDE=

# List of file patterns to exclude (using `grep`)
GIT_EXCLUDE="Test"
11 changes: 9 additions & 2 deletions pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ fi

# This is the magic:
# Retrieve all files in staging area that are added, modified or renamed
# but no deletions etc
FILES=$(git diff-index --name-only --cached --diff-filter=ACMR $against -- )
# but no deletions etc.
# Lets first check if there are any file pattern to exclude from this list
if [ "$GIT_EXCLUDE" != "" ]; then
GIT_EXCLUDE_LIST="| grep -v $GIT_EXCLUDE"
else
GIT_EXCLUDE_LIST=""
fi

FILES=$(git diff-index --name-only --cached --diff-filter=ACMR $against -- $GIT_EXCLUDE_LIST)

if [ "$FILES" == "" ]; then
exit 0
Expand Down