git_diff_patchid

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.

extern (C) nothrow @nogc
int
git_diff_patchid

Parameters

out_ libgit2_d.oid.git_oid*

Pointer where the calculated patch ID should be stored

diff .git_diff*

The diff to calculate the ID for

opts .git_diff_patchid_options*

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

Return Value

Type: int

0 on success, an error code otherwise.

Meta