From 6b90dc70b18e186b8679d12c9df7ecd1a083ba12 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 25 Feb 2021 02:01:01 -0500 Subject: [PATCH] fix: properly handle directory change when cleaning .git directory Closes #4434 --- plugins/git/internal-functions | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 8c781c8ae..e0c567e49 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -322,7 +322,9 @@ fn-git-setup-build-dir-submodules() { suppress_output env -u GIT_QUARANTINE_PATH git -C "$GIT_WORKDIR" submodule update --init --recursive if [[ "$DOKKU_KEEP_GIT_DIR" != "true" ]]; then + pushd "$GIT_WORKDIR" >/dev/null find "$GIT_WORKDIR" -name .git -prune -exec rm -rf {} \; >/dev/null + popd >/dev/null 2>&1 || pushd "/tmp" >/dev/null fi }