git_diff_foreach

Loop over all deltas in a diff issuing callbacks.

This will iterate through all of the files described in a diff. You should provide a file callback to learn about each file.

The "hunk" and "line" callbacks are optional, and the text diff of the files will only be calculated if they are not null. Of course, these callbacks will not be invoked for binary files on the diff or for files whose only changed is a file mode change.

Returning a non-zero value from any of the callbacks will terminate the iteration and return the value to the user.

Parameters

diff .git_diff*

A git_diff generated by one of the above functions.

file_cb .git_diff_file_cb

Callback function to make per file in the diff.

binary_cb .git_diff_binary_cb

Optional callback to make for binary files.

hunk_cb .git_diff_hunk_cb

Optional callback to make per hunk of text diff. This callback is called to describe a range of lines in the diff. It will not be issued for binary files.

line_cb .git_diff_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.

payload void*

Reference pointer that will be passed to your callbacks.

Return Value

Type: int

0 on success, non-zero callback return value, or error code

Meta