Skip to content

Commit

Permalink
Handle EmptyFile Exception.
Browse files Browse the repository at this point in the history
See jonashaag#297

This at least fixes viewing of a repository with some broken objects in it; viewing the objects themselves will still result in exceptions, but that requires case-by-case work.
  • Loading branch information
jelmer committed Nov 28, 2022
1 parent f4f650d commit d9470fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions klaus/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import stat
import subprocess

from dulwich.objects import S_ISGITLINK
from dulwich.objects import S_ISGITLINK, EmptyFileException
from dulwich.object_store import tree_lookup_path
from dulwich.objects import Blob
from dulwich.errors import NotTreeError
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_ref_names_ordered_by_last_commit(self, prefix, exclude=None):
def get_commit_time(refname):
try:
obj = self[refs[refname]]
except InaccessibleRef:
except (InaccessibleRef, EmptyFileException):
# Default to 0, i.e. sorting refs that point at non-existant
# objects last.
return 0
Expand Down

0 comments on commit d9470fe

Please sign in to comment.