Export `git_oid_tostr_s` instead of `_allocfmt`

The old `allocfmt` is of no use to callers, as they are not able to free
the returned buffer. Export a new API that returns a static string that
doesn't need to be freed.

Supersedes https://github.com/libgit2/libgit2/pull/2524, fixes #2493