Files
mckernel/scripts/git_hooks/install_git_hooks.sh
Dominique Martinet 141fa5120e git hooks: use correct directory for submodule
Change-Id: I7a39021dc02212065612b21cafcb6c653e2280f0
2018-07-26 03:29:43 +00:00

20 lines
367 B
Bash
Executable File

#!/bin/sh
set -eu
CURDIR=$(dirname "$(readlink -m "$0")")
GITDIR=$(git rev-parse --git-dir)
HOOKDIR=$GITDIR/hooks
if [[ ! -e "$HOOKDIR" ]]; then
echo "$HOOKDIR does not exist, install hook on main worktree?"
exit 1
fi
cp -vf "$CURDIR/pre-commit" "$HOOKDIR"
chmod +x "$HOOKDIR/pre-commit"
cp -vf "$CURDIR/commit-msg" "$HOOKDIR"
chmod +x "$HOOKDIR/commit-msg"