1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| | #! /bin/sh
HOOKS="pre-commit post-checkout"
case `pwd` in
*/Util) cd ..;;
esac
if ! [ -d .git/hooks ]
then
echo "No directory for git hooks" >&2
exit 1
fi
if metastore -h 2>/dev/null 1>&2
then
echo "Installing in `pwd`/.git/hooks ..." >&2
cd .git/hooks
for hook in $HOOKS
do
if [ -e $hook ]
then
if cmp -s ../../Util/git-$hook $hook
then
echo "$hook is already installed" >&2
else
echo "Another $hook already exists" >&2
fi
else
ln -s ../../Util/git-$hook $hook
chmod +x $hook
fi
done
else
echo "Did not find metastore, skipping hooks" >&2
fi
exit 0
|