Repository: make use of peel for diff()#434
Conversation
747a154 to
95aaf01
Compare
This makes both objects and references peelable via the same interface, simplifying how to get to the wanted type.
Instead of trying to reimplement parts of it, make use of Object.peel() and Reference.peel() to get to a Blob or Tree.
95aaf01 to
59da034
Compare
|
Rebased to work on top of @jdavid 's refactor/fix. The first makes sure we have a "peelable" interface for both references and objects, so we can get to objects regardless of the input. The second one then makes use of that in order to peel whatever non-string we got, and forcing the string to be a valid revspec, which we then continue trying to peel (so we can still get to |
|
BTW, since it's mildly related, I was also playing around with moving So I was thinking of having |
|
There is already This means the new |
|
Yeah, this makes sense. |
|
I am going to be off-line for the rest of the week, so feel free to merge this. |
Let Reference.peel()'s argument be optional, and default to GIT_OBJ_ANY, which mirrors the behaviour of get_object(). Since we reimplement the get_object() behaviour, change it to call peel() which makes sure we can keep using the old tests for this aspect.
a0c1236 to
5d4c955
Compare
Repository: make use of peel for diff()
|
|
Instead of trying to reimplement parts of it, make use of Object.peel()
to get to a Tree, with short-circuit returns for None and Blob which can
be handled differently.