git_diff
is the genreic interface for line-based differences, so you would put your functions for dealing with the individual lines and files.
If you're looking for something that gives you textual output as produced by git diff
and similar utilities, it would be easier to go through the git_patch API
.
You can call
git_patch_from_blobs()
which would give you a git_patch
object which you can then pass to
git_patch_to_buf()
which will write out the content in unified diff format to a git_buf
which you can use to print to whatever file/screen you want.
You can also do it by hand by providing some callbacks which would add information to some data structure of your choosing which you can then transform into unified diff or side-by-side or whatever, but for the user-case you mention, going through the patch API is much easier.