Commit f69b9654 authored by Michal Čihař's avatar Michal Čihař

Simplify git branch update logic

parent 759f5bde
......@@ -247,11 +247,8 @@ class SubProject(models.Model):
Ensures local tracking branch exists and is checkouted.
'''
gitrepo = self.get_repo()
try:
head = gitrepo.heads[self.branch]
except:
if not self.branch in gitrepo.heads:
gitrepo.git.branch('--track', self.branch, 'origin/%s' % self.branch)
head = gitrepo.heads[self.branch]
gitrepo.git.checkout(self.branch)
del gitrepo
......
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