From 2b84b37384d442e184774a3eb8771eb7ead546af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Mon, 7 Mar 2011 17:06:42 +0100 Subject: [PATCH] Give access to the path of an index entry --- pygit2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pygit2.c b/pygit2.c index 23371e3..0852119 100644 --- a/pygit2.c +++ b/pygit2.c @@ -1741,6 +1741,11 @@ IndexEntry_dealloc(IndexEntry *self) { self->ob_type->tp_free((PyObject*)self); } +static PyObject * +IndexEntry_get_path(IndexEntry *self) { + return PyString_FromString(self->entry->path); +} + static PyObject * IndexEntry_get_sha(IndexEntry *self) { char hex[GIT_OID_HEXSZ]; @@ -1750,6 +1755,7 @@ IndexEntry_get_sha(IndexEntry *self) { } static PyGetSetDef IndexEntry_getseters[] = { + {"path", (getter)IndexEntry_get_path, NULL, "path", NULL}, {"sha", (getter)IndexEntry_get_sha, NULL, "hex SHA", NULL}, {NULL}, };