wine-staging/precommit-hook.sh

33 lines
837 B
Bash
Raw Normal View History

#!/bin/bash
# Installation: ln -s ../../precommit-hook.sh .git/hooks/pre-commit
warning()
{
echo ""
echo "*** $1 ***"
echo ""
}
2015-11-22 17:43:28 -08:00
if git status --porcelain "staging" | grep "^.[^ ]" &> /dev/null; then
warning "PLEASE ADD OR STASH YOUR CHANGES IN staging"
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
if ! git status --porcelain "staging/VERSION" | grep "^M." &> /dev/null; then
perl -i -pe 's/(\d+)$/($1 + 1)." (unreleased)"/e' "staging/VERSION"
git add "staging/VERSION"
fi
git diff --cached --name-status | while read status file; do
2015-11-22 17:43:28 -08:00
if [[ "$file" =~ ^patches/ ]] || [[ "$file" =~ ^staging/ ]]; then
warning "UPDATING AUTOGENERATED FILES"
2015-11-22 17:43:28 -08:00
./staging/patchupdate.py || exit 1
break;
fi
done