blob: 4d333689f8a47f3cc17f8bca4d745c020724aca8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
if [ "$1" = '--install' ]; then
mkdir -p ".git/hooks"
if [ -e ".git/hooks/$HOOK" ] || [ -L ".git/hooks/$HOOK" ]; then
if [ "$(readlink .git/hooks/$HOOK)" != "scripts/hooks/$HOOK" ]; then
echo "Can't install $HOOK because it has custom content"
else
echo "$HOOK hook is already installed"
fi
exit 1
fi
echo "Installing $HOOK hook"
ln -s ../../scripts/hooks/$HOOK .git/hooks/$HOOK
exit 0
elif [ "$1" = '--uninstall' ]; then
if [ "$(readlink .git/hooks/$HOOK)" = "scripts/hooks/$HOOK" ]; then
echo "Removing $HOOK hook"
rm .git/hooks/$HOOK
exit 0
else
echo "$HOOK hook is not installed"
exit 1
fi
fi
|