From 6901e9658f2c8d726dc34bc8da6b165004a3b9ed Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 18 Apr 2020 18:21:54 -0400 Subject: [PATCH] feat: expose last-updated-at in git:report --- plugins/git/internal-functions | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 6002d82eb..b41010739 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -42,6 +42,7 @@ cmd-git-report-single() { "--git-keep-git-dir: $(fn-plugin-property-get "git" "$APP" "keep-git-dir" "false")" "--git-rev-env-var: $(fn-plugin-property-get "git" "$APP" "rev-env-var" "GIT_REV")" "--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2>/dev/null || false)" + "--git-last-updated-at: $(fn-git-last-updated-at "$APP")" ) if [[ -z "$INFO_FLAG" ]]; then @@ -70,6 +71,17 @@ cmd-git-report-single() { fi } +fn-git-last-updated-at() { + declare desc="retrieve the deploy branch for a given application" + declare APP="$1" + local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")" + local HEAD_FILE="/home/dokku/test/refs/heads/$DOKKU_DEPLOY_BRANCH" + + if [[ -f "$HEAD_FILE" ]]; then + stat -c %Y "$HEAD_FILE" + fi +} + fn-git-deploy-branch() { declare desc="retrieve the deploy branch for a given application" local APP="$1"