diff --git a/src/diff.c b/src/diff.c index 14db334..c0b3043 100644 --- a/src/diff.c +++ b/src/diff.c @@ -121,6 +121,8 @@ wrap_diff_hunk(git_patch *patch, size_t idx) py_hunk->old_lines = hunk->old_lines; py_hunk->new_start = hunk->new_start; py_hunk->new_lines = hunk->new_lines; + py_hunk->header = to_unicode_n((const char *) &hunk->header, + hunk->header_len, NULL, NULL); py_hunk->lines = PyList_New(lines_in_hunk); for (j = 0; j < lines_in_hunk; ++j) { @@ -497,6 +499,7 @@ cleanup: static void DiffHunk_dealloc(DiffHunk *self) { + Py_CLEAR(self->header); Py_CLEAR(self->lines); PyObject_Del(self); } @@ -506,6 +509,7 @@ PyMemberDef DiffHunk_members[] = { MEMBER(DiffHunk, old_lines, T_INT, "Old lines."), MEMBER(DiffHunk, new_start, T_INT, "New start."), MEMBER(DiffHunk, new_lines, T_INT, "New lines."), + MEMBER(DiffHunk, header, T_OBJECT, "Header."), MEMBER(DiffHunk, lines, T_OBJECT, "Lines."), {NULL} }; diff --git a/src/types.h b/src/types.h index 51305f8..d2774a9 100644 --- a/src/types.h +++ b/src/types.h @@ -140,6 +140,7 @@ typedef struct { int old_lines; int new_start; int new_lines; + PyObject *header; } DiffHunk; typedef struct {