From ecc3ec7a47e7034835b5e6766dff1ef0117888ac Mon Sep 17 00:00:00 2001 From: Fabian Castelli Date: Thu, 17 Jun 2021 18:56:55 +0200 Subject: [PATCH] Correctly checkout the desired version for git repositories --- candi.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/candi.sh b/candi.sh index 0f49fa6..fb26899 100755 --- a/candi.sh +++ b/candi.sh @@ -335,20 +335,22 @@ package_fetch () { quit_if_fail "candi: download_archive ${NAME}${PACKING} failed" elif [ ${PACKING} = "git" ]; then + # Go into the unpack dir cd ${UNPACK_PATH} - # Suitably clone or update git repositories + + # Clone the git repository if not existing locally if [ ! -d ${EXTRACTSTO} ]; then git clone ${SOURCE}${NAME} ${EXTRACTSTO} quit_if_fail "candi: git clone ${SOURCE}${NAME} ${EXTRACTSTO} failed" - else - cd ${EXTRACTSTO} - git checkout ${VERSION} --force - quit_if_fail "candi: git checkout ${VERSION} --force failed" - - git pull - quit_if_fail "candi: git pull failed" - cd .. fi + + # Checkout the desired version + cd ${EXTRACTSTO} + git checkout ${VERSION} --force + quit_if_fail "candi: git checkout ${VERSION} --force failed" + + # Switch to the tmp dir + cd .. elif [ ${PACKING} = "hg" ]; then cd ${UNPACK_PATH} # Suitably clone or update hg repositories -- 2.39.5