pack: introduce a streaming API for raw objects

This allows us to take objects from the packfile as a stream instead
of having to keep it all in memory.
indexer: use the packfile streaming API

The new API allows us to read the object bit by bit from the packfile,
instead of needing it all at once in the packfile. This also allows us
to hash the object as it comes in from the network instead of having
to try to read it all and failing repeatedly for larger objects.

This is only the first step, but it already shows huge improvements
when dealing with objects over a few megabytes in size. It reduces the
memory needs in some cases, but delta objects still need to be
completely in memory and the old inefficent method is still used for
that.
indexer: make use of streaming also for deltas

Up to now, deltas needed to be enterily in the packfile, and we tried
to decompress then in their entirety over and over again.

Adjust the logic so we read them as they come, just as we do for full
objects. This also allows us to simplify the logic and have less
nested code. The delta resolving phase still needs to decompress the
whole object into memory, as there is not yet any streaming
delta-apply support, but it helps in speeding up the downloading
process and reduces the amount of memory allocations we need to do.
indexer: correctly deal with objects larger than the window size

A mmap-window is not guaranteed to give you the whole object, but the
indexer currently assumes so.

Loop asking for more data until we've successfully CRC'd all of the
packed data.
Fix diff header comments and missing const

Based on the recent work to wrap diff in objective-git, this
includes a fix for a missing const and a number of clarifications
of the documentation.
Merge pull request #1120 from arrbee/diff-header-fixes

Fix diff header comments and missing const
travis: Campfire notifications. Of course.
travis: Fix this hook
travis: Try this key
Allow compilation as C++
tree: relax the filemode parser

There are many different broken filemodes in the wild so we need to
protect against them and give something useful up the chain. Don't
fail when reading a tree from the ODB but normalize the mode as best
we can.

As 664 is no longer a mode that we consider to be valid and gets
normalized to 644, we can stop accepting it in the treebuilder. The
library won't expose it to the user, so any invalid modes are a bug.
Merge pull request #1123 from carlosmn/lax-tree

tree: relax the filemode parser
Merge pull request #1091 from carlosmn/stream-object

Indexer speedup with large objects
indexer: move the temporary buffers into the indexer object

Storing 4kB or 8kB in the stack is not very gentle. As this part has
to be linear, put the buffer into the indexer object so we allocate it
once in the heap.
git__mwindow_mutex needs to be initialized even with pthreads

This could also use PTHREAD_MUTEX_INITIALIZER, but a dynamic initializer seems like a more portable concept, and we won't need another #define on top of git_mutex_init()
Always check the result of git_mutex_lock
Treat git_mutex_lock as successful when threads are disabled
orite C89
Merge pull request #1127 from libgit2/fix-mwindow-threading

Fix mwindow mutex initialization and error checking
Merge pull request #1126 from carlosmn/indexer-buffer

indexer: move the temporary buffers into the indexer object