Fix Repository.diff for references an empty trees

This should fix issue #432

By the way make the code a little more robust.
Reference: implement peel()

This makes both objects and references peelable via the same interface,
simplifying how to get to the wanted type.
Repository: make use of peel for diff()

Instead of trying to reimplement parts of it, make use of Object.peel()
and Reference.peel() to get to a Blob or Tree.