Use git_odb_object_data/_size whereever possible

This uses the odb object accessors so we can change the internals
more easily...
Add range checking around cache opts

Add a git_cache_set_max_object_size method that does more checking
around setting the max object size.  Also add a git_cache_size to
read the number of objects currently in the cache.  This makes it
easier to write tests.
Add mutex around mapping and unmapping pack files

When I was writing threading tests for the new cache, the main
error I kept running into was a pack file having it's content
unmapped underneath the running thread.  This adds a lock around
the routines that map and unmap the pack data so that threads can
effectively reload the data when they need it.

This also required reworking the error handling paths in a couple
places in the code which I tried to make consistent.
Add tests for oidmap and new cache with threading

This adds some basic tests for the oidmap just to make sure that
collisions, etc. are dealt with correctly.

This also adds some tests for the new caching that check if items
are inserted (or not inserted) properly into the cache, and that
the cache can hold up in a multithreaded environment without error.
Merge pull request #1465 from arrbee/new-cache-threading-tests

new-cache threading tests
Merge pull request #1461 from arrbee/new-cache

Use git_odb_object_data/_size whereever possible