diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index f78eaa889..8ee375a93 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -246,16 +246,12 @@ cmd-git-unlock() { if [[ -d "$APP_CLONE_ROOT" ]]; then if [[ "$FLAG" == "--force" ]]; then - dokku_log_info1 "About to delete $APP_CLONE_ROOT" - rm -rf "$APP_CLONE_ROOT" - dokku_log_info1 "Successfully unlocked $APP" + fn-git-remove-clone-folder "$APP_CLONE_ROOT" else read -rp "Are you sure that want to delete clone folder (y/n)?" choice case "$choice" in y | Y) - dokku_log_info1 "About to delete $APP_CLONE_ROOT" - rm -rf "$APP_CLONE_ROOT" - dokku_log_info1 "Successfully unlocked $APP" + fn-git-remove-clone-folder "$APP_CLONE_ROOT" ;; n | N) echo "no" ;; *) echo "please answer with yes or no" ;; @@ -351,6 +347,13 @@ fn-git-auth-error() { dokku_log_fail "As an alternative, configure the netrc authentication via the git:auth command" } +fn-git-remove-clone-folder() { + declare APP_CLONE_ROOT="$1" + dokku_log_info1 "About to delete $APP_CLONE_ROOT" + rm -rf "$APP_CLONE_ROOT" + dokku_log_info1 "Successfully deleted $APP_CLONE_ROOT" +} + fn-git-create-hook() { declare APP="$1" local APP_PATH="$DOKKU_ROOT/$APP"