Fix warnings and code style issues
Add buffer to buffer diff and patch APIs

This adds `git_diff_buffers` and `git_patch_from_buffers`.  This
also includes a bunch of internal refactoring to increase the
shared code between these functions and the blob-to-blob and
blob-to-buffer APIs, as well as some higher level assert helpers
in the tests to also remove redundancy.
Merge pull request #2146 from libgit2/rb/diff-b2b

Add git_diff_buffers and git_patch_from_buffers