Commit 3d800ac2 authored by Sebastien Robin's avatar Sebastien Robin Committed by Klaus Wölfel

testnode: fix switch of branch when new branch name is a substring of previous one

parent 0ebecfbc
......@@ -331,6 +331,15 @@ develop = false
rev_list = test_node.getAndUpdateFullRevisionList(node_test_suite)
output = call("git branch".split()).strip()
self.assertTrue("* bar" in output.split('\n'))
# Add a fourth branch on remote, make sure we could switch to it
# this time the branch name is a substring of previous one (we had
# failure is such case at some point)
remote_call = self.getCaller(cwd=self.remote_repository2)
output = remote_call('git checkout master -b ba'.split())
vcs_repository_info['branch'] = 'ba'
rev_list = self.getAndUpdateFullRevisionList(test_node, node_test_suite)
output = call("git branch".split()).strip()
self.assertTrue("* ba" in output.split('\n'))
def test_05c_changeRepositoryUrl(self):
"""
......
......@@ -202,7 +202,7 @@ class Updater(object):
if self.branch and \
not ("* %s" % self.branch in self._git('branch').split("\n")):
# Delete branch if already exists
if self.branch in self._git('branch'):
if self.branch in [x.strip() for x in self._git('branch').split("\n")]:
self._git('branch', '-D', self.branch)
self._git('checkout', 'origin/%s' % self.branch, '-b',
self.branch)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment