From ecc7cada8cbb4c9481dc84934175d78753ce5fa9 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Thu, 29 Dec 2016 13:51:53 +0100 Subject: reorder deployment checks --- deploy.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'deploy.sh') diff --git a/deploy.sh b/deploy.sh index e8a1588..fc20c6d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -13,9 +13,10 @@ fi echo "" DEPLOY_BRANCH=`git rev-parse --abbrev-ref HEAD` -if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then - echo "You're currently on branch $DEPLOY_BRANCH." - echo "Are you sure you want to deoloy that branch (and not master)? then type yes" + +if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then + echo "You have commits on the $DEPLOY_BRANCH branch not pushed to origin yet. They would not be deployed." + echo "do you still which to deploy what's already in the repo? then type yes" read -p "" input if [ "x$input" != "xyes" ]; then exit 2 @@ -23,8 +24,8 @@ if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then echo "" fi -if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then - echo "You have commits on the $DEPLOY_BRANCH branch not pushed to origin yet. They would not be deployed." +if ! (git diff --exit-code >/dev/null && git diff --cached --exit-code >/dev/null); then + echo "You have uncomitted changes. They would not be deployed." echo "do you still which to deploy what's already in the repo? then type yes" read -p "" input if [ "x$input" != "xyes" ]; then @@ -33,9 +34,9 @@ if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $ echo "" fi -if ! (git diff --exit-code >/dev/null && git diff --cached --exit-code >/dev/null); then - echo "You have uncomitted changes. They would not be deployed." - echo "do you still which to deploy what's already in the repo? then type yes" +if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then + echo "You're currently on branch $DEPLOY_BRANCH." + echo "Are you sure you want to deoloy that branch (and not master)? then type yes" read -p "" input if [ "x$input" != "xyes" ]; then exit 2 -- cgit v1.2.3