Commit 7dd314ab 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 6ee0b765
...@@ -341,6 +341,15 @@ shared = true ...@@ -341,6 +341,15 @@ shared = true
rev_list = self.getAndUpdateFullRevisionList(test_node, node_test_suite) rev_list = self.getAndUpdateFullRevisionList(test_node, node_test_suite)
output = call("git branch".split()).strip() output = call("git branch".split()).strip()
self.assertTrue("* bar" in output.split('\n')) 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): def test_05c_changeRepositoryUrl(self):
""" """
......
...@@ -202,7 +202,7 @@ class Updater(object): ...@@ -202,7 +202,7 @@ class Updater(object):
if self.branch and \ if self.branch and \
not ("* %s" % self.branch in self._git('branch').split("\n")): not ("* %s" % self.branch in self._git('branch').split("\n")):
# Delete branch if already exists # 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('branch', '-D', self.branch)
self._git('checkout', 'origin/%s' % self.branch, '-b', self._git('checkout', 'origin/%s' % self.branch, '-b',
self.branch) 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