summary refs log tree commit diff
path: root/jenkins/clone.sh
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-08-03 11:12:47 +0100
committerMark Haines <mark.haines@matrix.org>2016-08-03 11:12:47 +0100
commit921f17f93810ac07fd5d15494882db78fdcf3e3c (patch)
treebd4f29ec888a4e445654688e0f6da994be899a63 /jenkins/clone.sh
parentE2E keys: Make federation query share code with client query (diff)
parentFactor out some of the code shared between the sytest scripts (#974) (diff)
downloadsynapse-921f17f93810ac07fd5d15494882db78fdcf3e3c.tar.xz
Merge branch 'develop' into rav/refactor_device_query
Diffstat (limited to 'jenkins/clone.sh')
-rwxr-xr-xjenkins/clone.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/jenkins/clone.sh b/jenkins/clone.sh
new file mode 100755
index 0000000000..f56d076ea9
--- /dev/null
+++ b/jenkins/clone.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+NAME=$1
+PROJECT=$2
+BASE=".$NAME-base"
+
+# update our clone
+if [ ! -d .$NAME-base ]; then
+  git clone $PROJECT $BASE --mirror
+else
+  (cd $BASE; git fetch -p)
+fi
+
+rm -rf $NAME
+git clone $BASE $NAME --shared
+
+: ${GIT_BRANCH:="origin/$(git rev-parse --abbrev-ref HEAD)"}
+cd $NAME
+# check out the relevant branch
+git checkout "${GIT_BRANCH}" || (
+    echo >&2 "No ref ${GIT_BRANCH} found, falling back to develop"
+    git checkout "origin/develop"
+)
+git clean -df .