precommit-hook.sh: Do not allow committing when patches/ or debian/ folder has unstaged changes.

This commit is contained in:
Sebastian Lackner 2015-09-27 16:28:26 +02:00
parent f7950d74e6
commit 07de62088d

View File

@ -1,6 +1,15 @@
#!/bin/bash
# Installation: ln -s ../../precommit-hook.sh .git/hooks/pre-commit
for directory in patches debian; do
if [ ! -z "$(git status --porcelain "$directory")" ]; then
echo ""
echo "*** PLEASE ADD OR STASH YOUR CHANGES IN $directory ***"
echo ""
exit 1
fi
done
git diff --cached --name-status | while read status file; do
if [[ "$file" =~ ^patches/ ]] || [[ "$file" =~ ^debian/tools/ ]] || [[ "$file" =~ ^debian/changelog ]]; then
echo ""