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