pull-repos: git pull should go before

imagine the branch is new and does not exist
This commit is contained in:
pedro 2024-01-24 15:04:32 +01:00
parent 5146a6f9be
commit b7ba1d6a7f

View file

@ -14,13 +14,13 @@ _pull() {
if [ -d "${mydir}" ]; then if [ -d "${mydir}" ]; then
cd "${mydir}" cd "${mydir}"
git pull
current_branch="$(git branch --show-current)" current_branch="$(git branch --show-current)"
# ensure we are in the right branch without invalidating docker build cache # ensure we are in the right branch without invalidating docker build cache
# yes, even without no branch switch and no new commits # yes, even without no branch switch and no new commits
if [ ! "${current_branch}" = "${expected_branch}" ]; then if [ ! "${current_branch}" = "${expected_branch}" ]; then
git checkout "${expected_branch}" git checkout "${expected_branch}"
fi fi
git pull
cd - cd -
else else
git clone -b "${expected_branch}" "${myurl}" "${mydir}" git clone -b "${expected_branch}" "${myurl}" "${mydir}"