libgit2

git_patch_get_hunk

Version:

Get the information about a hunk in a patch

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.

Signature

int git_patch_get_hunk(const git_diff_hunk **out, size_t *lines_in_hunk, git_patch *patch, size_t hunk_idx);

Parameters

In
out

Output pointer to git_diff_hunk of hunk

size_t *
In
lines_in_hunk

Output count of total lines in this hunk

In
patch

Input pointer to patch object

size_t
In
hunk_idx

Input index of hunk to get information about

Returns

int

0 on success, GIT_ENOTFOUND if hunk_idx out of range, < 0 on error

Versions