libgit2/libgit2 — pull request #1657 by arrbee (2013-06-18 00:12:37+00:00)
Title: Add "as_path" parameters to blob and buffer diff APIs

This adds parameters to the four functions that allow for blob-to-blob and blob-to-buffer differencing (either via callbacks or by making a `git_diff_patch object`). These parameters let you say that filename we should pretend the blob has while doing the diff. If you pass NULL, there should be no change from the existing behavior, which is to skip using attributes for file type checks and just look at content. With the parameters, you can plug into the new diff driver functionality and get binary or non-binary behavior, plus function context regular expressions, etc.

**This changes the public APIs:** `git_diff_blobs`, `git_diff_blob_to_buffer`, `git_diff_patch_from_blobs` and `git_diff_patch_from_blob_and_buffer`

This commit also fixes things so that the `git_diff_delta` that is generated by these functions will actually be populated with the data that we know about the blobs (or buffers) so you can use it appropriately. It also fixes a bug in generating patches from the `git_diff_patch` objects created via these functions.

Lastly, there is one other behavior change that may matter. If there is no difference between the two blobs, these functions no longer generate any diff callbacks / patches unless you have passed in `GIT_DIFF_INCLUDE_UNMODIFIED`. This is pretty natural, but could potentially change the behavior of existing usage.