Fix synchronization

This commit is contained in:
Victor Shcherb 2011-12-26 20:25:21 +01:00
parent bb3d14cd8a
commit c22c32f9bb

View file

@ -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
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"