Improve hooks

This commit is contained in:
Dennis Eichhorn 2018-06-24 17:22:14 +02:00
parent 1810a203a9
commit 41459ae5cd
4 changed files with 21 additions and 5 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/bash
. logging.sh
. syntax.sh
. Build/Hooks/logging.sh
. Build/Hooks/syntax.sh
. Build/Hooks/filename.sh

15
Hooks/filename.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
allownonascii="false"
git diff --cached --name-only | while read FILE; do
if [ "$allownonascii" != "true" ] &&
test $(git diff --cached --name-only --diff-filter=A -z $FILE |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
echo -e "\e[1;31m\tInvalid file name.\e[0m" >&2
exit 1
fi
done || exit $?

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
git diff --cached --name-only | while read FILE; do
if [[ "$FILE" =~ ^.+(php)$ ]]; then

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
git diff --cached --name-only | while read FILE; do