[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Repo-Management] 7bf0817: Allow sysadmins to switch post-commit off
From: Ben Cooksley <bcooksley () kde ! org>
Date: 2010-10-30 7:43:34
Message-ID: 20101030074334.4C34CA609E () git ! kde ! org
[Download RAW message or body]
A bin/adc/hooks-enable [License: Trivialfile.]
A bin/adc/hooks-disable [License: Trivialfile.]
commit 7bf0817119e7954f76f7a229820d230e0800b0ad
Author: Ben Cooksley <bcooksley@kde.org>
Date: Sat Oct 30 20:38:16 2010 +1300
Allow sysadmins to switch post-commit off on demand
diff --git a/bin/adc/hooks-disable b/bin/adc/hooks-disable
new file mode 100644
index 0000000..f2fef50
--- /dev/null
+++ b/bin/adc/hooks-disable
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. $(dirname $0)/adc.common-functions
+
+get_rights_and_owner "gitolite-admin.git"
+
+if [ $perm_create == "no" ]; then
+ die "You have no permissions. Goodbye"
+fi
+
+if [ -f $repo.git/kde-hooks-off ]
+ echo "Hooks are already disabled!"
+else
+ touch $repo.git/kde-hooks-off
+ echo "Hooks are now disabled"
+fi
diff --git a/bin/adc/hooks-enable b/bin/adc/hooks-enable
new file mode 100644
index 0000000..f6e3103
--- /dev/null
+++ b/bin/adc/hooks-enable
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+. $(dirname $0)/adc.common-functions
+
+get_rights_and_owner $1
+if [ $perm_create == "no" ]; then
+ get_rights_and_owner "gitolite-admin.git"
+fi
+
+if [ $perm_create == "no" ]; then
+ die "You have no permissions. Goodbye"
+fi
+
+if [ -f $repo.git/kde-hooks-off ]
+ rm $repo.git/kde-hooks-off
+ echo "Hooks are now enabled"
+else
+ echo "Hooks are already enabled!"
+fi
diff --git a/hooks/update.secondary b/hooks/update.secondary
index 4f75551..b021956 100755
--- a/hooks/update.secondary
+++ b/hooks/update.secondary
@@ -82,12 +82,22 @@ if [ ! -f $auditdir/skip-audit ]; then
done
fi
-# Is this the first push?
-headlist=$(ls $GIT_DIR/refs/heads)
-if [ "$headlist" == "" ]; then
- echo "Skipping post-push hooks for the initial push to an empty repository."
- echo "(If this is not the initial push, please inform the sysadmin team.)"
- exit 0
+# Are post-commit hooks disabled?
+if [ -f $currpath/kde-hooks-off ]
+ . $mgmtdir/bin/adc/adc.common-functions
+ get_rights_and_owner $repopath
+ if [ $perm_create == "no" ]
+ echo "Repository access DENIED by Sysadmin Policy"
+ echo "Repository post commit hooks are currently disabled"
+ echo "Please contact sysadmin@kde.org for further assistance"
+ exit 1
+ else
+ echo "***** NOTICE *****"
+ echo "** Post commit hooks are DISABLED"
+ echo "** Push access is restricted to repository admins"
+ echo "***** NOTICE *****"
+ exit 0
+ fi
fi
url=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic