diff options
Diffstat (limited to 'install_git_hooks')
-rwxr-xr-x | install_git_hooks | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/install_git_hooks b/install_git_hooks new file mode 100755 index 0000000..b731598 --- /dev/null +++ b/install_git_hooks @@ -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 |