Commit.parents now returns a list of oids
Instead of returning the commit objects.
This commit is contained in:
parent
4b0f759cc0
commit
1fb34e7b96
8
pygit2.c
8
pygit2.c
@ -262,12 +262,6 @@ lookup_object_prefix(Repository *repo, const git_oid *oid, size_t len,
|
|||||||
return (PyObject*)py_obj;
|
return (PyObject*)py_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
lookup_object(Repository *repo, const git_oid *oid, git_otype type)
|
|
||||||
{
|
|
||||||
return lookup_object_prefix(repo, oid, GIT_OID_HEXSZ, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
static git_otype
|
static git_otype
|
||||||
int_to_loose_object_type(int type_id)
|
int_to_loose_object_type(int type_id)
|
||||||
{
|
{
|
||||||
@ -1254,7 +1248,7 @@ Commit_get_parents(Commit *commit)
|
|||||||
Error_set(GIT_ENOTFOUND);
|
Error_set(GIT_ENOTFOUND);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
obj = lookup_object(commit->repo, parent_oid, GIT_OBJ_COMMIT);
|
obj = git_oid_to_python(parent_oid);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
Py_DECREF(list);
|
Py_DECREF(list);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -48,7 +48,7 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
parents = commit.parents
|
parents = commit.parents
|
||||||
self.assertEqual(1, len(parents))
|
self.assertEqual(1, len(parents))
|
||||||
self.assertEqual('c2792cfa289ae6321ecf2cd5806c2194b0fd070c',
|
self.assertEqual('c2792cfa289ae6321ecf2cd5806c2194b0fd070c',
|
||||||
parents[0].hex)
|
utils.oid_to_hex(parents[0]))
|
||||||
self.assertEqual(None, commit.message_encoding)
|
self.assertEqual(None, commit.message_encoding)
|
||||||
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'),
|
||||||
@ -93,7 +93,7 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
self.assertEqualSignature(author, commit.author)
|
self.assertEqualSignature(author, commit.author)
|
||||||
self.assertEqual(tree, commit.tree.hex)
|
self.assertEqual(tree, commit.tree.hex)
|
||||||
self.assertEqual(1, len(commit.parents))
|
self.assertEqual(1, len(commit.parents))
|
||||||
self.assertEqual(COMMIT_SHA, commit.parents[0].hex)
|
self.assertEqual(COMMIT_SHA, utils.oid_to_hex(commit.parents[0]))
|
||||||
|
|
||||||
def test_new_commit_encoding(self):
|
def test_new_commit_encoding(self):
|
||||||
repo = self.repo
|
repo = self.repo
|
||||||
@ -119,7 +119,7 @@ class CommitTest(utils.BareRepoTestCase):
|
|||||||
self.assertEqualSignature(author, commit.author)
|
self.assertEqualSignature(author, commit.author)
|
||||||
self.assertEqual(tree, commit.tree.hex)
|
self.assertEqual(tree, commit.tree.hex)
|
||||||
self.assertEqual(1, len(commit.parents))
|
self.assertEqual(1, len(commit.parents))
|
||||||
self.assertEqual(COMMIT_SHA, commit.parents[0].hex)
|
self.assertEqual(COMMIT_SHA, utils.oid_to_hex(commit.parents[0]))
|
||||||
|
|
||||||
def test_modify_commit(self):
|
def test_modify_commit(self):
|
||||||
message = 'New commit.\n\nMessage.\n'
|
message = 'New commit.\n\nMessage.\n'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user