#!/bin/sh # git post-commit hook for pyflakes'ing modified files git log --oneline --name-only | sed -n '2,$p' | while read f; do if [ "${f%.py}" != "$f" -a -e "$f" ]; then echo "$f" elif file "$f" 2> /dev/null | grep python > /dev/null 2>&1; then echo "$f" fi done | xargs pyflakes || echo "PYFLAKES FAILED, PLEASE INSPECT"