diff --git a/src/diff.c b/src/diff.c index 8cf0b4d..1ff85b7 100644 --- a/src/diff.c +++ b/src/diff.c @@ -73,6 +73,9 @@ wrap_diff_file(const git_diff_file *file) if (py_file) { py_file->id = git_oid_to_python(&file->id); py_file->path = file->path != NULL ? strdup(file->path) : NULL; + py_file->size = file->size; + py_file->flags = file->flags; + py_file->mode = file->mode; } return (PyObject *) py_file; @@ -169,6 +172,9 @@ DiffFile_dealloc(DiffFile *self) PyMemberDef DiffFile_members[] = { MEMBER(DiffFile, id, T_OBJECT, "Oid of the item."), MEMBER(DiffFile, path, T_STRING, "Path to the entry."), + MEMBER(DiffFile, size, T_LONG, "Size of the entry."), + MEMBER(DiffFile, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."), + MEMBER(DiffFile, mode, T_USHORT, "Mode of the entry."), {NULL} }; diff --git a/src/pygit2.c b/src/pygit2.c index f116725..db3497d 100644 --- a/src/pygit2.c +++ b/src/pygit2.c @@ -341,6 +341,11 @@ moduleinit(PyObject* m) /* --break-rewrites=/M */ ADD_CONSTANT_INT(m, GIT_DIFF_FIND_AND_BREAK_REWRITES) + /* DiffFile.flags */ + ADD_CONSTANT_INT(m, GIT_DIFF_FLAG_BINARY) + ADD_CONSTANT_INT(m, GIT_DIFF_FLAG_NOT_BINARY) + ADD_CONSTANT_INT(m, GIT_DIFF_FLAG_VALID_ID) + /* Config */ ADD_CONSTANT_INT(m, GIT_CONFIG_LEVEL_LOCAL); ADD_CONSTANT_INT(m, GIT_CONFIG_LEVEL_GLOBAL); diff --git a/src/types.h b/src/types.h index 848cf8d..51305f8 100644 --- a/src/types.h +++ b/src/types.h @@ -118,6 +118,9 @@ typedef struct { PyObject_HEAD PyObject *id; char *path; + git_off_t size; + uint32_t flags; + uint16_t mode; } DiffFile; typedef struct {