odb_pack: handle duplicate objects from different packs

This is based on 24634c6fd02b2240e4a93fad70a08220f8fb793a.

This also corrects an issue with error codes being mixed up with the number of found objects.

Without the fix, the test fails with this:

```
  1) Failure:
odb::mixed::dup_oid [libgit2/tests-clar/odb/mixed.c:25]
  Function call failed: git_odb_read_prefix(&obj, _odb, &oid, sizeof(short_hex) - 1)
  error -5 - Ambiguous SHA1 prefix - found multiple pack entries
```

With the fix, it passes.

I should note that this bug only occurs with short OIDs.