From 07de62088db1c01d3a2f691f16c1243f7238187c Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 27 Sep 2015 16:28:26 +0200 Subject: [PATCH] precommit-hook.sh: Do not allow committing when patches/ or debian/ folder has unstaged changes. --- precommit-hook.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/precommit-hook.sh b/precommit-hook.sh index 72c07867..4d52940c 100755 --- a/precommit-hook.sh +++ b/precommit-hook.sh @@ -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 ""