summaryrefslogtreecommitdiffstats
path: root/tools/git-hooks-install
blob: be885931dbda853808bb49c79f9a335056eee764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

# This script install user-side git commit hooks. You are supposed to run it
# only once for each repo (and very infrequently afterwards, once each time
# the git hooks change).

if test -d .git; then
  TOPDIR=.
else
  TOPDIR=..
fi

GITDIR=${TOPDIR}/.git

if test ! -d ${GITDIR}; then
   echo "ERROR: Could not find ${GITDIR} in ${TOPDIR}"
   exit -1
fi

echo "Installing hooks in ${GITDIR}/hooks"
mkdir -p ${GITDIR}/hooks
cp ${TOPDIR}/tools/git-hooks/prepare-commit-msg ${GITDIR}/hooks
chmod u+x ${GITDIR}/hooks/prepare-commit-msg