fix: do not allow fetch on fresh apps

This commit is contained in:
Jose Diaz-Gonzalez committed 2021-01-17 17:00:33 -05:00
1 parent 97750f8b28
commit f73c927512
1 file changed
+5
+5
View File
@@ -238,6 +238,11 @@ fn-git-clone() {
fn-git-fetch() { fn-git-fetch() {
declare APP="$1" GIT_REMOTE="$2" GIT_REF="$3" declare APP="$1" GIT_REMOTE="$2" GIT_REF="$3"
local DOKKU_DEPLOY_BRANCH local DOKKU_DEPLOY_BRANCH
local APP_ROOT="$DOKKU_ROOT/$APP"
if [[ "$(git -C "$APP_ROOT" count-objects)" == "0 objects, 0 kilobytes" ]]; then
dokku_log_fail "The fetch subcommand can only be executed for existing applications"
fi
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")" DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then