diff --git a/pygit2/repository.py b/pygit2/repository.py index c7330e187..a9ca2b7bd 100644 --- a/pygit2/repository.py +++ b/pygit2/repository.py @@ -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 @@ -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")