From c22c32f9bb1102b54c5eb43c8d2555ddfbd71463 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 26 Dec 2011 20:25:21 +0100 Subject: [PATCH] Fix synchronization --- build-scripts/sync_git_google.sh | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/build-scripts/sync_git_google.sh b/build-scripts/sync_git_google.sh index a4b2900c0f..a4b33cd35b 100755 --- a/build-scripts/sync_git_google.sh +++ b/build-scripts/sync_git_google.sh @@ -1,23 +1,25 @@ #!/bin/sh -DIRECTORY=$(cd `dirname $0` && pwd) - -GIT_DIR="$DIRECTORY"/osmand-git -GIT_URL=git://github.com/osmandapp/Osmand.git - - -if [ ! -d "$GIT_DIR" ]; then - git clone ${GIT_URL} "${GIT_DIR}" -fi -cd "$GIT_DIR" -git checkout -q . -git reset HEAD --hard -git checkout -q master # First time add entries to .git/config (!) and add .netrc file # [remote "google"] # url = https://code.google.com/p/osmand/ -# fetch = +refs/heads/*:refs/remotes/google/* -git push -q --all --force google +# fetch = +refs/heads/*:refs/remotes/google/* +git pull google + +# Delete old branches +for f in `git for-each-ref --format='%(refname)' | grep 'refs/remotes/google'` +do + Branch=`echo $f | cut -d '/' -f 4` + if [[ -z `git show-ref refs/remotes/origin/$Branch` ]]; then + git push origin :$Branch + fi +done + +# Delete old branches +for f in `git for-each-ref --format='%(refname)' | grep 'refs/remotes/origin'` +do + Branch=`echo $f | cut -d '/' -f 4` + git push google origin/$Branch:refs/heads/$Branch +done echo "Synchronization is ok" -