summaryrefslogtreecommitdiffstats
path: root/local/triggers/push
diff options
context:
space:
mode:
Diffstat (limited to 'local/triggers/push')
-rwxr-xr-xlocal/triggers/push16
1 files changed, 16 insertions, 0 deletions
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