Index: make the file optional
There is no obligation for an index to exist as a file at all.
This commit is contained in:
@@ -45,7 +45,7 @@ extern PyTypeObject RepositoryType;
|
|||||||
int
|
int
|
||||||
Index_init(Index *self, PyObject *args, PyObject *kwds)
|
Index_init(Index *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (kwds && PyDict_Size(kwds) > 0) {
|
if (kwds && PyDict_Size(kwds) > 0) {
|
||||||
@@ -53,9 +53,10 @@ Index_init(Index *self, PyObject *args, PyObject *kwds)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s", &path))
|
if (!PyArg_ParseTuple(args, "|s", &path))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
self->repo = NULL;
|
||||||
err = git_index_open(&self->index, path);
|
err = git_index_open(&self->index, path);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
Error_set_str(err, path);
|
Error_set_str(err, path);
|
||||||
|
Reference in New Issue
Block a user