Index: adjust to index_read() force flag
This commit is contained in:
19
src/index.c
19
src/index.c
@@ -222,17 +222,24 @@ Index__find(Index *self, PyObject *py_path)
|
|||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(Index_read__doc__,
|
PyDoc_STRVAR(Index_read__doc__,
|
||||||
"read()\n"
|
"read(force=True)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Update the contents of an existing index object in memory by reading from\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 *
|
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)
|
if (err < GIT_OK)
|
||||||
return Error_set(err);
|
return Error_set(err);
|
||||||
|
|
||||||
@@ -427,7 +434,7 @@ PyMethodDef Index_methods[] = {
|
|||||||
METHOD(Index, diff_to_workdir, METH_VARARGS),
|
METHOD(Index, diff_to_workdir, METH_VARARGS),
|
||||||
METHOD(Index, diff_to_tree, METH_VARARGS),
|
METHOD(Index, diff_to_tree, METH_VARARGS),
|
||||||
METHOD(Index, _find, METH_O),
|
METHOD(Index, _find, METH_O),
|
||||||
METHOD(Index, read, METH_NOARGS),
|
METHOD(Index, read, METH_VARARGS),
|
||||||
METHOD(Index, write, METH_NOARGS),
|
METHOD(Index, write, METH_NOARGS),
|
||||||
METHOD(Index, read_tree, METH_O),
|
METHOD(Index, read_tree, METH_O),
|
||||||
METHOD(Index, write_tree, METH_NOARGS),
|
METHOD(Index, write_tree, METH_NOARGS),
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
PyObject* Index_add(Index *self, PyObject *args);
|
PyObject* Index_add(Index *self, PyObject *args);
|
||||||
PyObject* Index_clear(Index *self);
|
PyObject* Index_clear(Index *self);
|
||||||
PyObject* Index_find(Index *self, PyObject *py_path);
|
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_write(Index *self);
|
||||||
PyObject* Index_iter(Index *self);
|
PyObject* Index_iter(Index *self);
|
||||||
PyObject* Index_getitem(Index *self, PyObject *value);
|
PyObject* Index_getitem(Index *self, PyObject *value);
|
||||||
|
Reference in New Issue
Block a user