add some hooks
This commit is contained in:
23
pre-receive-hook-pep8-check.sh
Normal file
23
pre-receive-hook-pep8-check.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
COMMAND='flake8'
|
||||
TEMPDIR=`mktemp -d`
|
||||
|
||||
while read oldrev newrev refname; do
|
||||
files=`git diff --name-only ${oldrev} ${newrev}`
|
||||
for file in ${files}; do
|
||||
object=`git ls-tree --full-name -r ${newrev} | egrep "(\s)${file}\$" | awk '{ print $3 }'`
|
||||
if [ -z ${object} ]; then continue; fi
|
||||
mkdir -p "${TEMPDIR}/`dirname ${file}`" &> /dev/null
|
||||
git cat-file blob ${object} > ${TEMPDIR}/${file}
|
||||
done;
|
||||
done
|
||||
|
||||
# Change the filename here if your flake8 configuration
|
||||
# has a different name.
|
||||
git show HEAD:tox.ini > ${TEMPDIR}/tox.ini
|
||||
${COMMAND} ${TEMPDIR}
|
||||
STATUS=$?
|
||||
rm -rf ${TEMPDIR} &> /dev/null
|
||||
echo status $STATUS
|
||||
exit ${STATUS}
|
||||
Reference in New Issue
Block a user