libgit2/libgit2 — pull request #1518 by arrbee (2013-04-29 19:37:27+00:00)
Title: Export oid comparison

This creates a new exported function `git_oid_compare` which just calls `git_oid_cmp` but is not inline. It feels to me like an OID comparison should be part of the linkable API.

I also ended up looking at a number of other OID functions and am proposing a few other things...

* Added `git_oid_strcmp` which is like `git_oid_streq` but is a traditional `cmp` style function instead of just match/no-match.
* Internally `git_oid_strcmp` is written to walk the OID and string data stopping as soon as a mismatch is found. The old `git_oid_streq` was converting the entire string to an OID before starting the comparison, so this should be more efficient.
* Changed `git_oid_streq` to just call the new `git_oid_strcmp` and check for a zero result.
* The `git_oid_ncmp` function was not being careful with small values for length (0 or 1) and was not stopping at the max length (and didn't have any tests), so I fixed that.