From 01ef680746388912c1d9499b42e598e63a1a574b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 3 Feb 2009 20:34:36 +0000 Subject: [PATCH] gst-autogen.sh: add install_git_hooks() subroutine --- gst-autogen.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gst-autogen.sh b/gst-autogen.sh index ae60f7e..9b0ddf2 100644 --- a/gst-autogen.sh +++ b/gst-autogen.sh @@ -292,3 +292,27 @@ tool_run () exit 1 } } + + +install_git_hooks () +{ + if test -d .git; then + # install pre-commit hook for doing clean commits + for hook in pre-commit; do + if test ! \( -x .git/hooks/$hook -a -L .git/hooks/$hook \); then + echo "+ Installing git $hook hook" + rm -f .git/hooks/$hook + ln -s ../../common/hooks/$hook.hook .git/hooks/$hook || { + # if we couldn't create a symbolic link, try doing a plain cp + if cp common/hooks/pre-commit.hook .git/hooks/pre-commit; then + chmod +x .git/hooks/pre-commit; + else + echo "********** Couldn't install git $hook hook **********"; + fi + } + fi + done + fi +} + + -- 2.7.4