diff --git a/testing_support/fake_repos.py b/testing_support/fake_repos.py index 9e4091ae3..04443421c 100755 --- a/testing_support/fake_repos.py +++ b/testing_support/fake_repos.py @@ -28,6 +28,8 @@ import gclient_utils import scm import subprocess2 +DEFAULT_BRANCH = 'master' + def write(path, content): f = open(path, 'wb') @@ -160,7 +162,11 @@ class FakeReposBase(object): except (OSError, subprocess2.CalledProcessError): return False for repo in ['repo_%d' % r for r in range(1, self.NB_GIT_REPOS + 1)]: + # TODO(crbug.com/114712) use git.init -b and remove 'checkout' once git is + # upgraded to 2.28 on all builders. subprocess2.check_call(['git', 'init', '-q', join(self.git_base, repo)]) + subprocess2.check_call(['git', 'checkout', '-q', '-b', DEFAULT_BRANCH], + cwd=join(self.git_base, repo)) self.git_hashes[repo] = [(None, None)] self.populateGit() self.initialized = True diff --git a/testing_support/git_test_utils.py b/testing_support/git_test_utils.py index 31e0e787c..5a05385e0 100644 --- a/testing_support/git_test_utils.py +++ b/testing_support/git_test_utils.py @@ -18,6 +18,8 @@ import unittest import gclient_utils +DEFAULT_BRANCH = 'master' + if sys.version_info.major == 3: # pylint: disable=redefined-builtin basestring = (str,) @@ -297,9 +299,12 @@ class GitRepo(object): self.to_schema_refs = ['--branches'] + # TODO(crbug.com/114712) use git.init -b and remove 'checkout' once git is + # upgraded to 2.28 on all builders. self.git('init') self.git('config', 'user.name', 'testcase') self.git('config', 'user.email', 'testcase@example.com') + self.git('checkout', '-b', DEFAULT_BRANCH) for commit in schema.walk(): self._add_schema_commit(commit, schema.data_for(commit.name)) self.last_commit = self[commit.name]