mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
Add pre-commit and post-commit hooks for use on dev systems.
As well as a little script to automatically configure them. (imported from commit c2e7f990f5f2091b5bebdd1b3dad402457943c95)
This commit is contained in:
9
tools/post-commit
Executable file
9
tools/post-commit
Executable file
@@ -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
|
||||
1
tools/pre-commit
Executable file
1
tools/pre-commit
Executable file
@@ -0,0 +1 @@
|
||||
./tools/check-all || true
|
||||
11
tools/setup-git-repo
Executable file
11
tools/setup-git-repo
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user