libgit2sharp
libgit2sharp copied to clipboard
Add ability to diff two arbitrary buffers
libgit2 exposes a method to perform diff's between arbitrary buffers, git_diff_buffers.
It would be nice to expose this so that consumers can generate git-compatible diffs from arbitrary buffers.
I have exposed this call as two static methods on the Diff class (this felt like the most appropriate place, but I'm not 100% sure).
public static ContentChanges Compare(byte[] oldBuffer, byte[] newBuffer)public static ContentChanges Compare(byte[] oldBuffer, byte[] newBuffer, CompareOptions compareOptions)
There is a new NativeMethod call and Proxy for git_diff_buffers and a new constructor for ContentChanges that executes this call when provided with two byte arrays.
I have also added a test suite that verifies that it produces the same output as git as well as the same tests as the Blob to Blob diff tests