Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11063 )

Change subject: Optimize and re-use an existing repository
......................................................................

Optimize and re-use an existing repository

Instead of cloning osmocom-bb three times this will allow us to
re-use the repository. Simply change the directory, set the new
origin and fetch.

Change-Id: I63f103b2f70559e969e8c66477ab9ee7f2886832
---
M contrib/jenkins-build-common.sh
1 file changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved; Verified
  Jenkins Builder: Verified



diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh
index bfe8d73..ceee5c0 100644
--- a/contrib/jenkins-build-common.sh
+++ b/contrib/jenkins-build-common.sh
@@ -75,10 +75,14 @@
   fi

   cd "$base"
-  rm -rf "$repo"
-  git clone "$git_url/$repo" "$repo"
+  if [ -d "$repo" ]; then
+    cd "$repo"
+    git fetch
+  else
+    git clone "$git_url/$repo" "$repo"
+    cd "$repo"
+  fi

-  cd "$repo"

   # Figure out whether we need to prepend origin/ to find branches in upstream.
   # Doing this allows using git hashes instead of a branch name.
@@ -86,7 +90,7 @@
     branch="origin/$branch"
   fi

-  git checkout -b build_branch "$branch"
+  git checkout -B build_branch "$branch"
   rm -rf *
   git reset --hard "$branch"


--
To view, visit https://gerrit.osmocom.org/11063
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I63f103b2f70559e969e8c66477ab9ee7f2886832
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 2
Gerrit-Owner: Holger Freyther <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>

Reply via email to