diff --git a/tools/post-commit b/tools/post-commit new file mode 100755 index 0000000000..57b7bcbfc3 --- /dev/null +++ b/tools/post-commit @@ -0,0 +1,9 @@ +#!/bin/bash +AUTHOR=$(git log -1 HEAD | grep ^Author | sed 's/Author: //') +if ! $(echo "$AUTHOR" | grep humbughq.com >/dev/null); then + echo -e "\e[0;91m Invalid non-Humbug commit author: $AUTHOR\e[0m" +fi +COMMITTER=$(git log -1 HEAD --pretty=fuller | grep ^Commit: | sed 's/Author: //') +if ! $(echo "$COMMITTER" | grep humbughq.com >/dev/null); then + echo -e "\e[0;91m Invalid non-Humbug committer: $COMMITTER\e[0m" +fi diff --git a/tools/pre-commit b/tools/pre-commit new file mode 100755 index 0000000000..85b7b1001e --- /dev/null +++ b/tools/pre-commit @@ -0,0 +1 @@ +./tools/check-all || true diff --git a/tools/setup-git-repo b/tools/setup-git-repo new file mode 100755 index 0000000000..3f563e77e8 --- /dev/null +++ b/tools/setup-git-repo @@ -0,0 +1,11 @@ +#!/bin/bash + +if ! [ -d ".git/hooks/" ]; then + echo "Error: Could not find .git/hooks directory" + echo "Please re-run this script from the root of your Humbug git checkout" + exit 1 +fi + +for hook in pre-commit post-commit; do + ln -snf ../../tools/"$hook" .git/hooks/ +done