libgit2/libgit2 — pull request #2178 by arrbee (2014-03-10 18:45:24+00:00)
Title: Fix git_odb_short_id and git_odb_exists_prefix bugs

There is a bug in `git_odb_exists_prefix` pointed out by @mekishizufu in #2172.

This fixes the error and cherry picks the new test from PR #2172. The error was that the `GIT_ENOTFOUND` from a later backend was overriding the positive result from the earlier backend making it look like an object was not found when it really exists.

After fixing this, it pointed out a few bugs in the way I originally wrote the unit tests :cry: that were masking the error in the new API.

As part of this fix, I also made the prefix-using APIs for the ODB explicitly zero out the bits after the prefix in the given short OID. Previously it was the responsibility of the caller to make sure those bits were zero. I prefer this behavior because you can take a full OID and pass it to the prefix function with a short length and then make sure that the found value matches the full OID. I'm happy to drop this change if folks hate it, though.