From cca507da6a9046bba98027a2e05501870b8384b3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 17 Jan 2021 19:40:33 -0500 Subject: [PATCH] refactor: avoid pushd/popd to enable commands to pass from root-enabled directories --- plugins/git/internal-functions | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index f19649061..95af4eeca 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -221,16 +221,14 @@ fn-git-fetch() { return fi - pushd "$DOKKU_ROOT/$APP" > /dev/null - git remote rm remote > /dev/null 2>&1 || true - git remote add --mirror=fetch --no-tags remote "$GIT_REMOTE" + git -C "$APP_ROOT" remote rm remote > /dev/null 2>&1 || true + git -C "$APP_ROOT" remote add --mirror=fetch --no-tags remote "$GIT_REMOTE" if [[ -z "$GIT_REF" ]]; then - git fetch --update-head-ok remote "$DOKKU_DEPLOY_BRANCH" + git -C "$APP_ROOT" fetch --update-head-ok remote "$DOKKU_DEPLOY_BRANCH" else - git fetch --update-head-ok remote - git update-ref "refs/heads/$DOKKU_DEPLOY_BRANCH" "$GIT_REF" + git -C "$APP_ROOT" fetch --update-head-ok remote + git -C "$APP_ROOT" update-ref "refs/heads/$DOKKU_DEPLOY_BRANCH" "$GIT_REF" fi - popd > /dev/null } fn-git-last-updated-at() {