From cde5b8b614636a633d7528812408423b8df4db87 Mon Sep 17 00:00:00 2001 From: David Versmisse Date: Fri, 11 Feb 2011 12:12:49 +0100 Subject: [PATCH] Add a default value for "stage" (0) in Index.add --- pygit2.c | 4 ++-- test/test_index.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pygit2.c b/pygit2.c index fa1a17e..26b9faa 100644 --- a/pygit2.c +++ b/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); diff --git a/test/test_index.py b/test/test_index.py index 8dee69d..bf7bf81 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), 2) self.assertEqual(index['bye.txt'].sha, sha)