#!/bin/sh
current=`git branch -a | grep "^[*] " | cut -f2 -d\   `
remotes=`git remote -v | cut -f1 | uniq`

set -e

case "$current" in
topic-*)
	echo "*** cannot publish topic branch"
	exit 1
	;;
v*.*.*)
	echo "*** cannot publish version tag"
	exit 1
esac

for remote in $remotes ; do
	case "$remote-$current" in
	mirror-*|forked-*)
		;;
	*)
		git push $remote $current
		git push $remote $current --tags
		;;
	esac
done
