diff --git a/include/pygit2/types.h b/include/pygit2/types.h index 59d4055..a2c7f56 100644 --- a/include/pygit2/types.h +++ b/include/pygit2/types.h @@ -72,10 +72,12 @@ typedef struct { int old_start; int old_lines; PyObject *old_oid; + int old_mode; char* old_file; int new_start; int new_lines; PyObject *new_oid; + int new_mode; char* new_file; PyObject *data; } Hunk; diff --git a/src/pygit2/diff.c b/src/pygit2/diff.c index 5207b91..4fc44eb 100644 --- a/src/pygit2/diff.c +++ b/src/pygit2/diff.c @@ -102,6 +102,9 @@ static int diff_hunk_cb( hunk->new_start = range->new_start; hunk->new_lines = range->new_lines; + hunk->old_mode = delta->old_file.mode; + hunk->new_mode = delta->new_file.mode; + git_oid_fmt(oid, &delta->old_file.oid); hunk->old_oid = PyUnicode_FromStringAndSize(oid, GIT_OID_HEXSZ); git_oid_fmt(oid, &delta->new_file.oid); @@ -249,10 +252,12 @@ PyMemberDef Hunk_members[] = { {"header", T_STRING, offsetof(Hunk, header), 0, "header"}, {"old_start", T_INT, offsetof(Hunk, old_start), 0, "old start"}, {"old_lines", T_INT, offsetof(Hunk, old_lines), 0, "old lines"}, + {"old_mode", T_INT, offsetof(Hunk, old_mode), 0, "old mode"}, {"old_file", T_STRING, offsetof(Hunk, old_file), 0, "old file"}, {"old_oid", T_OBJECT, offsetof(Hunk, old_oid), 0, "old_oid"}, {"new_start", T_INT, offsetof(Hunk, new_start), 0, "new start"}, {"new_lines", T_INT, offsetof(Hunk, new_lines), 0, "new lines"}, + {"new_mode", T_INT, offsetof(Hunk, new_mode), 0, "new mode"}, {"new_file", T_STRING, offsetof(Hunk, new_file), 0, "old file"}, {"new_oid", T_OBJECT, offsetof(Hunk, new_oid), 0, "new_oid"}, {"data", T_OBJECT, offsetof(Hunk, data), 0, "data"},