Index: make the file optional

There is no obligation for an index to exist as a file at all.
This commit is contained in:
Carlos Martín Nieto
2014-05-27 18:10:06 +02:00
parent 97c0e476a3
commit f69a57a82a

View File

@@ -45,7 +45,7 @@ extern PyTypeObject RepositoryType;
int
Index_init(Index *self, PyObject *args, PyObject *kwds)
{
char *path;
char *path = NULL;
int err;
if (kwds && PyDict_Size(kwds) > 0) {
@@ -53,9 +53,10 @@ Index_init(Index *self, PyObject *args, PyObject *kwds)
return -1;
}
if (!PyArg_ParseTuple(args, "s", &path))
if (!PyArg_ParseTuple(args, "|s", &path))
return -1;
self->repo = NULL;
err = git_index_open(&self->index, path);
if (err < 0) {
Error_set_str(err, path);