#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"

repo_gc() {
  declare desc="runs 'git gc --agressive' against the application's repo"
  local cmd="repo:gc"
  [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
  local APP="$2"; local APP_DIR="$DOKKU_ROOT/$APP"
  verify_app_name "$APP"

  GIT_DIR="$APP_DIR" git gc --aggressive
}

repo_gc "$@"
