libgit2

git_diff_patchid

Version:

Calculate the patch ID for the given patch.

Calculate a stable patch ID for the given patch by summing the hash of the file diffs, ignoring whitespace and line numbers. This can be used to derive whether two diffs are the same with a high probability.

Currently, this function only calculates stable patch IDs, as defined in git-patch-id(1), and should in fact generate the same IDs as the upstream git project does.

Signature

int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opts);

Parameters

In
out

Pointer where the calculated patch ID shoul be stored

In
diff

The diff to calculate the ID for

In
opts

Options for how to calculate the patch ID. This is intended for future changes, as currently no options are available.

Returns

int

0 on success, an error code otherwise.

Versions