summaryrefslogtreecommitdiff
path: root/setup-git-hook
blob: b73159839771a978575750bcef422200672a8093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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