Add a default value for "stage" (0) in Index.add

This commit is contained in:
David Versmisse
2011-02-11 12:12:49 +01:00
parent 83a78dac5f
commit cde5b8b614
2 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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)