Index: testing_support/git_test_utils.py |
diff --git a/testing_support/git_test_utils.py b/testing_support/git_test_utils.py |
index bf583c684db142a6b3ced9b9c1b4b3b049f15cac..5becad94ba58e0ece7bbcbdaa812fee034d1d0d9 100644 |
--- a/testing_support/git_test_utils.py |
+++ b/testing_support/git_test_utils.py |
@@ -256,6 +256,7 @@ class GitRepo(object): |
self.git('init') |
for commit in schema.walk(): |
self._add_schema_commit(commit, schema.data_for(commit.name)) |
+ self.last_commit = self[commit.name] |
if schema.master: |
self.git('update-ref', 'master', self[schema.master]) |
@@ -321,7 +322,7 @@ class GitRepo(object): |
self.commit_map[commit.name] = self.git('rev-parse', 'HEAD').stdout.strip() |
self.git('tag', 'tag_%s' % commit.name, self[commit.name]) |
if commit.is_branch: |
- self.git('update-ref', 'branch_%s' % commit.name, self[commit.name]) |
+ self.git('branch', '-f', 'branch_%s' % commit.name, self[commit.name]) |
def git(self, *args, **kwargs): |
"""Runs a git command specified by |args| in this repo.""" |
@@ -394,6 +395,9 @@ class GitRepoReadOnlyTestBase(GitRepoSchemaTestBase): |
assert cls.REPO is not None |
cls.repo = cls.r_schema.reify() |
+ def setUp(self): |
+ self.repo.git('checkout', '-f', self.repo.last_commit) |
+ |
@classmethod |
def tearDownClass(cls): |
cls.repo.nuke() |