Properly retrieve and parse the app name from git remote

This commit is contained in:
Jose Diaz-Gonzalez
2015-01-14 04:25:46 -05:00
parent 3e05a8c8ac
commit aec4543b61

View File

@@ -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