Fix tests for GitPython>0.3.2.RC1

Catches the GitCommandError exception when a ref does
not exist.

Change-Id: I9fe2e95d64eaf06537723957c6e7eaaf9282ccab
diff --git a/tests/base.py b/tests/base.py
index 46c7087..1cafc46 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -40,6 +40,7 @@
 import six.moves.urllib.parse as urlparse
 import statsd
 import testtools
+from git import GitCommandError
 
 import zuul.scheduler
 import zuul.webapp
@@ -1031,9 +1032,12 @@
     def ref_has_change(self, ref, change):
         path = os.path.join(self.git_root, change.project)
         repo = git.Repo(path)
-        for commit in repo.iter_commits(ref):
-            if commit.message.strip() == ('%s-1' % change.subject):
-                return True
+        try:
+            for commit in repo.iter_commits(ref):
+                if commit.message.strip() == ('%s-1' % change.subject):
+                    return True
+        except GitCommandError:
+            pass
         return False
 
     def job_has_changes(self, *args):