Add a default value for "stage" (0) in Index.add
This commit is contained in:
4
pygit2.c
4
pygit2.c
@@ -1322,9 +1322,9 @@ static PyObject *
|
||||
Index_add(Index *self, PyObject *args) {
|
||||
int err;
|
||||
const char *path;
|
||||
int stage;
|
||||
int stage=0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si", &path, &stage))
|
||||
if (!PyArg_ParseTuple(args, "s|i", &path, &stage))
|
||||
return NULL;
|
||||
|
||||
err = git_index_add(self->index, path, stage);
|
||||
|
@@ -67,7 +67,7 @@ class IndexTest(utils.RepoTestCase):
|
||||
|
||||
sha = '0907563af06c7464d62a70cdd135a6ba7d2b41d8'
|
||||
self.assertFalse('bye.txt' in index)
|
||||
index.add('bye.txt', 0)
|
||||
index.add('bye.txt')
|
||||
self.assertTrue('bye.txt' in index)
|
||||
self.assertEqual(len(index), 2)
|
||||
self.assertEqual(index['bye.txt'].sha, sha)
|
||||
|
Reference in New Issue
Block a user