<p>Holger Freyther has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11063">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Optimize and re-use an existing repository<br><br>Instead of cloning osmocom-bb three times this will allow us to<br>re-use the repository. Simply change the directory, set the new<br>origin and fetch.<br><br>Change-Id: I63f103b2f70559e969e8c66477ab9ee7f2886832<br>---<br>M contrib/jenkins-build-common.sh<br>1 file changed, 8 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/63/11063/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh</span><br><span>index c2ffbb4..f4198d0 100644</span><br><span>--- a/contrib/jenkins-build-common.sh</span><br><span>+++ b/contrib/jenkins-build-common.sh</span><br><span>@@ -75,10 +75,14 @@</span><br><span>   fi</span><br><span> </span><br><span>   cd "$base"</span><br><span style="color: hsl(0, 100%, 40%);">-  rm -rf "$repo"</span><br><span style="color: hsl(0, 100%, 40%);">-  git clone "$git_url/$repo" "$repo"</span><br><span style="color: hsl(120, 100%, 40%);">+  if [ -d "$repo" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+    cd "$repo"</span><br><span style="color: hsl(120, 100%, 40%);">+    git fetch</span><br><span style="color: hsl(120, 100%, 40%);">+  else</span><br><span style="color: hsl(120, 100%, 40%);">+    git clone "$git_url/$repo" "$repo"</span><br><span style="color: hsl(120, 100%, 40%);">+    cd "$repo"</span><br><span style="color: hsl(120, 100%, 40%);">+  fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  cd "$repo"</span><br><span> </span><br><span>   # Figure out whether we need to prepend origin/ to find branches in upstream.</span><br><span>   # Doing this allows using git hashes instead of a branch name.</span><br><span>@@ -86,7 +90,7 @@</span><br><span>     branch="origin/$branch"</span><br><span>   fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  git checkout -b build_branch "$branch"</span><br><span style="color: hsl(120, 100%, 40%);">+  git checkout -B build_branch "$branch"</span><br><span>   rm -rf *</span><br><span>   git reset --hard "$branch"</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11063">change 11063</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11063"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-tester </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I63f103b2f70559e969e8c66477ab9ee7f2886832 </div>
<div style="display:none"> Gerrit-Change-Number: 11063 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Holger Freyther <holger@freyther.de> </div>