Change in osmo-gsm-tester[master]: Optimize and re-use an existing repository

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Sep 26 07:27:39 UTC 2018


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 <holger at freyther.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180926/b0b0ccd4/attachment.htm>


More information about the gerrit-log mailing list