Files
mpp/hooks/install_hooks.sh
Lin Kesheng d5dceef2c4 [coding-style]: add git hook to format code
1. please run hooks/install_hooks.sh manually for the first time
2. hooks/pre-commit.hook is called before commit automatically
3. format code

Change-Id: I4565b206da10abb59506ef73f62392c9e9690cd4
Signed-off-by: Lin Kesheng <lks@rock-chips.com>
2017-02-24 17:30:53 +08:00

24 lines
378 B
Bash
Executable File

#!/bin/bash
# install git hooks
src_dir=../../hooks
dst_dir=../.git/hooks
if test ! \( -x $dst_dir/pre-commit -a -L $dst_dir/pre-commit \);
then
rm -f $dst_dir/pre-commit
if ! ln -s $src_dir/pre-commit.hook $dst_dir/pre-commit 2> /dev/null
then
echo "Failed to create commit hook symlink, copying instead ..."
cp pre-commit.hook ../.git/hooks/pre-commit
fi
fi