wine-staging/precommit-hook.sh
2015-11-20 22:22:26 +01:00

28 lines
675 B
Bash
Executable File

#!/bin/bash
# Installation: ln -s ../../precommit-hook.sh .git/hooks/pre-commit
warning()
{
echo ""
echo "*** $1 ***"
echo ""
}
if git status --porcelain "patch-tools" | grep "^.[^ ]" &> /dev/null; then
warning "PLEASE ADD OR STASH YOUR CHANGES IN patch-tools"
exit 1
fi
if git status --porcelain "patches" | grep -v "^.\\?.*\\.py$" | grep "^.[^ ]" &> /dev/null; then
warning "PLEASE ADD OR STASH YOUR CHANGES IN patches"
exit 1
fi
git diff --cached --name-status | while read status file; do
if [[ "$file" =~ ^patches/ ]] || [[ "$file" =~ ^patch-tools/ ]]; then
warning "UPDATING AUTOGENERATED FILES"
./patch-tools/patchupdate.py || exit 1
break;
fi
done