Permalink
Browse files

check if the branch has a remote

Signed-off-by: Simon Thum <simon.thum@gmx.de>
  • Loading branch information...
1 parent cbe1d85 commit 8c959abace008cef851705403b7ce37a0218ec10 @simonthum committed Aug 20, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 git-sync
View
@@ -188,7 +188,15 @@ if [ -z "$branch_name" ] ; then
exit 2
fi
-# check if current branch is configured
+# while at it, determine the remote to operate on
+remote_name=$(git config --get branch.$branch_name.remote)
+
+if [ -z "$remote_name" ] ; then
+ echo "git-sync: the current branch does not have a configured remote."
+ exit 2
+fi
+
+# check if current branch is configured for sync
if [ "true" != "$(git config --get --bool branch.$branch_name.sync)" ] ; then
echo
echo "git-sync: Please use"
@@ -205,8 +213,6 @@ if [ "true" != "$(git config --get --bool branch.$branch_name.sync)" ] ; then
exit 1
fi
-# while at it, determine the remote to operate on
-remote_name=$(git config --get branch.$branch_name.remote)
echo "git-sync: Using $remote_name/$branch_name"

0 comments on commit 8c959ab

Please sign in to comment.