diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-01-30 17:58:13 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-01-30 17:58:13 -0600 |
commit | 3a6cc6b6b3a2dcb9ce4326bf26c753e6f8f03e78 (patch) | |
tree | 401570aeb5391ff71c5b1fc700206c27e66d0662 /setup-git-hook | |
parent | a02b959648a8e8c7f9f5d7ff497a9934b57d2ae3 (diff) |
set git hooks automatically
Diffstat (limited to 'setup-git-hook')
-rwxr-xr-x | setup-git-hook | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/setup-git-hook b/setup-git-hook new file mode 100755 index 0000000..b731598 --- /dev/null +++ b/setup-git-hook @@ -0,0 +1,18 @@ +#!/bin/sh + +set_git_hooks() +{ + # assume that the current directory is the source tree + if [ -d ".git" ] ; then + for hook in $(ls -1 .git-hooks) ; do + cd .git/hooks + if [ ! -e "${hook?}" -o -L "${hook?}" ] ; then + rm -f "${hook?}" + ln -sf "../../.git-hooks/${hook?}" "${hook?}" + fi + cd - > /dev/null + done + fi +} + +set_git_hooks |