libgit2

git_blame_buffer

Version:

Get blame data for a file that has been modified in memory. The reference parameter is a pre-calculated blame for the in-odb history of the file. This means that once a file blame is completed (which can be expensive), updating the buffer blame is very fast.

Lines that differ between the buffer and the committed version are marked as having a zero OID for their final_commit_id.

Signature

int git_blame_buffer(git_blame **out, git_blame *reference, const char *buffer, uint32_t buffer_len);

Parameters

In
out

pointer that will receive the resulting blame data

In
reference

cached blame from the history of the file (usually the output from git_blame_file)

const char *
In
buffer

the (possibly) modified contents of the file

uint32_t
In
buffer_len

number of valid bytes in the buffer

Returns

int

0 on success, or an error code. (use giterr_last for information about the error)

Versions