libgit2

git_blame_buffer

Version:

Get blame data for a file that has been modified in memory. The blame 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 *base, const char *buffer, size_t buffer_len);

Parameters

In
out

pointer that will receive the resulting blame data

In
base

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

size_t
In
buffer_len

number of valid bytes in the buffer

Returns

int

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

Versions