Add extra locking around packfile open

We were still seeing a few issues in threaded access to packs.
This adds extra locks around the opening of the mwindow to
avoid a different race.
Extra threading tests

We need to hammer the packfile open phase harder in the thread
tests, in addition to the cache API.
Fix some compile warnings and trailing whitespace
Protect sha1_entry_pos call with mutex

There is an occasional assertion failure in sha1_entry_pos from
pack_entry_find_index when running threaded.  Holding the mutex
around the code that grabs the index_map data and processes it
makes this assertion failure go away.
Merge pull request #1529 from arrbee/more-packfile-locking

More packfile locking
refdb_fs: do not require peeled packed refs to be tags

Older versions of git would only write peeled entries for
items under refs/tags/. Newer versions will write them for
all refs, and we should be prepared to handle that.
Revert "Protect sha1_entry_pos call with mutex"

This reverts commit 8c535f3f6879c6796d8107d7eb80dd8b2105621b.
refdb_fs: implement the fully-peeled trait
refdb_fs: store "cannot be peeled" flag for packed refs

Fixes #1532
refdb_fs: Traits are always surrounded by spaces

This makes parsing easier! :p
refdb_fs: Only strstr the traits line
refdb_fs: respect PEELING_STANDARD

We only set our negative flag for PEELING_FULL; we can fall
back to the lesser PEELING_STANDARD if our ref is in the
refs/tags/ hierarchy.
Merge pull request #1531 from libgit2/jk/peeled-refs

refdb_fs: do not require peeled packed refs to be tags
Switch to index_version as "git_pack_file is ready" flag

We use p->index_map.data to check whether the struct has been set up
and all the information about the index is stored there. This variable
gets set up halfway through the setup process, however, and a thread
can come along and use fields that haven't been written to yet.

Crucially, pack_entry_find_offset() needs to read the index version
(which is written after index_map) to know the offset and stride
length to pass to sha1_entry_pos(). If these values are wrong,
assertions in it will fail, as it will be reading bogus data.

Make index_version the last field to be written and switch from using
p->index_map.data to p->index_version as "git_pack_file is ready" flag
as we can use it to know if every field has been written.
Merge pull request #1535 from carlosmn/pack-threading

Switch to index_version as "git_pack_file is ready" flag
puns are not funny; type punning especially so
Merge pull request #1537 from ethomson/merge_warning_cleanup

puns are not funny; type punning especially so
braces
Merge pull request #1538 from ethomson/merge_warning_cleanup

braces