File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 66# pre-commit
77#
88# - Soft link into .git/hooks/pre-commit
9- # - $ ln -s tools/pre-commit .git/hooks/pre-commit
9+ # - $ ln -s ../../ tools/pre-commit .git/hooks/pre-commit
1010# - Ensure executable
1111
1212set -e
1313
1414# Get changed files that are Added or Modified
15- files=$( git diff --staged --name-only --diff-filter=AM)
15+ if [[ " $1 " ]]; then
16+ files=$( find $1 -type f -follow -print)
17+ else
18+ files=$( git diff --staged --name-only --diff-filter=AM)
19+ fi
1620
1721fail=0
1822for file in $files ; do
@@ -23,7 +27,7 @@ for file in $files; do
2327 [ -f " $file " ] || continue
2428
2529 # Check if file is not empty, is a SmartThings driver and has the copyright header
26- if [ -s " $file " ] && [[ " $file " =~ " drivers/SmartThings" ]]
30+ if [ -s " $file " ] && [[ " $file " =~ " drivers/SmartThings" ]] \
2731 && [[ ! $( grep $file -P -e " -{2,} Copyright \d{4}(?:-\d{4})? SmartThings" ) ]]; then
2832 echo " $file : SmartThings Copyright missing from file"
2933 fail=1
You can’t perform that action at this time.
0 commit comments