From b7ba1d6a7f34098aaea39cbb191eae09664b2164 Mon Sep 17 00:00:00 2001
From: pedro <git2021@cas.cat>
Date: Wed, 24 Jan 2024 15:04:32 +0100
Subject: [PATCH] pull-repos: git pull should go before

imagine the branch is new and does not exist
---
 pull-repos.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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