Index: adjust to index_read() force flag

This commit is contained in:
Carlos Martín Nieto
2013-11-05 19:38:01 +01:00
parent 12ea3d2dda
commit 4c47eba8c6
2 changed files with 14 additions and 7 deletions

View File

@@ -222,17 +222,24 @@ Index__find(Index *self, PyObject *py_path)
PyDoc_STRVAR(Index_read__doc__,
"read()\n"
"read(force=True)\n"
"\n"
"Update the contents of an existing index object in memory by reading from\n"
"the hard disk.");
"the hard disk."
"Arguments:\n"
"\n"
"force: if True (the default) allways reload. If False, only if the file has changed"
);
PyObject *
Index_read(Index *self)
Index_read(Index *self, PyObject *args)
{
int err;
int err, force = 1;
err = git_index_read(self->index);
if (!PyArg_ParseTuple(args, "|i", &force))
return NULL;
err = git_index_read(self->index, force);
if (err < GIT_OK)
return Error_set(err);
@@ -427,7 +434,7 @@ PyMethodDef Index_methods[] = {
METHOD(Index, diff_to_workdir, METH_VARARGS),
METHOD(Index, diff_to_tree, METH_VARARGS),
METHOD(Index, _find, METH_O),
METHOD(Index, read, METH_NOARGS),
METHOD(Index, read, METH_VARARGS),
METHOD(Index, write, METH_NOARGS),
METHOD(Index, read_tree, METH_O),
METHOD(Index, write_tree, METH_NOARGS),

View File

@@ -35,7 +35,7 @@
PyObject* Index_add(Index *self, PyObject *args);
PyObject* Index_clear(Index *self);
PyObject* Index_find(Index *self, PyObject *py_path);
PyObject* Index_read(Index *self);
PyObject* Index_read(Index *self, PyObject *args);
PyObject* Index_write(Index *self);
PyObject* Index_iter(Index *self);
PyObject* Index_getitem(Index *self, PyObject *value);