mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-01-11 11:48:40 +00:00
Improve hooks
This commit is contained in:
parent
1810a203a9
commit
41459ae5cd
|
|
@ -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
15
Hooks/filename.sh
Normal 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 $?
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
git diff --cached --name-only | while read FILE; do
|
||||
if [[ "$FILE" =~ ^.+(php)$ ]]; then
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
git diff --cached --name-only | while read FILE; do
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user