libgit2/libgit2 — pull request #2069 by isilkor (2014-01-22 13:19:09+00:00)
Title: Expose patch serialization to git_buf

Returning library-allocated strings from libgit2 works fine on Linux, but may cause problems on Windows because there is no one C Runtime that everything links against. With libgit2 not exposing its own allocator, freeing the string is a gamble.

`git_patch_to_str` already serializes to a buffer, then returns the underlying memory. Expose the functionality directly, so callers can use the `git_buf_free` function to free the memory later.

Additional test cases exercising `git_patch_to_buf` are not required, because the existing `git_patch_to_str` tests will cover `git_patch_to_buf` as well.