Holger Freyther has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/63/11063/1

diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh
index c2ffbb4..f4198d0 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: newchange
Gerrit-Change-Id: I63f103b2f70559e969e8c66477ab9ee7f2886832
Gerrit-Change-Number: 11063
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <[email protected]>

Reply via email to