Skip to content

Commit

Permalink
add repository member for cleaning up open file handles
Browse files Browse the repository at this point in the history
  • Loading branch information
bobcarroll committed Oct 13, 2017
1 parent 62c70e8 commit 43c8a8d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,20 @@ Repository_reset(Repository *self, PyObject* args)
Py_RETURN_NONE;
}

PyDoc_STRVAR(Repository_free__doc__,
"free()\n"
"\n"
"Releases handles to the Git database without deallocating the repository.\n");

PyObject *
Repository_free(Repository *self)
{
if (self->owned)
git_repository__cleanup(self->repo);

Py_RETURN_NONE;
}

PyDoc_STRVAR(Repository_expand_id__doc__,
"expand_id(hex) -> Oid\n"
"\n"
Expand Down Expand Up @@ -1863,6 +1877,7 @@ PyMethodDef Repository_methods[] = {
METHOD(Repository, listall_branches, METH_VARARGS),
METHOD(Repository, create_branch, METH_VARARGS),
METHOD(Repository, reset, METH_VARARGS),
METHOD(Repository, free, METH_NOARGS),
METHOD(Repository, expand_id, METH_O),
METHOD(Repository, _from_c, METH_VARARGS),
METHOD(Repository, _disown, METH_NOARGS),
Expand Down

0 comments on commit 43c8a8d

Please sign in to comment.