]> git.proxmox.com Git - libgit2.git/commit - src/diff_print.c
Add "as_path" parameters to blob and buffer diffs
authorRussell Belfer <rb@github.com>
Tue, 18 Jun 2013 00:03:34 +0000 (17:03 -0700)
committerRussell Belfer <rb@github.com>
Tue, 18 Jun 2013 00:03:34 +0000 (17:03 -0700)
commit74ded024572318a32ff537c5f8dce001e9812e6b
treefd749629f57c7d288ad7acbd036e094bb7e74b95
parentc09810eedfd89923e5bda25d0c98def292dee732
Add "as_path" parameters to blob and buffer diffs

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 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.
include/git2/diff.h
src/diff_file.c
src/diff_file.h
src/diff_patch.c
src/diff_print.c
tests-clar/diff/blob.c