Browse code

Fix Travis PR testing to not overwrite the "master" that Travis creates with our "upstream master", and to also ignore commits with no content (like a Merge commit - there's no need to sign off on literally nothing)

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

Tianon Gravi authored on 2014/01/08 04:51:51
Showing 2 changed files
... ...
@@ -13,7 +13,8 @@ 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 upstream +refs/heads/master:refs/remotes/upstream/master
16
+  - git fetch --append --no-tags upstream refs/heads/master:refs/remotes/upstream/master
17
+# 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
17 18
 
18 19
 script:
19 20
   - hack/travis/dco.py
... ...
@@ -24,6 +24,14 @@ p = re.compile(r'^{0} ([^<]+) <([^<>@]+@[^<>]+)> \(github: (\S+)\)$'.format(re.e
24 24
 failed_commits = 0
25 25
 
26 26
 for commit in commits:
27
+	commit['stat'] = subprocess.check_output([
28
+		'git', 'log', '--format=format:', '--max-count=1',
29
+		'--name-status', commit['hash'], '--',
30
+	])
31
+	if commit['stat'] == '':
32
+		print 'Commit {0} has no actual changed content, skipping.'.format(commit['hash'])
33
+		continue
34
+	
27 35
 	m = p.search(commit['message'])
28 36
 	if not m:
29 37
 		print 'Commit {1} does not have a properly formatted "{0}" marker.'.format(DCO, commit['hash'])