diff options
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r-- | include/git2/diff.h | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index 0c9f620c1..d8dc91c80 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -154,19 +154,22 @@ typedef int (*git_diff_hunk_fn)( * Line origin constants. * * These values describe where a line came from and will be passed to - * the git_diff_line_fn when iterating over a diff. There are some + * the git_diff_data_fn when iterating over a diff. There are some * special origin contants at the end that are used for the text * output callbacks to demarcate lines that are actually part of * the file or hunk headers. */ enum { - /* these values will be sent to `git_diff_line_fn` along with the line */ + /* these values will be sent to `git_diff_data_fn` along with the line */ GIT_DIFF_LINE_CONTEXT = ' ', GIT_DIFF_LINE_ADDITION = '+', GIT_DIFF_LINE_DELETION = '-', GIT_DIFF_LINE_ADD_EOFNL = '\n', /**< LF was added at end of file */ GIT_DIFF_LINE_DEL_EOFNL = '\0', /**< LF was removed at end of file */ - /* these values will only be sent to a `git_diff_output_fn` */ + /* these values will only be sent to a `git_diff_data_fn` when the content + * of a diff is being formatted (eg. through git_diff_print_patch() or + * git_diff_print_compact(), for instance). + */ GIT_DIFF_LINE_FILE_HDR = 'F', GIT_DIFF_LINE_HUNK_HDR = 'H', GIT_DIFF_LINE_BINARY = 'B' @@ -174,25 +177,19 @@ enum { /** * When iterating over a diff, callback that will be made per text diff - * line. - */ -typedef int (*git_diff_line_fn)( - void *cb_data, - git_diff_delta *delta, - char line_origin, /**< GIT_DIFF_LINE_... value from above */ - const char *content, - size_t content_len); - -/** + * line. In this context, the provided range will be NULL. + * * When printing a diff, callback that will be made to output each line * of text. This uses some extra GIT_DIFF_LINE_... constants for output * of lines of file and hunk headers. */ -typedef int (*git_diff_output_fn)( +typedef int (*git_diff_data_fn)( void *cb_data, + git_diff_delta *delta, + git_diff_range *range, char line_origin, /**< GIT_DIFF_LINE_... value from above */ - const char *formatted_output); - + const char *content, + size_t content_len); /** @name Diff List Generator Functions * @@ -311,7 +308,7 @@ GIT_EXTERN(int) git_diff_foreach( void *cb_data, git_diff_file_fn file_cb, git_diff_hunk_fn hunk_cb, - git_diff_line_fn line_cb); + git_diff_data_fn line_cb); /** * Iterate over a diff generating text output like "git diff --name-status". @@ -319,7 +316,7 @@ GIT_EXTERN(int) git_diff_foreach( GIT_EXTERN(int) git_diff_print_compact( git_diff_list *diff, void *cb_data, - git_diff_output_fn print_cb); + git_diff_data_fn print_cb); /** * Iterate over a diff generating text output like "git diff". @@ -329,7 +326,7 @@ GIT_EXTERN(int) git_diff_print_compact( GIT_EXTERN(int) git_diff_print_patch( git_diff_list *diff, void *cb_data, - git_diff_output_fn print_cb); + git_diff_data_fn print_cb); /**@}*/ @@ -348,7 +345,7 @@ GIT_EXTERN(int) git_diff_blobs( git_diff_options *options, void *cb_data, git_diff_hunk_fn hunk_cb, - git_diff_line_fn line_cb); + git_diff_data_fn line_cb); GIT_END_DECL |