aboutsummaryrefslogtreecommitdiff
path: root/create-git-hooks.sh
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2014-01-25 17:37:07 +0200
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2014-01-25 17:37:07 +0200
commit777178a2e18aec08f420e879f8c86fd961bbc045 (patch)
treeb6f644470c7c1536e63561521b993f1dedf5113a /create-git-hooks.sh
parentfa007950ceda8ec6d7bfbfe91d099043f9e07c49 (diff)
Capture /srv/gerrit/linaro/git/scripts/create-git-hooks.sh from android.git.l.o
Change-Id: I8cc1843f1dd52a9753491530f596ae6740e2c9d7
Diffstat (limited to 'create-git-hooks.sh')
-rwxr-xr-xcreate-git-hooks.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/create-git-hooks.sh b/create-git-hooks.sh
new file mode 100755
index 0000000..0bdf8cf
--- /dev/null
+++ b/create-git-hooks.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#
+# m
+# mmmm m m mmmm mmmm mmm mm#mm
+# #" "# # # #" "# #" "# #" # #
+# # # # # # # # # #"""" #
+# ##m#" "mm"# ##m#" ##m#" "#mm" "mm
+# # # #
+# " " "
+# This file is managed by puppet. Do not make local changes.
+
+
+#
+# create-git-hooks.sh
+# Author: Chris Jones <cmsj@canonical.com>
+# Copyright 2011 Canonical Ltd. All Rights Reserved.
+
+OWNER="gerrit"
+GROUP="gerrit"
+GITPATH="/srv/gerrit/linaro/git/"
+HOOK="exec git update-server-info"
+NOUPDATE="# NO AUTOMATIC MODIFICATIONS"
+
+for path in $(find -L $GITPATH -type d -name hooks) ; do
+ HOOKFILE="${path}/post-update"
+ if [ ! -f $HOOKFILE ]; then
+ # hook file is not correct, make it correct
+ cat <<EOF >$HOOKFILE
+#!/bin/sh
+# see /srv/git.linaro.org/scripts/create-git-hooks.sh
+
+#-pfalcon 2013-11-14
+date >>/tmp/git-post-update.log
+echo "Running git post-update hook for $GIT_DIR" >>/tmp/git-post-update.log
+
+exec git update-server-info
+EOF
+ OWNERGROUP="$OWNER:$GROUP"
+ git --git-dir=${path}/../ --work-tree=${path}/../../ update-server-info
+ chown $OWNERGROUP $HOOKFILE
+ chmod +x $HOOKFILE
+
+ if [ -e "${path}/../info/refs" ];then
+ chown $OWNERGROUP ${path}/../info/refs
+ fi
+ if [ -e "${path}/../info/objects/packs" ];then
+ chown $OWNERGROUP ${path}/../objects/packs
+ fi
+ fi
+done