From aec4543b616435bd822ce403b397479e3c17719a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 14 Jan 2015 04:25:46 -0500 Subject: [PATCH] Properly retrieve and parse the app name from git remote --- contrib/dokku_client.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 56650e78c..1a268aa96 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -3,8 +3,17 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x if [[ ! -z $DOKKU_HOST ]]; then function dokku { - appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) - if [[ "$?" != "0" ]]; then + appname="" + if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then + set +e + appname=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) + set -e + else + echo "This is not a git repository" + exit 1 + fi + + if [[ "$appname" != "" ]]; then donotshift="YES" fi