summaryrefslogtreecommitdiff
path: root/infra/command/install-githooks
diff options
context:
space:
mode:
Diffstat (limited to 'infra/command/install-githooks')
-rw-r--r--infra/command/install-githooks15
1 files changed, 15 insertions, 0 deletions
diff --git a/infra/command/install-githooks b/infra/command/install-githooks
new file mode 100644
index 000000000..e624aa6d7
--- /dev/null
+++ b/infra/command/install-githooks
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+REPO_HOOKS_PATH=$NNAS_PROJECT_PATH/infra/git-hooks
+GIT_HOOKS_PATH=$NNAS_PROJECT_PATH/.git/hooks
+
+# Create symbolic links to hooks dir
+if [ -e $GIT_HOOKS_PATH/pre-push ]; then
+ echo "Backup old $GIT_HOOKS_PATH/pre-push to $GIT_HOOKS_PATH/pre-push~"
+ mv -v $GIT_HOOKS_PATH/pre-push $GIT_HOOKS_PATH/pre-push~
+elif [ -h $GIT_HOOKS_PATH/pre-push ]; then
+ ls -l $GIT_HOOKS_PATH/pre-push
+ echo "Remove broken symlink $GIT_HOOKS_PATH/pre-push"
+ rm -v $GIT_HOOKS_PATH/pre-push
+fi
+ln -sv $REPO_HOOKS_PATH/pre-push.sh $GIT_HOOKS_PATH/pre-push