summaryrefslogtreecommitdiffstats
path: root/roles/git/hooks/files/update-block-push-origin
diff options
context:
space:
mode:
authorMathieu Bridon <bochecha@fedoraproject.org>2014-09-18 16:54:39 +0200
committerPierre-Yves Chibon <pingou@pingoured.fr>2014-10-27 10:48:12 +0100
commit7ab3ff28179a07037fef4207b7b5446c45a8479c (patch)
treec814662f24fc4248f69d59f9fbb608fc5a298925 /roles/git/hooks/files/update-block-push-origin
parent57e3254f1aea3638f9ceb9dd5f25ca58fa3843dd (diff)
downloadansible-7ab3ff28179a07037fef4207b7b5446c45a8479c.tar.gz
ansible-7ab3ff28179a07037fef4207b7b5446c45a8479c.tar.xz
ansible-7ab3ff28179a07037fef4207b7b5446c45a8479c.zip
distgit: Block push of branches named 'origin/*'
We already use the update hook for gitolite. This introduces a new update hook, which merely chains the gitolite one, and a new one to block pushes to badly named branches. The new hook was written originally by Till Maas. https://fedorahosted.org/rel-eng/ticket/4071
Diffstat (limited to 'roles/git/hooks/files/update-block-push-origin')
-rw-r--r--roles/git/hooks/files/update-block-push-origin10
1 files changed, 10 insertions, 0 deletions
diff --git a/roles/git/hooks/files/update-block-push-origin b/roles/git/hooks/files/update-block-push-origin
new file mode 100644
index 000000000..17380e313
--- /dev/null
+++ b/roles/git/hooks/files/update-block-push-origin
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Block pushes to branches if their name starts with `origin/`
+# https://fedorahosted.org/rel-eng/ticket/4071
+
+refname="${1}"
+sha1_old="${2}"
+sha1_new="${3}"
+
+echo "${refname}" | grep -qE '^refs/heads/origin/' && exit 1 || exit 0