diff options
author | MaZderMind | 2016-12-29 13:51:53 +0100 |
---|---|---|
committer | MaZderMind | 2016-12-29 13:51:53 +0100 |
commit | ecc7cada8cbb4c9481dc84934175d78753ce5fa9 (patch) | |
tree | c3b62873820773f9250792b447cf8b36a6556ad1 /deploy.sh | |
parent | b9d6a4c027d1459de24f08837ff2c1698fb9d151 (diff) |
reorder deployment checks
Diffstat (limited to '')
-rwxr-xr-x | deploy.sh | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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 |