From 8aa71981347b3d516d7c6fda0f5f452a9ea85ded Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 12 Nov 2009 22:46:57 -0500 Subject: [PATCH] Disallow pushing to submodule branches that are tracking branches for pockets. svn path=/trunk/scripts/git-hooks/; revision=2539 --- sub/update | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sub/update b/sub/update index 96347fe..fbdde3d 100755 --- a/sub/update +++ b/sub/update @@ -18,6 +18,25 @@ if [ -z "$ref" -o -z "$oldrev" -o -z "$newrev" ]; then exit 1 fi +# --- Disallow pushing to the branches for pockets + +pocket_to_git() { + local pocket git + pocket="$1" + git="$(invirt-getconf "git.pockets.$pocket.git" 2>/dev/null)" + if [ $? != 0 ]; then + git="$pocket" + fi + echo "$git" +} + +for pocket in $(invirt-getconf -l git.pockets); do + if [ "$ref" = "refs/heads/$(pocket_to_git "$pocket")" ]; then + echo "*** Pushing to a pocket branch in this repository is not allowed" >&2 + exit 1 + fi +done + # --- Disallow pushing tags case "$ref" in -- 1.7.9.5