Repository.create_commit, make encoding optional

This commit is contained in:
J. David Ibáñez 2011-11-19 09:37:45 +01:00
parent 1eb0c6a9f0
commit ce41de9417
2 changed files with 8 additions and 8 deletions

@ -652,7 +652,7 @@ Repository_create_commit(Repository *self, PyObject *args)
PyObject *py_oid, *py_message, *py_parents, *py_parent;
PyObject *py_result = NULL;
git_signature *author = NULL, *committer = NULL;
char *message, *update_ref, *encoding;
char *message, *update_ref, *encoding = NULL;
git_oid oid;
git_tree *tree = NULL;
int parent_count;
@ -660,14 +660,14 @@ Repository_create_commit(Repository *self, PyObject *args)
int err = 0, i = 0;
size_t len;
if (!PyArg_ParseTuple(args, "zO!O!zOOO!",
if (!PyArg_ParseTuple(args, "zO!O!OOO!|s",
&update_ref,
&PyTuple_Type, &py_author,
&PyTuple_Type, &py_committer,
&encoding,
&py_message,
&py_oid,
&PyList_Type, &py_parents))
&PyList_Type, &py_parents,
&encoding))
return NULL;
author = py_signature_to_git_signature(py_author, encoding);

@ -75,9 +75,9 @@ class CommitTest(utils.BareRepoTestCase):
parents = [COMMIT_SHA[:5]]
self.assertRaises(ValueError, repo.create_commit, None, author,
committer, None, message, too_short_prefix, parents)
committer, message, too_short_prefix, parents)
sha = repo.create_commit(None, author, committer, None, message,
sha = repo.create_commit(None, author, committer, message,
tree_prefix, parents)
commit = repo[sha]
@ -102,8 +102,8 @@ class CommitTest(utils.BareRepoTestCase):
tree_prefix = tree[:5]
parents = [COMMIT_SHA[:5]]
sha = repo.create_commit(None, author, committer, 'iso-8859-1',
message, tree_prefix, parents)
sha = repo.create_commit(None, author, committer, message,
tree_prefix, parents, 'iso-8859-1')
commit = repo[sha]
self.assertEqual(GIT_OBJ_COMMIT, commit.type)