Adding egrep hook; better iteration for whitespace; improving local tests
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
# Run all our checking scripts.
|
||||
for script in $(find `dirname "$0"`/scripts.d -type f); do
|
||||
echo "Running ${script}"
|
||||
"$script"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$script" failed checks.
|
||||
|
7
Hooks/scripts.d/egrep
Executable file
7
Hooks/scripts.d/egrep
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if git ls-files | xargs --delimiter='\n' grep -irlE 'egrep' | grep -v 'Hooks/scripts.d/egrep' ; then
|
||||
echo 'Egrep has been deprecated as of GNU grep 3.8 -- replace `egrep` with `grep -E`.'
|
||||
echo https://www.gnu.org/software/grep/manual/grep.html
|
||||
exit 1
|
||||
fi
|
@@ -1,8 +1,11 @@
|
||||
#!/bin/bash
|
||||
# This script ensures that repos can commit personal hooks in the ./precommit-hooks folder.
|
||||
|
||||
for script in `find precommit-hooks -type f`; do
|
||||
if ! bash "$script"; then
|
||||
echo "Local script $script failed checks."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ -d precommit-hooks ]; then
|
||||
for script in `find precommit-hooks -type f`; do
|
||||
if ! bash "$script"; then
|
||||
echo "Local script $script failed checks."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@@ -2,13 +2,12 @@
|
||||
|
||||
# Sourced from https://github.com/git/git/blob/master/templates/hooks--pre-commit.sample
|
||||
|
||||
if git ls-files | xargs egrep -irl '\s\+$' ; then
|
||||
if git ls-files | xargs --delimiter='\n' grep -irlE '\s\+$'; then
|
||||
echo The above lines have trailing whitespace. Run "sed -i 's/\s\+$//'" on the affected files.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||
then
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
|
Reference in New Issue
Block a user