Repository.create_commit, make encoding optional
This commit is contained in:
parent
1eb0c6a9f0
commit
ce41de9417
8
pygit2.c
8
pygit2.c
@ -652,7 +652,7 @@ Repository_create_commit(Repository *self, PyObject *args)
|
|||||||
PyObject *py_oid, *py_message, *py_parents, *py_parent;
|
PyObject *py_oid, *py_message, *py_parents, *py_parent;
|
||||||
PyObject *py_result = NULL;
|
PyObject *py_result = NULL;
|
||||||
git_signature *author = NULL, *committer = NULL;
|
git_signature *author = NULL, *committer = NULL;
|
||||||
char *message, *update_ref, *encoding;
|
char *message, *update_ref, *encoding = NULL;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_tree *tree = NULL;
|
git_tree *tree = NULL;
|
||||||
int parent_count;
|
int parent_count;
|
||||||
@ -660,14 +660,14 @@ Repository_create_commit(Repository *self, PyObject *args)
|
|||||||
int err = 0, i = 0;
|
int err = 0, i = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "zO!O!zOOO!",
|
if (!PyArg_ParseTuple(args, "zO!O!OOO!|s",
|
||||||
&update_ref,
|
&update_ref,
|
||||||
&PyTuple_Type, &py_author,
|
&PyTuple_Type, &py_author,
|
||||||
&PyTuple_Type, &py_committer,
|
&PyTuple_Type, &py_committer,
|
||||||
&encoding,
|
|
||||||
&py_message,
|
&py_message,
|
||||||
&py_oid,
|
&py_oid,
|
||||||
&PyList_Type, &py_parents))
|
&PyList_Type, &py_parents,
|
||||||
|
&encoding))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
author = py_signature_to_git_signature(py_author, encoding);
|
author = py_signature_to_git_signature(py_author, encoding);
|
||||||
|
@ -75,9 +75,9 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
|
|
||||||
parents = [COMMIT_SHA[:5]]
|
parents = [COMMIT_SHA[:5]]
|
||||||
self.assertRaises(ValueError, repo.create_commit, None, author,
|
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)
|
tree_prefix, parents)
|
||||||
commit = repo[sha]
|
commit = repo[sha]
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
tree_prefix = tree[:5]
|
tree_prefix = tree[:5]
|
||||||
|
|
||||||
parents = [COMMIT_SHA[:5]]
|
parents = [COMMIT_SHA[:5]]
|
||||||
sha = repo.create_commit(None, author, committer, 'iso-8859-1',
|
sha = repo.create_commit(None, author, committer, message,
|
||||||
message, tree_prefix, parents)
|
tree_prefix, parents, 'iso-8859-1')
|
||||||
commit = repo[sha]
|
commit = repo[sha]
|
||||||
|
|
||||||
self.assertEqual(GIT_OBJ_COMMIT, commit.type)
|
self.assertEqual(GIT_OBJ_COMMIT, commit.type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user