Get rid of allocfmt()

It is not possible to know how we can free the results of this
allocation, so we shouldn't be using this function.

We have a convention of returning Oid objects in pygit2, so let's keep
to that in these places.

---

The tests showed some issues if we just leave it to use `str` or `repr` to compare, though it likely won't affect anybody who is using this to print them out. So this may be a breaking change in certain situations.