bugfix: branches with pattern 'refs/heads/..' fails merge jobs
GitPython is trying to be nice and thinks that we want the head '<name>' when trying to create the head 'refs/heads/<name>'. Avoid this by always prepending 'refs/heads/'. Change-Id: I90768fd678b02a7fbfc0675456dc4105b51d7f06
This commit is contained in:
parent
f05adde83e
commit
1dbcfd5346
|
@ -35,6 +35,19 @@ class TestMergerRepo(ZuulTestCase):
|
|||
super(TestMergerRepo, self).setUp()
|
||||
self.workspace_root = os.path.join(self.test_root, 'workspace')
|
||||
|
||||
def test_create_head_path(self):
|
||||
parent_path = os.path.join(self.upstream_root, 'org/project1')
|
||||
parent_repo = git.Repo(parent_path)
|
||||
parent_repo.create_head("refs/heads/foobar")
|
||||
parent_repo.create_head("refs/heads/refs/heads/foobar")
|
||||
|
||||
work_repo = Repo(parent_path, self.workspace_root,
|
||||
'none@example.org', 'User Name', '0', '0')
|
||||
repo = work_repo.createRepoObject(None)
|
||||
self.assertIn('foobar', repo.branches)
|
||||
self.assertIn('refs/heads/foobar', repo.branches)
|
||||
self.assertNotIn('refs/heads/refs/heads/foobar', repo.branches)
|
||||
|
||||
def test_ensure_cloned(self):
|
||||
parent_path = os.path.join(self.upstream_root, 'org/project1')
|
||||
|
||||
|
|
|
@ -184,7 +184,9 @@ class Repo(object):
|
|||
for ref in origin.refs:
|
||||
if ref.remote_head == 'HEAD':
|
||||
continue
|
||||
repo.create_head(ref.remote_head, ref, force=True)
|
||||
repo.create_head('refs/heads/' + ref.remote_head,
|
||||
ref,
|
||||
force=True)
|
||||
with repo.config_writer() as config_writer:
|
||||
if self.email:
|
||||
config_writer.set_value('user', 'email', self.email)
|
||||
|
@ -384,7 +386,7 @@ class Repo(object):
|
|||
for ref in origin.refs:
|
||||
if ref.remote_head == 'HEAD':
|
||||
continue
|
||||
repo.create_head(ref.remote_head, ref, force=True)
|
||||
repo.create_head('refs/heads/' + ref.remote_head, ref, force=True)
|
||||
return messages
|
||||
|
||||
def reset(self, zuul_event_id=None, build=None, process_worker=None):
|
||||
|
|
Loading…
Reference in New Issue