#!/bin/sh

if [ ! -e debian/control ] ; then
  echo "debian/control is missing."
  exit 1
fi

if [ ! -d .git ] ; then
  echo "This is not Git repository."
  exit 1
fi

VCSGIT=$(grep '^Vcs-Git' debian/control | sed 's/^Vcs-Git: *//')

if [ "${VCSGIT}" = "" ] ; then
  echo "d/control does not contain Vcs-Git field"
  exit 1
fi

set -x
git remote add origin ${VCSGIT}
git push --all
