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

Force reloading Git DB cache on error

Just recreating the object does not help as gitdb module is holding
cache of objects and won't reread it unless explicitely told so.

This still leaves open question how to detect these situations better.

Fixes #449
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 13ff8797
......@@ -377,16 +377,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
self._linked_subproject = SubProject.objects.get_linked(self.repo)
return self._linked_subproject
def reset_git_repo(self):
'''
Resets git repository object database.
'''
if self.is_repo_link:
self.linked_subproject.reset_git_repo()
return
self._git_repo = None
@property
def git_repo(self):
'''
......@@ -414,7 +404,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
except ODBError:
# Try to reread git database in case our in memory object is not
# up to date with it.
self.reset_git_repo()
self.git_repo.odb.update_cache()
return self.git_repo.commit('origin/%s' % self.branch)
def get_repo_url(self):
......
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