libgit2

git_diff_line

Version:

Structure describing a line (or data span) of a diff.

A line is a range of characters inside a hunk. It could be a context line (i.e. in both old and new versions), an added line (i.e. only in the new version), or a removed line (i.e. only in the old version). Unfortunately, we don't know anything about the encoding of data in the file being diffed, so we cannot tell you much about the line content. Line data will not be NUL-byte terminated, however, because it will be just a span of bytes inside the larger file.

Signature

typedef struct git_diff_line { char origin int old_lineno int new_lineno int num_lines size_t content_len git_off_t content_offset const char *content };

Members

char
origin

A git_diff_line_t value

int
old_lineno

Line number in old file or -1 for added line

int
new_lineno

Line number in new file or -1 for deleted line

int
num_lines

Number of newline characters in content

size_t
content_len

Number of bytes of data

content_offset

Offset in the original file to the content

const char *
content

Pointer to diff text, not NUL-byte terminated

Parameter To

Versions