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

Fallback to calculating file hash if Git does not know the file

Generally this should not happen, but Weblate should not crash in such
situation.

Fixes #769
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent d7a3b094
...@@ -555,7 +555,12 @@ class GitRepository(Repository): ...@@ -555,7 +555,12 @@ class GitRepository(Repository):
""" """
real_path = self.resolve_symlinks(path) real_path = self.resolve_symlinks(path)
return self.execute(['ls-tree', 'HEAD', real_path]).split()[2] git_hash = self.execute(['ls-tree', 'HEAD', real_path])
if not git_hash:
return super(GitRepository, self).get_object_hash(path)
return git_hash.split()[2]
def configure_remote(self, pull_url, push_url, branch): def configure_remote(self, pull_url, push_url, 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