@@ -100,23 +100,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_blob_rawcontent, 0, 0, 0)
100100ZEND_END_ARG_INFO ()
101101
102102static PHP_METHOD (Blob , rawcontent ) {
103- zend_bool is_push ;
104-
103+ if (zend_parse_parameters_none () == FAILURE ) return ;
105104 GIT2_BLOB_FETCH ();
106105
107- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "b" , & is_push ) == FAILURE ) {
108- return ;
109- }
110-
111- // TODO handle callbacks
112- int res = git_blob_connect (intern -> blob , is_push ? GIT_DIRECTION_PUSH : GIT_DIRECTION_FETCH , NULL , NULL );
113-
114- if (res == 0 ) {
115- RETURN_TRUE ;
116- }
106+ const void * res = git_blob_rawcontent (intern -> blob );
107+ git_off_t len = git_blob_rawsize (intern -> blob );
117108
118- git2_throw_last_error ();
119- RETURN_FALSE ;
109+ RETURN_STRINGL ((const char * )res , len );
120110}
121111
122112void git2_blob_spawn (zval * * return_value , git_blob * blob TSRMLS_DC ) {
@@ -157,6 +147,7 @@ static void php_git2_blob_free_object(zend_object *object TSRMLS_DC) {
157147#define PHP_GIT2_BLOB_ME_P (_x ) PHP_ME(Blob, _x, arginfo_blob_##_x, ZEND_ACC_PUBLIC)
158148
159149static zend_function_entry git2_blob_methods [] = {
150+ PHP_ME (Blob , lookup_oid , arginfo_blob_lookup_oid , ZEND_ACC_PUBLIC |ZEND_ACC_STATIC )
160151// PHP_ME(Blob, create_fromworkdir, arginfo_blob_create_fromworkdir, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
161152// PHP_ME(Blob, create_fromdisk, arginfo_blob_create_fromdisk, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
162153 PHP_GIT2_BLOB_ME_P (id )
0 commit comments