Skip to content

Commit

Permalink
pygit2: use obj.size for blobs
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed May 31, 2022
1 parent a183213 commit 6e62792
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scmrepo/git/backend/pygit2.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def mode(self):

@cached_property
def size(self) -> int: # pylint: disable=invalid-overridden-method
# NOTE: obj.size is currently only available for blobs
if self.obj.type_str == "blob":
return self.obj.size
try:
return len(self.obj.read_raw())
except KeyError:
Expand Down

0 comments on commit 6e62792

Please sign in to comment.