gst-autogen.sh: add install_git_hooks() subroutine
[platform/upstream/gst-common.git] / gst-autogen.sh
index ae60f7e..9b0ddf2 100644 (file)
@@ -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
+}
+
+