libgit2

git_patch_line_stats

Version:

Get line counts of each type in a 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.

Signature

int git_patch_line_stats(size_t *total_context, size_t *total_additions, size_t *total_deletions, const git_patch *patch);

Parameters

size_t *
In
total_context

Count of context lines in output, can be NULL.

size_t *
In
total_additions

Count of addition lines in output, can be NULL.

size_t *
In
total_deletions

Count of deletion lines in output, can be NULL.

In
patch

The git_patch object

Returns

int

0 on success, < 0 on error

Versions