diff options
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r-- | include/git2/diff.h | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index f925cbe39..fd00378af 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -188,9 +188,9 @@ typedef struct { * When iterating over a diff, callback that will be made per file. */ typedef int (*git_diff_file_cb)( - void *cb_data, const git_diff_delta *delta, - float progress); + float progress, + void *payload); /** * Structure describing a hunk of a diff. @@ -206,11 +206,11 @@ typedef struct { * When iterating over a diff, callback that will be made per hunk. */ typedef int (*git_diff_hunk_cb)( - void *cb_data, const git_diff_delta *delta, const git_diff_range *range, const char *header, - size_t header_len); + size_t header_len, + void *payload); /** * Line origin constants. @@ -247,12 +247,12 @@ typedef enum { * of lines of file and hunk headers. */ typedef int (*git_diff_data_cb)( - void *cb_data, const git_diff_delta *delta, const git_diff_range *range, char line_origin, /**< GIT_DIFF_LINE_... value from above */ const char *content, - size_t content_len); + size_t content_len, + void *payload); /** * The diff patch is used to store all the text diffs for a delta. @@ -284,6 +284,8 @@ typedef enum { * Control behavior of rename and copy detection */ typedef struct { + unsigned int version; + /** Combination of git_diff_find_t values (default FIND_RENAMES) */ unsigned int flags; @@ -462,7 +464,6 @@ GIT_EXTERN(int) git_diff_find_similar( * the iteration and cause this return `GIT_EUSER`. * * @param diff A git_diff_list generated by one of the above functions. - * @param cb_data Reference pointer that will be passed to your callbacks. * @param file_cb Callback function to make per file in the diff. * @param hunk_cb Optional callback to make per hunk of text diff. This * callback is called to describe a range of lines in the @@ -470,14 +471,15 @@ GIT_EXTERN(int) git_diff_find_similar( * @param line_cb Optional callback to make per line of diff text. This * same callback will be made for context lines, added, and * removed lines, and even for a deleted trailing newline. + * @param payload Reference pointer that will be passed to your callbacks. * @return 0 on success, GIT_EUSER on non-zero callback, or error code */ GIT_EXTERN(int) git_diff_foreach( git_diff_list *diff, - void *cb_data, git_diff_file_cb file_cb, git_diff_hunk_cb hunk_cb, - git_diff_data_cb line_cb); + git_diff_data_cb line_cb, + void *payload); /** * Iterate over a diff generating text output like "git diff --name-status". @@ -486,14 +488,14 @@ GIT_EXTERN(int) git_diff_foreach( * iteration and cause this return `GIT_EUSER`. * * @param diff A git_diff_list generated by one of the above functions. - * @param cb_data Reference pointer that will be passed to your callback. * @param print_cb Callback to make per line of diff text. + * @param payload Reference pointer that will be passed to your callback. * @return 0 on success, GIT_EUSER on non-zero callback, or error code */ GIT_EXTERN(int) git_diff_print_compact( git_diff_list *diff, - void *cb_data, - git_diff_data_cb print_cb); + git_diff_data_cb print_cb, + void *payload); /** * Look up the single character abbreviation for a delta status code. @@ -518,7 +520,7 @@ GIT_EXTERN(char) git_diff_status_char(git_delta_t status); * iteration and cause this return `GIT_EUSER`. * * @param diff A git_diff_list generated by one of the above functions. - * @param cb_data Reference pointer that will be passed to your callbacks. + * @param payload Reference pointer that will be passed to your callbacks. * @param print_cb Callback function to output lines of the diff. This * same function will be called for file headers, hunk * headers, and diff lines. Fortunately, you can probably @@ -528,8 +530,8 @@ GIT_EXTERN(char) git_diff_status_char(git_delta_t status); */ GIT_EXTERN(int) git_diff_print_patch( git_diff_list *diff, - void *cb_data, - git_diff_data_cb print_cb); + git_diff_data_cb print_cb, + void *payload); /** * Query how many diff records are there in a diff list. @@ -573,15 +575,15 @@ GIT_EXTERN(size_t) git_diff_num_deltas_of_type( * It is okay to pass NULL for either of the output parameters; if you pass * NULL for the `git_diff_patch`, then the text diff will not be calculated. * - * @param patch Output parameter for the delta patch object - * @param delta Output parameter for the delta object + * @param patch_out Output parameter for the delta patch object + * @param delta_out Output parameter for the delta object * @param diff Diff list object * @param idx Index into diff list * @return 0 on success, other value < 0 on error */ GIT_EXTERN(int) git_diff_get_patch( - git_diff_patch **patch, - const git_diff_delta **delta, + git_diff_patch **patch_out, + const git_diff_delta **delta_out, git_diff_list *diff, size_t idx); @@ -673,15 +675,15 @@ GIT_EXTERN(int) git_diff_patch_get_line_in_hunk( * and cause this return `GIT_EUSER`. * * @param patch A git_diff_patch representing changes to one file - * @param cb_data Reference pointer that will be passed to your callbacks. * @param print_cb Callback function to output lines of the patch. Will be * called for file headers, hunk headers, and diff lines. + * @param payload Reference pointer that will be passed to your callbacks. * @return 0 on success, GIT_EUSER on non-zero callback, or error code */ GIT_EXTERN(int) git_diff_patch_print( git_diff_patch *patch, - void *cb_data, - git_diff_data_cb print_cb); + git_diff_data_cb print_cb, + void *payload); /** * Get the content of a patch as a single diff text. @@ -719,10 +721,10 @@ GIT_EXTERN(int) git_diff_blobs( git_blob *old_blob, git_blob *new_blob, const git_diff_options *options, - void *cb_data, git_diff_file_cb file_cb, git_diff_hunk_cb hunk_cb, - git_diff_data_cb line_cb); + git_diff_data_cb line_cb, + void *payload); GIT_END_DECL |