[sysadmin-bin] Allow non-fast-forward pushes to wip/* branches



commit 079f272e934a4943e4a4e67393c6d1e5322cd2c9
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Aug 17 14:32:56 2012 -0400

    Allow non-fast-forward pushes to wip/* branches
    
    A small convenience for people rebasing wip/* branches. Email will still
    be sent out again for all the commits on the branch.

 git/create-repository        |    2 ++
 git/pre-receive-check-policy |    7 ++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/git/create-repository b/git/create-repository
index 4ff9980..36fa239 100755
--- a/git/create-repository
+++ b/git/create-repository
@@ -39,6 +39,8 @@ fi
 
 export GIT_DIR=/git/$name.git
 git init --shared --bare
+# We enforce this in pre-receive-check-policy, except for wip/* branches
+git config receive.denyNonFastForwards false
 chgrp -R gnomecvs $GIT_DIR
 $BINDIR/gnomify-repos $GIT_DIR
 
diff --git a/git/pre-receive-check-policy b/git/pre-receive-check-policy
index cc5b90c..e17fdcb 100755
--- a/git/pre-receive-check-policy
+++ b/git/pre-receive-check-policy
@@ -112,6 +112,11 @@ check_ref_update() {
 	    # Branch update
 	    branchname=${refname#refs/heads/}
 
+	    is_wip=false
+	    case $branchname in
+		wip/*) is_wip=true ;;
+	    esac
+
 	    range=
 	    case $change_type in
 		create)
@@ -133,7 +138,7 @@ check_ref_update() {
 		    ;;
 		update)
 		    range="$oldrev..$newrev"
-		    if [ "`git merge-base $oldrev $newrev`" != $oldrev ] && ! forced ; then
+		    if [ "`git merge-base $oldrev $newrev`" != $oldrev ] && ! $is_wip && ! forced ; then
 		        # Non-fast-forward update. Right now we have
 		        # receive.denyNonFastforwards in the git configs for
 		        # our repositories anyways, but catching it here would



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]