Give access to the path of an index entry

This commit is contained in:
J. David Ibáñez
2011-03-07 17:06:42 +01:00
parent 29a754bf43
commit 2b84b37384

View File

@@ -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},
};