procedure
( git_patch_freepatch)→void?
patch:patch?
procedure
old_as_pathbufferbuffer_lenbuffer_as_pathopts)buffer_len:integer?
This is just like git_diff_blob_to_buffer() except it generates a patch object for the difference instead of directly making callbacks. You can use the standard git_patch accessor functions to read the patch data, and you must call git_patch_free() on the patch when done.
This is just like git_diff_blobs() except it generates a patch object for the difference instead of directly making callbacks. You can use the standard git_patch accessor functions to read the patch data, and you must call git_patch_free() on the patch when done.
procedure
old_lenold_as_pathnew_buffernew_lennew_as_pathopts) → patch?old_len:integer?new_len:integer?
This is just like git_diff_buffers() except it generates a patch object for the difference instead of directly making callbacks. You can use the standard git_patch accessor functions to read the patch data, and you must call git_patch_free() on the patch when done.
diff:diff?idx:integer?
The git_patch is a newly created object contains the text diffs for the delta. You have to call git_patch_free() when you are done with it. You can use the patch object to loop over all the hunks and lines in the diff of the one delta.
For an unchanged file or a binary file, no git_patch will be created, the output will be set to NULL, and the binary flag will be set true in the git_diff_delta structure.
It is okay to pass NULL for either of the output parameters; if you pass NULL for the git_patch, then the text diff will not be calculated.
procedure
( git_patch_get_hunkpatchhunk_idx)→any
patch:patch?hunk_idx:size_t
Given a patch and a hunk index into the patch, this returns detailed information about that hunk. Any of the output pointers can be passed as NULL if you don’t care about that particular piece of information.
Returns (values (out:git_diff_hunk?)(lines:integer? )). See Multiple Values
Given a patch, a hunk index, and a line index in the hunk, this will return a lot of details about that line. If you pass a hunk index larger than the number of hunks or a line index larger than the number of lines in the hunk, this will return -1.
procedure
( git_patch_line_statspatch)→any
patch:patch?
This helps imitate a diff –numstat type of output. For that purpose, you only need the total_additions and total_deletions values, but we include the total_context line count in case you want the total number of lines of diff output that will be generated.
All outputs are optional. Pass NULL if you don’t need a particular count.
Returns (values (context:integer? )(additions:integer? )(deletions:integer? )). See Multiple Values
procedure
( git_patch_num_hunkspatch)→integer?
patch:patch?
procedure
( git_patch_printpatchprint_cbpayload)→integer?
patch:patch?print_cb:git_diff_line_cbpayload:bytes?
Returning a non-zero value from the callback will terminate the iteration and return that value to the caller.
procedure
include_contextinclude_hunk_headerspatch:patch?include_context:boolean?include_hunk_headers:boolean?include_file_headers:boolean?
This returns the raw size of the patch data. This only includes the actual data from the lines of the diff, not the file or hunk headers.
If you pass include_context as true (non-zero), this will be the size of all of the diff output; if you pass it as false (zero), this will only include the actual changed lines (as if context_lines was 0).
procedure
( git_patch_to_bufoutpatch)→integer?
out:buf?patch:patch?