Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions pygit2/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,12 @@ def whatever_to_tree_or_blob(obj):
try:
obj = obj.peel(Blob)
except Exception:
pass

# And if that failed, try to get a tree, raising a type
# error if that still doesn't work
try:
obj = obj.peel(Tree)
except Exception:
raise TypeError('unexpected "%s"' % type(obj))
# And if that failed, try to get a tree, raising a type
# error if that still doesn't work
try:
obj = obj.peel(Tree)
except Exception:
raise TypeError('unexpected "%s"' % type(obj))

return obj

Expand All @@ -415,7 +413,7 @@ def whatever_to_tree_or_blob(obj):

# Case 4: Diff blob to blob
if isinstance(a, Blob) and isinstance(b, Blob):
raise NotImplementedError('git_diff_blob_to_blob()')
return a.diff(b)

raise ValueError("Only blobs and treeish can be diffed")

Expand Down