From 76275d62735d785e779a0729da23de03839fee22 Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Wed, 30 Oct 2024 16:27:57 -0700 Subject: [PATCH] release: properly change working dir if tmp location already exists Currently, the script won't change directories into the previously cloned repository if the temporary location exists. This may be an issue when testing first with a dry run and later with the actual release. Signed-off-by: Ivan Valdes --- scripts/release.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 993ccff8f8e..efc7bfb1b5d 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -86,10 +86,12 @@ main() { # Set up release directory. local reldir="/tmp/etcd-release-${VERSION}" log_callout "Preparing temporary directory: ${reldir}" - if [ ! -d "${reldir}/etcd" ] && [ "${IN_PLACE}" == 0 ]; then - mkdir -p "${reldir}" - cd "${reldir}" - run git clone "${REPOSITORY}" --branch "${BRANCH}" --depth 1 + if [ "${IN_PLACE}" == 0 ]; then + if [ ! -d "${reldir}/etcd" ]; then + mkdir -p "${reldir}" + cd "${reldir}" + run git clone "${REPOSITORY}" --branch "${BRANCH}" --depth 1 + fi run cd "${reldir}/etcd" || exit 2 run git checkout "${BRANCH}" || exit 2 run git pull origin