summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/.gitolite.rc6
-rwxr-xr-xlocal/triggers/push16
2 files changed, 21 insertions, 1 deletions
diff --git a/conf/.gitolite.rc b/conf/.gitolite.rc
index c40ac25..25a5231 100644
--- a/conf/.gitolite.rc
+++ b/conf/.gitolite.rc
@@ -79,12 +79,16 @@
# or you can use this, which lets you put everything in a subdirectory
# called "local" in your gitolite-admin repo. For a SECURITY WARNING
# on this, see http://gitolite.com/gitolite/non-core.html#pushcode
- # LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local",
+ LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local",
# ------------------------------------------------------------------
# List of commands and features to enable
+ POST_GIT => [
+ 'push',
+ ],
+
ENABLE => [
# COMMANDS
diff --git a/local/triggers/push b/local/triggers/push
new file mode 100755
index 0000000..6aa587a
--- /dev/null
+++ b/local/triggers/push
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+[ "$4" = "W" ] || exit 0
+
+cd "$GL_REPO_BASE/$2.git"
+head=$(git symbolic-ref HEAD)
+
+if ! [ -f "$head" ]; then
+ set -- refs/heads/*
+ if [ "$#" -eq 1 ]; then
+ git symbolic-ref HEAD "$1"
+ echo "NOTICE: Default branch set to $1" >&2
+ else
+ echo "WARNING: The default branch is $head, but no such branch exists" >&2
+ fi
+fi