Update to latest changes in libgit2
Commit.message_short removed, Commit.message_encoding added
This commit is contained in:
parent
7b8ae0e10c
commit
b634a19bd4
16
pygit2.c
16
pygit2.c
@ -613,7 +613,7 @@ Repository_create_commit(Repository *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = git_commit_create(&oid, self->repo, update_ref, author, committer,
|
err = git_commit_create(&oid, self->repo, update_ref, author, committer,
|
||||||
message, tree, parent_count, (const git_commit**)parents);
|
NULL, message, tree, parent_count, (const git_commit**)parents);
|
||||||
git_tree_close(tree);
|
git_tree_close(tree);
|
||||||
free_parents(parents, parent_count);
|
free_parents(parents, parent_count);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@ -1012,9 +1012,15 @@ static PyTypeObject ObjectType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
Commit_get_message_short(Commit *commit)
|
Commit_get_message_encoding(Commit *commit)
|
||||||
{
|
{
|
||||||
return PyString_FromString(git_commit_message_short(commit->commit));
|
char *encoding;
|
||||||
|
|
||||||
|
encoding = git_commit_message_encoding(commit->commit);
|
||||||
|
if (encoding == NULL)
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
|
return PyString_FromString(encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@ -1100,8 +1106,8 @@ Commit_get_parents(Commit *commit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyGetSetDef Commit_getseters[] = {
|
static PyGetSetDef Commit_getseters[] = {
|
||||||
{"message_short", (getter)Commit_get_message_short, NULL, "short message",
|
{"message_encoding", (getter)Commit_get_message_encoding, NULL,
|
||||||
NULL},
|
"message encoding", NULL},
|
||||||
{"message", (getter)Commit_get_message, NULL, "message", NULL},
|
{"message", (getter)Commit_get_message, NULL, "message", NULL},
|
||||||
{"commit_time", (getter)Commit_get_commit_time, NULL, "commit time",
|
{"commit_time", (getter)Commit_get_commit_time, NULL, "commit time",
|
||||||
NULL},
|
NULL},
|
||||||
|
@ -46,7 +46,8 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
self.assertEqual(1, len(parents))
|
self.assertEqual(1, len(parents))
|
||||||
self.assertEqual('c2792cfa289ae6321ecf2cd5806c2194b0fd070c',
|
self.assertEqual('c2792cfa289ae6321ecf2cd5806c2194b0fd070c',
|
||||||
parents[0].sha)
|
parents[0].sha)
|
||||||
self.assertEqual('Second test data commit.', commit.message_short)
|
self.assertEqual(None, commit.message_encoding)
|
||||||
|
#self.assertEqual('Second test data commit.', commit.message_short)
|
||||||
self.assertEqual(('Second test data commit.\n\n'
|
self.assertEqual(('Second test data commit.\n\n'
|
||||||
'This commit has some additional text.\n'),
|
'This commit has some additional text.\n'),
|
||||||
commit.message)
|
commit.message)
|
||||||
@ -76,8 +77,9 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
self.assertEqual(GIT_OBJ_COMMIT, commit.type)
|
self.assertEqual(GIT_OBJ_COMMIT, commit.type)
|
||||||
self.assertEqual('30bb126a4959290987fc07ea49f92be276dce9d6',
|
self.assertEqual('30bb126a4959290987fc07ea49f92be276dce9d6',
|
||||||
commit.sha)
|
commit.sha)
|
||||||
|
self.assertEqual(None, commit.message_encoding)
|
||||||
self.assertEqual(message, commit.message)
|
self.assertEqual(message, commit.message)
|
||||||
self.assertEqual('New commit.', commit.message_short)
|
#self.assertEqual('New commit.', commit.message_short)
|
||||||
self.assertEqual(12346, commit.commit_time)
|
self.assertEqual(12346, commit.commit_time)
|
||||||
self.assertEqual(committer, commit.committer)
|
self.assertEqual(committer, commit.committer)
|
||||||
self.assertEqual(author, commit.author)
|
self.assertEqual(author, commit.author)
|
||||||
|
@ -52,7 +52,7 @@ class TagTest(utils.BareRepoTestCase):
|
|||||||
|
|
||||||
commit = tag.target
|
commit = tag.target
|
||||||
del tag
|
del tag
|
||||||
self.assertEqual('Initial test data commit.', commit.message_short)
|
self.assertEqual('Initial test data commit.\n', commit.message)
|
||||||
|
|
||||||
def test_new_tag(self):
|
def test_new_tag(self):
|
||||||
name = 'thetag'
|
name = 'thetag'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user