Don't try to pack symbolic refs

If there were symbolic refs among the loose refs then the code
to create packed-refs would fail trying to parse the OID out of
them (where Git just skips trying to pack them).  This fixes it.
Add sorted cache data type

This adds a convenient new data type for caching the contents of
file in memory when each item in that file corresponds to a name
and you need to both be able to lookup items by name and iterate
over them in some sorted order.  The new data type has locks in
place to manage usage in a threaded environment.
Add sortedcache APIs to lookup index and remove

This adds two other APIs that I need to the sortedcache type.
Add internal ref set_name fn instead of realloc

The refdb_fs implementation calls realloc directly on a reference
object when it wants to rename it.  It is not a public object, so
this doesn't mess with the immutability of references, but it does
assume certain constraints on the reference representation.  This
commit wraps that assumption in an isolated API to isolate it.
Rewrite refdb_fs using git_sortedcache object

This adds thread safety to the refdb_fs by using the new
git_sortedcache object and also by relaxing the handling of some
filesystem errors where the fs may be changed out from under us.

This also adds some new threading tests that hammer on the refdb.
Fix warnings when compiling without threads
No need to lock newly created tgt in copy
Improve comments on locking for sortedcache APIs
Convert sortedcache to use rwlock

This is the first use we have of pthread_rwlock_t in libgit2.
Hopefully it won't cause any serious portability problems.
A bit of item alignment paranoia
Add SRWLock implementation of rwlocks for Win32
Drop support for THREADSAFE on Windows XP

This makes libgit2 require Windows Vista or newer if it is going
to be compiled with the THREADSAFE option
Trying to fix Win32 warnings
Fix sortedcache docs and other feedback

This converts an internal lock from a write lock to a read lock
where write isn't needed, and also clarifies some doc things about
where various locks are acquired and how various APIs are intended
to be used.
Fix comment
Load SRWLock APIs at runtime

This loads SRWLock APIs at runtime and in their absence (i.e. on
Windows before Vista) falls back on a regular CRITICAL_SECTION
that will not permit concurrent readers.
Fix MINGW SRWLock typedefs
Convert to our own SRWLOCK type on Win32
Some documentation improvements
Merge pull request #1805 from libgit2/threading-packed-load

Thread safety for the refdb_fs