Browse code

Fix Travis for PRs against non-master (like release, for example)

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)

Tianon Gravi authored on 2014/01/19 02:37:27
Showing 2 changed files
... ...
@@ -13,8 +13,13 @@ before_script:
13 13
   - sudo apt-get update -qq
14 14
   - sudo apt-get install -qq python-yaml
15 15
   - git remote add upstream git://github.com/dotcloud/docker.git
16
-  - git fetch --append --no-tags upstream refs/heads/master:refs/remotes/upstream/master
16
+  - upstream=master;
17
+    if [ "$TRAVIS_PULL_REQUEST" != false ]; then
18
+      upstream=$TRAVIS_BRANCH;
19
+    fi;
20
+    git fetch --append --no-tags upstream refs/heads/$upstream:refs/remotes/upstream/$upstream
17 21
 # sometimes we have upstream master already as origin/master (PRs), but other times we don't, so let's just make sure we have a completely unambiguous way to specify "upstream master" from here out
22
+# but if it's a PR against non-master, we need that upstream branch instead :)
18 23
 
19 24
 script:
20 25
   - hack/travis/dco.py
... ...
@@ -6,7 +6,7 @@ if 'TRAVIS' not in os.environ:
6 6
 	exit(127)
7 7
 
8 8
 if os.environ['TRAVIS_PULL_REQUEST'] != 'false':
9
-	commit_range = [os.environ['TRAVIS_BRANCH'], 'FETCH_HEAD']
9
+	commit_range = ['upstream/' + os.environ['TRAVIS_BRANCH'], 'FETCH_HEAD']
10 10
 else:
11 11
 	try:
12 12
 		subprocess.check_call([