only push the remote branches to the local branch. this should fix the zombie branche...
authorBaris Metin <bmetin@verivue.com>
Wed, 15 Jun 2011 18:58:12 +0000 (14:58 -0400)
committerBaris Metin <bmetin@verivue.com>
Wed, 15 Jun 2011 18:58:12 +0000 (14:58 -0400)
scripts/git-mirror.sh

index ff07de2..6be3b00 100755 (executable)
@@ -77,16 +77,17 @@ function merge_all_branches () {
 
 function push_all_branches () {
     NAME=$1
-    REMOTE=$2
-    REPO_DIR=$3
+    PUSH_TO=$2
+    PUSH_FROM=$3
+    REPO_DIR=$4
 
     pushd $REPO_DIR > /dev/null
-    BRANCHES=$(git branch -r | grep $REMOTE | grep -v HEAD | sed "s/.*\///g" | grep -v master)
+    BRANCHES=$(git branch -r | grep $PUSH_FROM | grep -v HEAD | sed "s/.*\///g" | grep -v master)
     popd > /dev/null
 
-    run "git push $REMOTE master:master" ${REPO_DIR}
+    run "git push $PUSH_TO master:master" ${REPO_DIR}
     for BRANCH in $BRANCHES ; do
-        run "git push $REMOTE $BRANCH:$BRANCH" ${REPO_DIR}
+        run "git push $PUSH_TO $BRANCH:$BRANCH" ${REPO_DIR}
     done
 }
 
@@ -130,7 +131,7 @@ function mirror () {
                 error "git-mirror.sh failed on ${MIRROR_REPO}" "STATUS:\n$STATUS_OUT \n\n------------\n FAILED COMMANDS:\n$FAILED_CMDS" $REPO_DIR
             else
                 run "git push --tags local_master" ${REPO_DIR}
-                push_all_branches $NAME local_master $REPO_DIR
+                push_all_branches $NAME local_master origin $REPO_DIR
 
                 # success, remove previous check file if any
                 CHECK_FILE=$REPO_DIR/$NOTIFIED_FILE