[X2Go-Commits] [maintenancescripts] 01/04: git/hooks/update-script._check_: make generic for denying and allowing merges via script name (symlink).

git-admin at x2go.org git-admin at x2go.org
Mon Feb 23 23:07:53 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository maintenancescripts.

commit 7c9a368bbcfbf826259b16225e351c083c6ba763
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Feb 23 22:58:55 2015 +0100

    git/hooks/update-script._check_: make generic for denying and allowing merges via script name (symlink).
---
 git/hooks/update-script._check_ |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/git/hooks/update-script._check_ b/git/hooks/update-script._check_
index 7da6fa7..da52255 100755
--- a/git/hooks/update-script._check_
+++ b/git/hooks/update-script._check_
@@ -2,6 +2,9 @@
 
 . hooks/common.sh
 
+MERGE="0"
+[ "$(basename "${0}")" = "update-script_check+allow-merges_" ] && MERGE="1"
+
 case "$1" in
   refs/tags/*)
     [ -f "$GIT_DIR/$1" ] && deny >/dev/null "You can't overwrite an existing tag"
@@ -18,8 +21,14 @@ case "$1" in
     else
       case "${BRANCH}" in
         release/*|build-*|master)
-          # updating -- make sure it contains no merge commits
-          [ -n "$(git rev-list --merges $2..$3)" ] && deny > /dev/null "ERROR: update contains a merge."
+          # updating -- check for merge commit and deny or warn
+          [ -n "$(git rev-list --merges $2..$3)" ] && {
+            if [ "${MERGE}" = "0" ]; then
+              deny > /dev/null "ERROR: update contains a merge."
+            else
+              echowarn "WARNING: update contains a merge. Allowing merges by special policies for this project."
+            fi
+          }
 
           # updating -- make sure it is a fast forward
           mb=$(git merge-base "$2" "$3")

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git


More information about the x2go-commits mailing list