diff --git a/pygit2.c b/pygit2.c index b6f01f3..d9a02d7 100644 --- a/pygit2.c +++ b/pygit2.c @@ -1498,9 +1498,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); diff --git a/test/test_index.py b/test/test_index.py index 19a41da..13a1cc1 100644 --- a/test/test_index.py +++ b/test/test_index.py @@ -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), 3) self.assertEqual(index['bye.txt'].sha, sha)