From 730512bc3f26d3b0106ce76ce9b29b7f0bc1e128 Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Wed, 2 May 2018 10:58:43 +0100
Subject: [PATCH 1/5] Use the right js-sdk branch when testing

On the react-sdk tests not just riot-web
---
 .travis-test-riot.sh | 9 +--------
 scripts/travis.sh    | 4 ++++
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/.travis-test-riot.sh b/.travis-test-riot.sh
index 87200871a5..eeba4d0b7e 100755
--- a/.travis-test-riot.sh
+++ b/.travis-test-riot.sh
@@ -9,16 +9,9 @@ set -ev
 RIOT_WEB_DIR=riot-web
 REACT_SDK_DIR=`pwd`
 
-curbranch="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
-echo "Determined branch to be $curbranch"
-
-git clone https://github.com/vector-im/riot-web.git \
-    "$RIOT_WEB_DIR"
-
+scripts/fetchdep.sh vector-im riot-web
 cd "$RIOT_WEB_DIR"
 
-git checkout "$curbranch" || git checkout develop
-
 mkdir node_modules
 npm install
 
diff --git a/scripts/travis.sh b/scripts/travis.sh
index c4a06c1bd1..7c96a02eb5 100755
--- a/scripts/travis.sh
+++ b/scripts/travis.sh
@@ -2,6 +2,10 @@
 
 set -ex
 
+scripts/fetchdep.sh matrix-org matrix-js-sdk
+rm -r node_modules/matrix-js-sdk || true
+ln -s matrix-js-sdk node_modules/matrix-js-sdk
+
 npm run test
 ./.travis-test-riot.sh
 

From b44582777bbcf680093955b874867b88783353a9 Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Wed, 2 May 2018 11:03:40 +0100
Subject: [PATCH 2/5] Would if I added the script

---
 scripts/fetchdep.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100755 scripts/fetchdep.sh

diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh
new file mode 100755
index 0000000000..424a8b034c
--- /dev/null
+++ b/scripts/fetchdep.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+org="$1"
+repo="$2"
+
+curbranch="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
+echo "Determined branch to be $curbranch"
+
+git clone https://github.com/$org/$repo.git $repo --branch "$curbranch" || git clone https://github.com/$org/$repo.git $repo --branch develop
+

From c54198464ba396868a1c76e1f7991c427e398c3f Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Wed, 2 May 2018 11:09:28 +0100
Subject: [PATCH 3/5] npm install the js-sdk

---
 scripts/travis.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/travis.sh b/scripts/travis.sh
index 7c96a02eb5..5c084145da 100755
--- a/scripts/travis.sh
+++ b/scripts/travis.sh
@@ -6,6 +6,10 @@ scripts/fetchdep.sh matrix-org matrix-js-sdk
 rm -r node_modules/matrix-js-sdk || true
 ln -s matrix-js-sdk node_modules/matrix-js-sdk
 
+pushd node_modules/matrix-js-sdk
+npm install
+popd
+
 npm run test
 ./.travis-test-riot.sh
 

From 825d610938bcb30e509639782c1b4ce34ebe785d Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Wed, 2 May 2018 11:13:16 +0100
Subject: [PATCH 4/5] Bah, no pushd.

Also this npm install should now be unnecessary
---
 .travis.yml       | 1 -
 scripts/travis.sh | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 954f14a4da..ec07243a28 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,6 +15,5 @@ addons:
     chrome: stable
 install:
     - npm install
-    - (cd node_modules/matrix-js-sdk && npm install)
 script:
     ./scripts/travis.sh
diff --git a/scripts/travis.sh b/scripts/travis.sh
index 5c084145da..b3f87bfed0 100755
--- a/scripts/travis.sh
+++ b/scripts/travis.sh
@@ -6,9 +6,9 @@ scripts/fetchdep.sh matrix-org matrix-js-sdk
 rm -r node_modules/matrix-js-sdk || true
 ln -s matrix-js-sdk node_modules/matrix-js-sdk
 
-pushd node_modules/matrix-js-sdk
+cd node_modules/matrix-js-sdk
 npm install
-popd
+cd ../..
 
 npm run test
 ./.travis-test-riot.sh

From 9bccecf449533b5d48552a13f1e845983acc54c1 Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Wed, 2 May 2018 11:23:57 +0100
Subject: [PATCH 5/5] Get symlink right

Also No need to cd into the symlink, can just go straight there
---
 scripts/travis.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/travis.sh b/scripts/travis.sh
index b3f87bfed0..48410ea904 100755
--- a/scripts/travis.sh
+++ b/scripts/travis.sh
@@ -4,11 +4,11 @@ set -ex
 
 scripts/fetchdep.sh matrix-org matrix-js-sdk
 rm -r node_modules/matrix-js-sdk || true
-ln -s matrix-js-sdk node_modules/matrix-js-sdk
+ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
 
-cd node_modules/matrix-js-sdk
+cd matrix-js-sdk
 npm install
-cd ../..
+cd ..
 
 npm run test
 ./.travis-test-riot.sh