summaryrefslogtreecommitdiffstats
path: root/tools/envsetup/setupgithooks
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2017-10-13 15:49:25 -0500
committerRichard J. Knight <rjknight@us.ibm.com>2017-10-17 15:05:22 -0500
commit41e7df45e64f623499b8d286a4012e6e7d24eaf6 (patch)
treee7a54e4950d2610c3fddeaf2b74b53b424315bf1 /tools/envsetup/setupgithooks
downloadtalos-hcode-41e7df45e64f623499b8d286a4012e6e7d24eaf6.tar.gz
talos-hcode-41e7df45e64f623499b8d286a4012e6e7d24eaf6.zip
Initial hcode commit
Change-Id: I2c6c9b05c6afbd7732f472ea9cf049d00c5cad45
Diffstat (limited to 'tools/envsetup/setupgithooks')
-rwxr-xr-xtools/envsetup/setupgithooks64
1 files changed, 64 insertions, 0 deletions
diff --git a/tools/envsetup/setupgithooks b/tools/envsetup/setupgithooks
new file mode 100755
index 00000000..12444caf
--- /dev/null
+++ b/tools/envsetup/setupgithooks
@@ -0,0 +1,64 @@
+#!/bin/bash
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: tools/envsetup/setupgithooks $
+#
+# OpenPOWER HCODE Project
+#
+# COPYRIGHT 2015,2017
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+
+# Each developer runs this from the git_repo base dir, where it will copy the
+# needed scripts into .git/hooks/ directory and make them executable.
+
+if [ -d $HOOKSDIR ]
+then
+
+ # Get hooks from Gerrit, if needed.
+ if [ ! -f $HOOKSDIR/commit-msg ]
+ then
+ echo "Copying Gerrit hooks..."
+ scp -p -q $GERRIT_SRV:hooks/commit-msg $HOOKSDIR || exit -1
+ fi
+
+ # Copy custom pre/post commit hooks from tools directory.
+ if [ -f "$EKBHOOKSDIR/pre-commit" -a \
+ -f "$EKBHOOKSDIR/post-commit" ]
+ then
+ echo "Copying pre/post commit hooks..."
+
+ cp $EKBHOOKSDIR/pre-commit $HOOKSDIR/ || exit -1
+ cp $EKBHOOKSDIR/pre-commit $HOOKSDIR/pre-applypatch || exit -1
+ cp $EKBHOOKSDIR/post-commit $HOOKSDIR/ || exit -1
+
+ chmod u+x $HOOKSDIR/pre-commit || exit -1
+ chmod u+x $HOOKSDIR/pre-applypatch || exit -1
+ chmod u+x $HOOKSDIR/post-commit || exit -1
+
+ else
+ echo "Cannot find or access pre or post commit scripts"
+ exit 0
+ fi
+
+else
+ echo "Cannot find or access .git/hooks directory"
+ exit 0
+fi
+
+exit 0
OpenPOWER on IntegriCloud