Merge remote-tracking branch 'xtao/blob'
This commit is contained in:
commit
ff7ed95f29
12
src/blob.c
12
src/blob.c
@ -41,12 +41,24 @@ Blob_size__get__(Blob *self)
|
||||
}
|
||||
|
||||
|
||||
PyDoc_STRVAR(Blob_binary__doc__, "Binary.");
|
||||
|
||||
PyObject *
|
||||
Blob_binary__get__(Blob *self)
|
||||
{
|
||||
if (git_blob_is_binary(self->blob))
|
||||
Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PyDoc_STRVAR(Blob_data__doc__,
|
||||
"The contents of the blob, a bytes string. This is the same as\n"
|
||||
"Blob.read_raw()");
|
||||
|
||||
PyGetSetDef Blob_getseters[] = {
|
||||
GETTER(Blob, size),
|
||||
GETTER(Blob, binary),
|
||||
{"data", (getter)Object_read_raw, NULL, Blob_data__doc__, NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
@ -53,6 +53,7 @@ class BlobTest(utils.RepoTestCase):
|
||||
sha = blob.oid.hex
|
||||
self.assertEqual(sha, BLOB_SHA)
|
||||
self.assertTrue(isinstance(blob, pygit2.Blob))
|
||||
self.assertFalse(blob.binary)
|
||||
self.assertEqual(pygit2.GIT_OBJ_BLOB, blob.type)
|
||||
self.assertEqual(BLOB_CONTENT, blob.data)
|
||||
self.assertEqual(len(BLOB_CONTENT), blob.size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user