diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000000..48b1da6a7a --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: e70a3555cf7d2312c3f89bf65fd10495 +tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e59d6338c1..0000000000 --- a/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -*.o - -# ignore temporary files -tmp/* - -# ignore tests -tests/*/*.php -tests/*/*.sh -tests/*/*.log -tests/*/*.diff -tests/*/*.exp -tests/*/*.out - -# ignore phpized files -Makefile.global -acinclude.m4 -aclocal.m4 -autom4te.cache -build -config.* -configure -configure* -install-sh -iltmain.sh -missing -mkinstalldirs -run-tests.php -*.lo -.deps -.libs -libtool -Makefile* -modules -ltmain.sh -*.la -tmp-php.ini -php_test_results* diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index bbf4f9db34..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "libgit2"] - path = libgit2 - url = https://github.com/libgit2/libgit2.git - ignore = dirty diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bfe6af5ccf..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -php: - - 5.3 - - 5.4 - - 5.5 - -install: - - sudo apt-get -qq update - - sudo apt-get -qq install cmake libssh2-1-dev openssh-client openssh-server - -script: - - script/cibuild.sh - -notifications: - irc: - channels: - - irc.freenode.net#php-git - on_success: change - on_failure: always - use_notice: true - skip_join: true - slack: - on_success: always - on_failure: always - secure: KH9+7GLccFrGWe+E6RhSqHxh+w5DIdsVxn41Iqb2C8rfm5rrnK0KVDTWJXk2BDHc2B1ab28o6m/Vcd8C/lgURd7yx4QfUASQRrHEn4FfpsB7UgES+/aENb59ma3DVz5PqVDUSVSvABU9OCqEkLmN/9w2mL/q3rW4slUq4LzMweI= diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a68c9c890c..0000000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2010 - 2012 Shuhei Tanuma - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 175ec8fcc2..0000000000 --- a/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# PHP-Git2 - libgit2 bindings in PHP - -php-git2 is a PHP bindings to the libgit2 linkable C Git library. - -* API Documentation: http://libgit2.github.com/libgit2/#v0.20.0 (also see Signature conversions section) -* IRC: #php-git on irc.freenode.net. - -## Requirements - -PHP 5.3 above - -## Status - -0.3.0 Alpha (switching to functions) - -https://docs.google.com/spreadsheet/ccc?key=0AjvShWAWqvfHdDRneEtIUF9GRUZMNVVVR1hpdURiUWc&usp=sharing - -## How to build - -``` -# build libgit2.a -## For 32bit systems -git submodule init && git submodule update -mkdir libgit2/build -cd libgit2/build -cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF .. -cmake --build . - -# For 64bit systems -git submodule init && git submodule update -mkdir libgit2/build -cd libgit2/build -cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF --DCMAKE_C_FLAGS=-fPIC .. -cmake --build . - - -# build php-git2 -cd ../../ -phpize -./configure --enable-git2-debug -make -make install -# add extension=git2.so to your php.ini -``` - -## For Contributors - -##### Issue first. - -please make a issue first. don't work before creating it. - -##### Coding Styles - -follow pecl coding standards (except 8 at this moment). - -* http://git.php.net/?p=php-src.git;a=blob_plain;f=CODING_STANDARDS;hb=HEAD - -##### Signature conversions - -```` -GIT_EXTERN(int) git_repository_init( - git_repository **out, - const char *path, - unsigned is_bare); - - -// error code should handle in extension. -// resource creation or getting functions will return their resource or bool. -resource|bool function git_repository_init(string $path, long $is_bare); - -public struct (e.g: git_config_entry) should consider return as an array. -```` - -##### file name rules. - -basically, we rely libgit2 grouping at this time. (`branch` group functions should be in branch.c) -some group (e.g config) will conflicts php header files. we choose `g_` prefix for now. - -check grouping here libgit2.github.com/libgit2/#v0.20.0 - -##### generating files - -if you wanna try to work new file. please use gen.php and generate stubs. as declarations are bored task. -(sometimes, this generator might output wrong headers. then just comment out or fix generator) - -```` -PRINT_HEADER=1 php ng.php libgit2/include/git2/branch.h > branch.h -php ng.php libgit2/include/git2/branch.h > branch.c -```` - -you can generate `PHP_FE` with this. past it to `php_git2.c` - -```` -php fe.php target.c -```` - -Note: usually, these generators might output needless variables. DON'T PR `prettify codes` at this moment. -As we have more than 500 php functions. we like to use some fixer command than fix by hand. - -##### documents - -use prototype. - -``` - /* {{{ proto int abs(int number) - Returns the absolute value of the number */ - PHP_FUNCTION(abs) - { - ... - } - /* }}} */ -``` - -document will generate later. please check source code before publish docs. - -##### testing - -[group]/[function].phpt - -##### policy - -* don't create OOP interface in extension for ease of maintenance. -* follow latest libgit2 api. don't consider BC at this time. - -## LICENSE - -MIT License diff --git a/attr.c b/attr.c deleted file mode 100644 index fd894261f8..0000000000 --- a/attr.c +++ /dev/null @@ -1,138 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "attr.h" - -/* {{{ proto resource git_attr_value(string $attr) - */ -PHP_FUNCTION(git_attr_value) -{ - git_attr_t result; - char *attr = NULL; - int attr_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &attr, &attr_len) == FAILURE) { - return; - } - - result = git_attr_value(attr); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_attr_get(resource $repo, long $flags, string $path, string $name) - */ -PHP_FUNCTION(git_attr_get) -{ - php_git2_t *_repo = NULL; - char *value_out = NULL, *path = NULL, *name = NULL; - zval *repo = NULL; - long flags = 0; - int path_len = 0, name_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlss", &repo, &flags, &path, &path_len, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_attr_get(&value_out, PHP_GIT2_V(_repo, repository), flags, path, name); - if (php_git2_check_error(error, "git_attr_get" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(value_out, 1); -} -/* }}} */ - -/* {{{ proto resource git_attr_get_many(resource $repo, long $flags, string $path, long $num_attr, string $names) - */ -PHP_FUNCTION(git_attr_get_many) -{ - php_git2_t *_repo = NULL; - char *values_out = NULL, *path = NULL; - zval *repo = NULL, *names = NULL; - long flags = 0, num_attr = 0; - int path_len = 0, error = 0; - - /* TODO(chobie): write array to const char** conversion */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlsla", &repo, &flags, &path, &path_len, &num_attr, &names) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - /* TODO(chobie): emalloc values_out */ - error = git_attr_get_many(&values_out, PHP_GIT2_V(_repo, repository), flags, path, num_attr, names); - if (php_git2_check_error(error, "git_attr_get_many" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(values_out, 1); -} -/* }}} */ - -/* {{{ proto long git_attr_foreach(resource $repo, long $flags, string $path, Callable $callback, $payload) - */ -PHP_FUNCTION(git_attr_foreach) -{ - int result = 0, path_len = 0; - zval *repo = NULL, *payload = NULL; - php_git2_t *_repo = NULL; - long flags = 0; - char *path = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlsfz", &repo, &flags, &path, &path_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - // TODO(chobie): implement this - //result = git_attr_foreach(PHP_GIT2_V(_repo, repository), flags, path, , cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_attr_cache_flush(resource $repo) - */ -PHP_FUNCTION(git_attr_cache_flush) -{ - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_attr_cache_flush(PHP_GIT2_V(_repo, repository)); -} -/* }}} */ - -/* {{{ proto long git_attr_add_macro(resource $repo, string $name, string $values) - */ -PHP_FUNCTION(git_attr_add_macro) -{ - int result = 0, name_len = 0, values_len = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *name = NULL, *values = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &repo, &name, &name_len, &values, &values_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_attr_add_macro(PHP_GIT2_V(_repo, repository), name, values); - RETURN_LONG(result); -} -/* }}} */ - diff --git a/attr.h b/attr.h deleted file mode 100644 index 946906f974..0000000000 --- a/attr.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_ATTR_H -#define PHP_GIT2_ATTR_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_attr_value, 0, 0, 1) - ZEND_ARG_INFO(0, attr) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_attr_get, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_attr_get_many, 0, 0, 5) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, num_attr) - ZEND_ARG_INFO(0, names) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_attr_foreach, 0, 0, 5) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_attr_cache_flush, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_attr_add_macro, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, values) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_attr_value(attr) -*/ -PHP_FUNCTION(git_attr_value); - -/* {{{ proto resource git_attr_get(repo, flags, path, name) -*/ -PHP_FUNCTION(git_attr_get); - -/* {{{ proto resource git_attr_get_many(repo, flags, path, num_attr, names) -*/ -PHP_FUNCTION(git_attr_get_many); - -/* {{{ proto long git_attr_foreach(repo, flags, path, callback, payload) -*/ -PHP_FUNCTION(git_attr_foreach); - -/* {{{ proto void git_attr_cache_flush(repo) -*/ -PHP_FUNCTION(git_attr_cache_flush); - -/* {{{ proto long git_attr_add_macro(repo, name, values) -*/ -PHP_FUNCTION(git_attr_add_macro); - -#endif \ No newline at end of file diff --git a/blame.c b/blame.c deleted file mode 100644 index 87035a6558..0000000000 --- a/blame.c +++ /dev/null @@ -1,258 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "blame.h" - -static void php_git2_array_to_git_blame_options(git_blame_options *options, zval *array TSRMLS_DC) -{ - zval *tmp; - - options->version = php_git2_read_arrval_long(array, ZEND_STRS("version") TSRMLS_CC); - options->flags = php_git2_read_arrval_long(array, ZEND_STRS("flags") TSRMLS_CC); - options->min_match_characters = php_git2_read_arrval_long(array, ZEND_STRS("min_match_characters") TSRMLS_CC); - tmp = php_git2_read_arrval(array, ZEND_STRS("newest_commit") TSRMLS_CC); - if (Z_TYPE_P(tmp) != NULL) { - if (Z_TYPE_P(tmp) != IS_STRING) { - convert_to_string(tmp); - } - if (git_oid_fromstrn(&options->newest_commit, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)) != GIT_OK) { - return; - } - } - - tmp = php_git2_read_arrval(array, ZEND_STRS("oldest_commit") TSRMLS_CC); - if (Z_TYPE_P(tmp) != NULL) { - if (Z_TYPE_P(tmp) != IS_STRING) { - convert_to_string(tmp); - } - if (git_oid_fromstrn(&options->newest_commit, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)) != GIT_OK) { - return; - } - } - - options->min_line = php_git2_read_arrval_long(array, ZEND_STRS("min_line") TSRMLS_CC); - options->max_line = php_git2_read_arrval_long(array, ZEND_STRS("max_line") TSRMLS_CC); - -} - -static void php_git2_git_blame_options_to_array(git_blame_options *options, zval **out TSRMLS_DC) -{ - zval *result = NULL; - char buf[41] = {0}; - - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("version"), options->version); - add_assoc_long_ex(result, ZEND_STRS("flags"), options->flags); - add_assoc_long_ex(result, ZEND_STRS("min_match_characters"), options->min_match_characters); - - if (git_oid_iszero(&options->newest_commit) != 1) { - git_oid_fmt(buf, &options->newest_commit); - add_assoc_string_ex(result, ZEND_STRS("newest_commit"), out, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("newest_commit")); - } - - if (git_oid_iszero(&options->oldest_commit) != 1) { - git_oid_fmt(buf, &options->oldest_commit); - add_assoc_string_ex(result, ZEND_STRS("oldest_commit"), out, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("oldest_commit")); - } - - add_assoc_long_ex(result, ZEND_STRS("min_line"), options->min_line); - add_assoc_long_ex(result, ZEND_STRS("max_line"), options->max_line); - *out = result; -} - -static void php_git2_git_blame_hunk_to_array(git_blame_hunk *hunk, zval **out TSRMLS_DC) -{ - zval *result = NULL, *final = NULL, *orig = NULL; - char buf[41] = {0}; - - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("lines_in_hunk"), hunk->lines_in_hunk); - - git_oid_fmt(buf, &hunk->final_commit_id); - add_assoc_string_ex(result, ZEND_STRS("final_commit_id"), buf, 1); - - php_git2_signature_to_array(hunk->final_signature, &final TSRMLS_CC); - add_assoc_zval_ex(result, ZEND_STRS("final_signature"), final); - - add_assoc_long_ex(result, ZEND_STRS("final_start_line_number"), hunk->final_start_line_number); - - git_oid_fmt(buf, &hunk->orig_commit_id); - add_assoc_string_ex(result, ZEND_STRS("orig_commit_id"), buf, 1); - add_assoc_string_ex(result, ZEND_STRS("orig_path"), hunk->orig_path, 1); - - add_assoc_long_ex(result, ZEND_STRS("orig_start_line_number"), hunk->orig_start_line_number); - if (hunk->orig_signature) { - php_git2_signature_to_array(hunk->orig_signature, &orig TSRMLS_CC); - } else { - MAKE_STD_ZVAL(orig); - ZVAL_NULL(orig); - } - add_assoc_zval_ex(result, ZEND_STRS("orig_signature"), orig); - - add_assoc_stringl_ex(result, ZEND_STRS("boundary"), &hunk->boundary, 1, 1); - - *out = result; -} - -/* {{{ proto long git_blame_get_hunk_count(resource $blame) - */ -PHP_FUNCTION(git_blame_get_hunk_count) -{ - uint32_t result = 0; - zval *blame = NULL; - php_git2_t *_blame = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blame) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blame, php_git2_t*, &blame, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_blame_get_hunk_count(PHP_GIT2_V(_blame, blame)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_blame_get_hunk_byindex(resource $blame, long $index) - */ -PHP_FUNCTION(git_blame_get_hunk_byindex) -{ - const git_blame_hunk *result = NULL; - zval *blame = NULL, *array = NULL; - php_git2_t *_blame = NULL; - long index = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &blame, &index) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blame, php_git2_t*, &blame, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_blame_get_hunk_byindex(PHP_GIT2_V(_blame, blame), index); - if (result == NULL) { - RETURN_FALSE; - } - php_git2_git_blame_hunk_to_array(result, &array TSRMLS_CC); - RETURN_ZVAL(array, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_blame_get_hunk_byline(resource $blame, long $lineno) - */ -PHP_FUNCTION(git_blame_get_hunk_byline) -{ - const git_blame_hunk *result = NULL; - zval *blame = NULL, *array = NULL; - php_git2_t *_blame = NULL; - long lineno = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &blame, &lineno) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blame, php_git2_t*, &blame, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_blame_get_hunk_byline(PHP_GIT2_V(_blame, blame), lineno); - if (result == NULL) { - RETURN_FALSE; - } - php_git2_git_blame_hunk_to_array(result, &array TSRMLS_CC); - RETURN_ZVAL(array, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_blame_file(resource $repo, string $path, $options) - */ -PHP_FUNCTION(git_blame_file) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_blame *out = NULL; - zval *repo = NULL, *options = NULL; - git_blame_options opts = GIT_BLAME_OPTIONS_INIT; - char *path = NULL; - int path_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsa", &repo, &path, &path_len, &options) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_blame_options(&opts, options TSRMLS_CC); - error = git_blame_file(&out, PHP_GIT2_V(_repo, repository), path, &opts); - if (php_git2_check_error(error, "git_blame_file" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_BLAME, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_blame_buffer(resource $reference, string $buffer) - */ -PHP_FUNCTION(git_blame_buffer) -{ - php_git2_t *result = NULL, *_reference = NULL; - git_blame *out = NULL; - zval *reference = NULL; - char *buffer = NULL; - int buffer_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &reference, &buffer, &buffer_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reference, php_git2_t*, &reference, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_blame_buffer(&out, PHP_GIT2_V(_reference, blame), buffer, buffer_len); - if (php_git2_check_error(error, "git_blame_buffer" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_BLAME, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_blame_free(resource $blame) - */ -PHP_FUNCTION(git_blame_free) -{ - zval *blame = NULL; - php_git2_t *_blame = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blame) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blame, php_git2_t*, &blame, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_blame)) { - git_blame_free(PHP_GIT2_V(_blame, blame)); - GIT2_SHOULD_FREE(_blame) = 0; - }; - zval_ptr_dtor(&blame); -} -/* }}} */ - -/* {{{ proto void git_blame_options_new() - */ -PHP_FUNCTION(git_blame_options_new) -{ - zval *result; - git_blame_options options = GIT_BLAME_OPTIONS_INIT; - - php_git2_git_blame_options_to_array(&options, &result TSRMLS_CC); - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ diff --git a/blame.h b/blame.h deleted file mode 100644 index 44fd4761b5..0000000000 --- a/blame.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_BLAME_H -#define PHP_GIT2_BLAME_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_get_hunk_count, 0, 0, 1) - ZEND_ARG_INFO(0, blame) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_get_hunk_byindex, 0, 0, 2) - ZEND_ARG_INFO(0, blame) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_get_hunk_byline, 0, 0, 2) - ZEND_ARG_INFO(0, blame) - ZEND_ARG_INFO(0, lineno) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_file, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_buffer, 0, 0, 3) - ZEND_ARG_INFO(0, reference) - ZEND_ARG_INFO(0, buffer) - ZEND_ARG_INFO(0, buffer_len) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_free, 0, 0, 1) - ZEND_ARG_INFO(0, blame) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blame_options_new, 0, 0, 0) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_blame_get_hunk_count(blame) -*/ -PHP_FUNCTION(git_blame_get_hunk_count); - -/* {{{ proto resource git_blame_get_hunk_byindex(blame, index) -*/ -PHP_FUNCTION(git_blame_get_hunk_byindex); - -/* {{{ proto resource git_blame_get_hunk_byline(blame, lineno) -*/ -PHP_FUNCTION(git_blame_get_hunk_byline); - -/* {{{ proto resource git_blame_file(repo, path, options) -*/ -PHP_FUNCTION(git_blame_file); - -/* {{{ proto resource git_blame_buffer(reference, buffer, buffer_len) -*/ -PHP_FUNCTION(git_blame_buffer); - -/* {{{ proto void git_blame_free(blame) -*/ -PHP_FUNCTION(git_blame_free); - -/* {{{ proto void git_blame_options_new() - */ -PHP_FUNCTION(git_blame_options_new); - -#endif \ No newline at end of file diff --git a/blob.c b/blob.c deleted file mode 100644 index dd3bb5ba25..0000000000 --- a/blob.c +++ /dev/null @@ -1,338 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "blob.h" - -/* {{{ proto resource git_blob_create_frombuffer(resource $repository, string $buffer) -*/ -PHP_FUNCTION(git_blob_create_frombuffer) -{ - zval *repository; - php_git2_t *git2; - char *buffer; - int buffer_len; - int error; - git_oid id; - char out[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repository, &buffer, &buffer_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &repository, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_blob_create_frombuffer(&id, PHP_GIT2_V(git2, repository), buffer, buffer_len); - if (php_git2_check_error(error, "git_blob_create_frombuffer" TSRMLS_CC)) { - RETURN_FALSE - } - - git_oid_fmt(out, &id); - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto long git_blob_create_fromchunks(string $id, resource $repo, string $hintpath, Callable $callback, $payload) - */ -PHP_FUNCTION(git_blob_create_fromchunks) -{ - int result = 0, id_len = 0, hintpath_len = 0; - char *id = NULL, *hintpath = NULL; - git_oid __id = {0}; - zval *repo = NULL, *payload = NULL; - php_git2_t *_repo = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "srsfz", &id, &id_len, &repo, &hintpath, &hintpath_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - // TODO(chobie) implement this */ - //result = git_blob_create_fromchunks(__id, PHP_GIT2_V(_repo, repository), hintpath, , cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_blob_create_fromdisk(resource $repository, string $path) -*/ -PHP_FUNCTION(git_blob_create_fromdisk) -{ - zval *repository; - php_git2_t *git2; - char *path; - int path_len; - int error; - git_oid id; - char out[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repository, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &repository, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_blob_create_fromdisk(&id, PHP_GIT2_V(git2, repository), path); - if (php_git2_check_error(error, "git_blob_create_fromdisk" TSRMLS_CC)) { - RETURN_FALSE - } - - git_oid_fmt(out, &id); - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto resource git_blob_create_fromworkdir(resource $repository, string $relative_path) -*/ -PHP_FUNCTION(git_blob_create_fromworkdir) -{ - zval *repository; - php_git2_t *git2; - char *path; - int path_len; - int error; - git_oid id; - char out[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repository, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &repository, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_blob_create_fromworkdir(&id, PHP_GIT2_V(git2, repository), path); - if (php_git2_check_error(error, "git_blob_create_fromdisk" TSRMLS_CC)) { - RETURN_FALSE - } - - git_oid_fmt(out, &id); - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto resource git_blob_filtered_content(resource $blob, string $as_path, long $check_for_binary_data) - */ -PHP_FUNCTION(git_blob_filtered_content) -{ - php_git2_t *result = NULL, *_blob = NULL; - git_buf out = {0}; - zval *blob = NULL; - char *as_path = NULL; - int as_path_len = 0, error = 0; - long check_for_binary_data = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &blob, &as_path, &as_path_len, &check_for_binary_data) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blob, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_blob_filtered_content(&out, PHP_GIT2_V(_blob, blob), as_path, check_for_binary_data); - if (php_git2_check_error(error, "git_blob_filtered_content" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_BUF, &out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_blob_free(resource $blob) - */ -PHP_FUNCTION(git_blob_free) -{ - zval *blob = NULL; - php_git2_t *_blob = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blob, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_blob)) { - git_blob_free(PHP_GIT2_V(_blob, blob)); - GIT2_SHOULD_FREE(_blob) = 0; - }; - zval_ptr_dtor(&blob); -} -/* }}} */ - -/* {{{ proto resource git_blob_id(resource $blob) -*/ -PHP_FUNCTION(git_blob_id) -{ - zval *blob; - php_git2_t *git2; - char out[GIT2_OID_HEXSIZE] = {0}; - const git_oid *id; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - id = git_blob_id(PHP_GIT2_V(git2, blob)); - - git_oid_fmt(out, id); - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto resource git_blob_is_binary(resource $blob) -*/ -PHP_FUNCTION(git_blob_is_binary) -{ - zval *blob; - php_git2_t *git2; - int result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_blob_is_binary(PHP_GIT2_V(git2, blob)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto long git_blob_lookup(resource $repo, string $id) - */ -PHP_FUNCTION(git_blob_lookup) -{ - int result = 0, id_len = 0; - git_blob *blob = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL, *_result = NULL; - char *id = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_blob_lookup(&blob, PHP_GIT2_V(_repo, repository), &__id); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_BLOB, blob, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - - -/* {{{ proto long git_blob_lookup_prefix(resource $repo, string $id, long $len) - */ -PHP_FUNCTION(git_blob_lookup_prefix) -{ - int result = 0, id_len = 0; - git_blob *blob = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL, *_result = NULL; - char *id = NULL; - git_oid __id = {0}; - long len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &repo, &id, &id_len, &len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_blob_lookup_prefix(&blob, PHP_GIT2_V(_repo, repository), &__id, len); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_BLOB, blob, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - - -/* {{{ proto resource git_blob_owner(resource $blob) - */ -PHP_FUNCTION(git_blob_owner) -{ - git_repository *result = NULL; - zval *blob = NULL; - php_git2_t *_blob = NULL, *__result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_blob, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_blob_owner(PHP_GIT2_V(_blob, blob)); - if (php_git2_make_resource(&__result, PHP_GIT2_TYPE_BLOB, result, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(__result)); -} -/* }}} */ - - -/* {{{ proto resource git_blob_rawcontent(resource $blob) -*/ -PHP_FUNCTION(git_blob_rawcontent) -{ - zval *blob; - php_git2_t *git2; - const char *buffer = NULL; - git_off_t size; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - buffer = git_blob_rawcontent(PHP_GIT2_V(git2, blob)); - if (buffer == NULL) { - RETURN_FALSE; - } - size = git_blob_rawsize(PHP_GIT2_V(git2, blob)); - RETURN_STRINGL(buffer, size, 1); -} -/* }}} */ - -/* {{{ proto resource git_blob_rawsize(resource $blob, string $oid) -*/ -PHP_FUNCTION(git_blob_rawsize) -{ - zval *blob; - php_git2_t *git2; - git_off_t size; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - size = git_blob_rawsize(PHP_GIT2_V(git2, blob)); - RETURN_LONG(size); -} -/* }}} */ \ No newline at end of file diff --git a/blob.h b/blob.h deleted file mode 100644 index c4b5a4a754..0000000000 --- a/blob.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_BLOB_H -#define PHP_GIT2_BLOB_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_create_frombuffer, 0, 0, 2) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, buffer) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_create_fromchunks, 0, 0, 3) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, hintpath) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_create_fromdisk, 0, 0, 2) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_create_fromworkdir, 0, 0, 2) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, relative_path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_filtered_content, 0, 0, 2) - ZEND_ARG_INFO(0, blob) - ZEND_ARG_INFO(0, as_path) - ZEND_ARG_INFO(0, check_for_binary_data) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_free, 0, 0, 1) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_id, 0, 0, 1) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_is_binary, 0, 0, 1) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_lookup, 0, 0, 2) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_lookup_prefix, 0, 0, 3) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, length) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_owner, 0, 0, 1) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_rawcontent, 0, 0, 1) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_blob_rawsize, 0, 0, 1) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - - -/* {{{ proto resource git_blob_create_frombuffer(resource $repository, string $buffer) -*/ -PHP_FUNCTION(git_blob_create_frombuffer); - -/* {{{ proto resource git_blob_create_fromchunks(resource $repository, string $hintpath, Callable $callback, mixed payload) -*/ -PHP_FUNCTION(git_blob_create_fromchunks); - -/* {{{ proto resource git_blob_create_fromdisk(resource $repository, string $path) -*/ -PHP_FUNCTION(git_blob_create_fromdisk); - -/* {{{ proto resource git_blob_create_fromworkdir(resource $repository, string $relative_path) -*/ -PHP_FUNCTION(git_blob_create_fromworkdir); - - -/* {{{ proto resource git_blob_filtered_content($blob, $as_path, $check_for_binary_data) -*/ -PHP_FUNCTION(git_blob_filtered_content); - -/* {{{ proto resource git_blob_free(resource $blob) -*/ -PHP_FUNCTION(git_blob_free); - -/* {{{ proto resource git_blob_id(resource $blob) -*/ -PHP_FUNCTION(git_blob_id); - -/* {{{ proto resource git_blob_is_binary(resource $blob) -*/ -PHP_FUNCTION(git_blob_is_binary); - -/* {{{ proto resource git_blob_lookup(resource $blob, string $oid) -*/ -PHP_FUNCTION(git_blob_lookup); - -/* {{{ proto resource git_blob_lookup_prefix(resource $blob, string $oid) -*/ -PHP_FUNCTION(git_blob_lookup_prefix); - -/* {{{ proto resource git_blob_owner(resource $blob, string $oid) -*/ -PHP_FUNCTION(git_blob_owner); - -/* {{{ proto resource git_blob_rawcontent(resource $blob, string $oid) -*/ -PHP_FUNCTION(git_blob_rawcontent); - -/* {{{ proto resource git_blob_rawsize(resource $blob, string $oid) -*/ -PHP_FUNCTION(git_blob_rawsize); - -#endif \ No newline at end of file diff --git a/branch.c b/branch.c deleted file mode 100644 index 9d19d0fec0..0000000000 --- a/branch.c +++ /dev/null @@ -1,307 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "branch.h" - -/* {{{ proto resource git_branch_create(resource $repo, string $branch_name, resource $target, long $force) - */ -PHP_FUNCTION(git_branch_create) -{ - php_git2_t *result = NULL, *_repo = NULL, *_target = NULL; - git_reference *out = NULL; - zval *repo = NULL, *target = NULL; - char *branch_name = NULL; - int branch_name_len = 0, error = 0; - long force = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsrl", &repo, &branch_name, &branch_name_len, &target, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_target, php_git2_t*, &target, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_create(&out, PHP_GIT2_V(_repo, repository), branch_name, PHP_GIT2_V(_target, commit), force); - if (php_git2_check_error(error, "git_branch_create" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto long git_branch_delete(resource $branch) - */ -PHP_FUNCTION(git_branch_delete) -{ - int result = 0; - zval *branch = NULL; - php_git2_t *_branch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &branch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_branch_delete(PHP_GIT2_V(_branch, reference)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_branch_iterator_new(resource $repo, $list_flags) - */ -PHP_FUNCTION(git_branch_iterator_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_branch_iterator *out = NULL; - zval *repo = NULL; - int error = 0; - long list_flags = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &repo, &list_flags) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_iterator_new(&out, PHP_GIT2_V(_repo, repository), list_flags); - if (php_git2_check_error(error, "git_branch_iterator_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_BRANCH_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_branch_next(long $out_type, resource $iter) - */ -PHP_FUNCTION(git_branch_next) -{ - php_git2_t *result = NULL, *_iter = NULL; - git_reference *out = NULL; - zval *iter = NULL; - long out_type = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "lr", &out_type, &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_next(&out, out_type, PHP_GIT2_V(_iter, branch_iterator)); - if (php_git2_check_error(error, "git_branch_next" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_branch_iterator_free(resource $iter) - */ -PHP_FUNCTION(git_branch_iterator_free) -{ - zval *iter = NULL; - php_git2_t *_iter = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_iter)) { - git_branch_iterator_free(PHP_GIT2_V(_iter, branch_iterator)); - GIT2_SHOULD_FREE(_iter) = 0; - }; - zval_ptr_dtor(&iter); -} -/* }}} */ - -/* {{{ proto resource git_branch_move(resource $branch, string $new_branch_name, long $force) - */ -PHP_FUNCTION(git_branch_move) -{ - php_git2_t *result = NULL, *_branch = NULL; - git_reference *out = NULL; - zval *branch = NULL; - char *new_branch_name = NULL; - int new_branch_name_len = 0, error = 0; - long force = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &branch, &new_branch_name, &new_branch_name_len, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_move(&out, PHP_GIT2_V(_branch, reference), new_branch_name, force); - if (php_git2_check_error(error, "git_branch_move" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_branch_lookup(resource $repo, string $branch_name, $branch_type) - */ -PHP_FUNCTION(git_branch_lookup) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference *out = NULL; - zval *repo = NULL; - char *branch_name = NULL; - int branch_name_len = 0, error = 0; - long branch_type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &repo, &branch_name, &branch_name_len, &branch_type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_lookup(&out, PHP_GIT2_V(_repo, repository), branch_name, branch_type); - if (php_git2_check_error(error, "git_branch_lookup" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_branch_name(resource $ref) - */ -PHP_FUNCTION(git_branch_name) -{ - char out[GIT2_BUFFER_SIZE] = {0}; - zval *ref = NULL; - php_git2_t *_ref = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_name(&out, PHP_GIT2_V(_ref, reference)); - if (php_git2_check_error(error, "git_branch_name" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto resource git_branch_upstream(resource $branch) - */ -PHP_FUNCTION(git_branch_upstream) -{ - php_git2_t *result = NULL, *_branch = NULL; - git_reference *out = NULL; - zval *branch = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &branch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_upstream(&out, PHP_GIT2_V(_branch, reference)); - if (php_git2_check_error(error, "git_branch_upstream" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_branch_upstream_name(resource $repo, string $canonical_branch_name) - */ -PHP_FUNCTION(git_branch_upstream_name) -{ - char tracking_branch_name_out[GIT2_BUFFER_SIZE] = {0}; - long buffer_size = GIT2_BUFFER_SIZE; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *canonical_branch_name = NULL; - int canonical_branch_name_len = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &canonical_branch_name, &canonical_branch_name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_upstream_name(&tracking_branch_name_out, buffer_size, PHP_GIT2_V(_repo, repository), canonical_branch_name); - if (php_git2_check_error(error, "git_branch_upstream_name" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(tracking_branch_name_out, 1); -} -/* }}} */ - -/* {{{ proto long git_branch_is_head(resource $branch) - */ -PHP_FUNCTION(git_branch_is_head) -{ - int result = 0; - zval *branch = NULL; - php_git2_t *_branch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &branch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_branch_is_head(PHP_GIT2_V(_branch, reference)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto resource git_branch_remote_name(resource $repo, string $canonical_branch_name) - */ -PHP_FUNCTION(git_branch_remote_name) -{ - char remote_name_out[GIT2_BUFFER_SIZE] = {0}; - long buffer_size = GIT2_BUFFER_SIZE; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *canonical_branch_name = NULL; - int canonical_branch_name_len = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &canonical_branch_name, &canonical_branch_name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_branch_remote_name(&remote_name_out, buffer_size, PHP_GIT2_V(_repo, repository), canonical_branch_name); - if (php_git2_check_error(error, "git_branch_remote_name" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(remote_name_out, 1); -} -/* }}} */ diff --git a/branch.h b/branch.h deleted file mode 100644 index 5e5ae0f83f..0000000000 --- a/branch.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_BRANCH_H -#define PHP_GIT2_BRANCH_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_create, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, branch_name) - ZEND_ARG_INFO(0, target) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_delete, 0, 0, 1) - ZEND_ARG_INFO(0, branch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_iterator_new, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, list_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_next, 0, 0, 2) - ZEND_ARG_INFO(0, out_type) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_iterator_free, 0, 0, 1) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_move, 0, 0, 3) - ZEND_ARG_INFO(0, branch) - ZEND_ARG_INFO(0, new_branch_name) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_lookup, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, branch_name) - ZEND_ARG_INFO(0, branch_type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_name, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_upstream, 0, 0, 1) - ZEND_ARG_INFO(0, branch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_set_upstream, 0, 0, 2) - ZEND_ARG_INFO(0, branch) - ZEND_ARG_INFO(0, upstream_name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_upstream_name, 0, 0, 3) - ZEND_ARG_INFO(0, buffer_size) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, canonical_branch_name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_is_head, 0, 0, 1) - ZEND_ARG_INFO(0, branch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_branch_remote_name, 0, 0, 3) - ZEND_ARG_INFO(0, buffer_size) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, canonical_branch_name) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_branch_create(repo, branch_name, target, force) -*/ -PHP_FUNCTION(git_branch_create); - -/* {{{ proto long git_branch_delete(branch) -*/ -PHP_FUNCTION(git_branch_delete); - -/* {{{ proto resource git_branch_iterator_new(repo, list_flags) -*/ -PHP_FUNCTION(git_branch_iterator_new); - -/* {{{ proto resource git_branch_next(out_type, iter) -*/ -PHP_FUNCTION(git_branch_next); - -/* {{{ proto void git_branch_iterator_free(iter) -*/ -PHP_FUNCTION(git_branch_iterator_free); - -/* {{{ proto resource git_branch_move(branch, new_branch_name, force) -*/ -PHP_FUNCTION(git_branch_move); - -/* {{{ proto resource git_branch_lookup(repo, branch_name, branch_type) -*/ -PHP_FUNCTION(git_branch_lookup); - -/* {{{ proto resource git_branch_name(ref) -*/ -PHP_FUNCTION(git_branch_name); - -/* {{{ proto resource git_branch_upstream(branch) -*/ -PHP_FUNCTION(git_branch_upstream); - -/* {{{ proto long git_branch_set_upstream(branch, upstream_name) -*/ -PHP_FUNCTION(git_branch_set_upstream); - -/* {{{ proto resource git_branch_upstream_name(buffer_size, repo, canonical_branch_name) -*/ -PHP_FUNCTION(git_branch_upstream_name); - -/* {{{ proto long git_branch_is_head(branch) -*/ -PHP_FUNCTION(git_branch_is_head); - -/* {{{ proto resource git_branch_remote_name(buffer_size, repo, canonical_branch_name) -*/ -PHP_FUNCTION(git_branch_remote_name); - -#endif \ No newline at end of file diff --git a/checkout.c b/checkout.c deleted file mode 100644 index e5f0ef763a..0000000000 --- a/checkout.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "checkout.h" - -/* {{{ proto long git_checkout_head(resource $repo, $opts) - */ -PHP_FUNCTION(git_checkout_head) -{ - zval *opts = NULL, *repo = NULL; - php_git2_t *_repo = NULL; - int result = 0, shoud_free = 0; - git_checkout_opts *options; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r|a", &repo, &opts) == FAILURE) { - return; - } - - if (opts != NULL) { - if (php_git2_array_to_git_checkout_opts(&options, opts TSRMLS_CC)) { - RETURN_FALSE; - } - shoud_free = 1; - } else { - //memset(&options, '\0', sizeof(git_checkout_opts)); - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_checkout_head(PHP_GIT2_V(_repo, repository), options); - if (shoud_free) { - php_git_git_checkout_opts_free(options TSRMLS_CC); - } - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_checkout_index(resource $repo, resource $index, $opts) - */ -PHP_FUNCTION(git_checkout_index) -{ - int result = 0; - zval *repo = NULL, *index = NULL, *opts = NULL; - php_git2_t *_repo = NULL, *_index = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rra", &repo, &index, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_checkout_index(PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_index, index), opts); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_checkout_tree(resource $repo, resource $treeish, $opts) - */ -PHP_FUNCTION(git_checkout_tree) -{ - int result = 0; - zval *repo = NULL, *treeish = NULL, *opts = NULL; - php_git2_t *_repo = NULL, *_treeish = NULL; - git_checkout_opts options = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rra", &repo, &treeish, &opts) == FAILURE) { - return; - } - - if (opts != NULL && php_git2_array_to_git_checkout_opts(&options, opts TSRMLS_CC)) { - RETURN_FALSE; - } else { - memset(&options, '\0', sizeof(git_checkout_opts)); - } - - if (treeish != NULL) { - ZEND_FETCH_RESOURCE(_treeish, php_git2_t*, &treeish, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - treeish = PHP_GIT2_V(_treeish, object); - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_treeish, php_git2_t*, &treeish, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_checkout_tree(PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_treeish, object), opts); - RETURN_LONG(result); -} -/* }}} */ - - diff --git a/checkout.h b/checkout.h deleted file mode 100644 index 29eb09d27a..0000000000 --- a/checkout.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_CHECKOUT_H -#define PHP_GIT2_CHECKOUT_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_checkout_head, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_checkout_index, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_checkout_tree, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, treeish) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_checkout_head(repo, opts) -*/ -PHP_FUNCTION(git_checkout_head); - -/* {{{ proto long git_checkout_index(repo, index, opts) -*/ -PHP_FUNCTION(git_checkout_index); - -/* {{{ proto long git_checkout_tree(repo, treeish, opts) -*/ -PHP_FUNCTION(git_checkout_tree); - -#endif \ No newline at end of file diff --git a/classes/backend/__construct.html b/classes/backend/__construct.html new file mode 100644 index 0000000000..2ad7f0df38 --- /dev/null +++ b/classes/backend/__construct.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Backend::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Backend

+

Next topic

+

Git\Backend::exists

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend::__construct

+
+

Description

+

public Git\Backend::__construct ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/backend/exists.html b/classes/backend/exists.html new file mode 100644 index 0000000000..e919830456 --- /dev/null +++ b/classes/backend/exists.html @@ -0,0 +1,148 @@ + + + + + + + + + + Git\Backend::exists — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Backend::__construct

+

Next topic

+

Git\Backend::free

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend::exists

+
+

Description

+

abstract public Git\Backend::exists (string $key)

+
+
+

Parameters

+
+
key
+
target hash id.
+
+
+
+

Return Values

+

this method must return true or false.

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/backend/free.html b/classes/backend/free.html new file mode 100644 index 0000000000..6784ed5ef8 --- /dev/null +++ b/classes/backend/free.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Backend::free — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Backend::exists

+

Next topic

+

Git\Backend::read

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend::free

+
+

Description

+

public Git\Backend::free ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/backend/index.html b/classes/backend/index.html new file mode 100644 index 0000000000..2b6c8364c7 --- /dev/null +++ b/classes/backend/index.html @@ -0,0 +1,124 @@ + + + + + + + + + + Git\Backend — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Examples

+

Next topic

+

Git\Backend::__construct

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend

+

abstract class Git\Backend

+

this class use for custom backend.

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/backend/read.html b/classes/backend/read.html new file mode 100644 index 0000000000..eba725234e --- /dev/null +++ b/classes/backend/read.html @@ -0,0 +1,148 @@ + + + + + + + + + + Git\Backend::read — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Backend::free

+

Next topic

+

Git\Backend::read_header

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend::read

+
+

Description

+

abstract public Git\Backend::read (string $key)

+
+
+

Parameters

+
+
key
+
target hash id
+
+
+
+

Return Values

+

Git\RawObject / false

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/backend/read_header.html b/classes/backend/read_header.html new file mode 100644 index 0000000000..c94b6749fc --- /dev/null +++ b/classes/backend/read_header.html @@ -0,0 +1,148 @@ + + + + + + + + + + Git\Backend::read_header — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Backend::read

+

Next topic

+

Git\Backend::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend::read_header

+
+

Description

+

abstract public Git\Backend::read_header ($key)

+
+
+

Parameters

+
+
key
+
target hash id.
+
+
+
+

Return Values

+

GitRawObject / false

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/backend/write.html b/classes/backend/write.html new file mode 100644 index 0000000000..0a09b61de2 --- /dev/null +++ b/classes/backend/write.html @@ -0,0 +1,148 @@ + + + + + + + + + + Git\Backend::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Backend::read_header

+

Next topic

+

Git\Blob

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Backend::write

+
+

Description

+

abstract public Git\Backend::write (GitRawObject $object)

+
+
+

Parameters

+
+
object
+
GitRawObject
+
+
+
+

Return Values

+

true / false

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/__construct.html b/classes/blob/__construct.html new file mode 100644 index 0000000000..396d8fa921 --- /dev/null +++ b/classes/blob/__construct.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Blob::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob

+

Next topic

+

Git\Blob::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::__construct

+
+

Description

+

public Git\Blob::__construct (GitRepository $repository)

+
+
+

Parameters

+
+
repository
+
GitRepository object.
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/get_id.html b/classes/blob/get_id.html new file mode 100644 index 0000000000..f73e765d0b --- /dev/null +++ b/classes/blob/get_id.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Blob::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob::__construct

+

Next topic

+

Git\Blob::getType

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::getId

+
+

Description

+

public Git\Blob::getId ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/get_type.html b/classes/blob/get_type.html new file mode 100644 index 0000000000..1120c615e9 --- /dev/null +++ b/classes/blob/get_type.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Blob::getType — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob::getId

+

Next topic

+

Git\Blob::isBlob

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::getType

+
+

Description

+

public Git\Blob::getType ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/index.html b/classes/blob/index.html new file mode 100644 index 0000000000..45b1ac975d --- /dev/null +++ b/classes/blob/index.html @@ -0,0 +1,123 @@ + + + + + + + + + + Git\Blob — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Backend::write

+

Next topic

+

Git\Blob::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/blob/is_blob.html b/classes/blob/is_blob.html new file mode 100644 index 0000000000..cc56ae48ed --- /dev/null +++ b/classes/blob/is_blob.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Blob::isBlob — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob::getType

+

Next topic

+

Git\Blob::isTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::isBlob

+
+

Description

+

public Git\Blob::isBlob ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/is_tree.html b/classes/blob/is_tree.html new file mode 100644 index 0000000000..8c570220df --- /dev/null +++ b/classes/blob/is_tree.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Blob::isTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob::isBlob

+

Next topic

+

Git\Blob::setContent

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::isTree

+
+

Description

+

public Git\Blob::isTree ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/set_content.html b/classes/blob/set_content.html new file mode 100644 index 0000000000..48ae86e556 --- /dev/null +++ b/classes/blob/set_content.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Blob::setContent — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob::isTree

+

Next topic

+

Git\Blob::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::setContent

+
+

Description

+

public Git\Blob::setContent ($string)

+
+
+

Parameters

+
+
string
+
contents
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/blob/write.html b/classes/blob/write.html new file mode 100644 index 0000000000..4623a79a52 --- /dev/null +++ b/classes/blob/write.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Blob::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Blob::setContent

+

Next topic

+

Git\Commit

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Blob::write

+
+

Description

+

public Git\Blob::write ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/__construct.html b/classes/commit/__construct.html new file mode 100644 index 0000000000..d491b33ea4 --- /dev/null +++ b/classes/commit/__construct.html @@ -0,0 +1,156 @@ + + + + + + + + + + Git\Commit::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit

+

Next topic

+

Git\Commit::getAuthor

+

This Page

+ + + +
+
+ +
+
+
+
+ +

create new commit.

+
+

Git\Commit::__construct

+
+

Description

+

public Git\Commit::__construct (Git\Repository $repository)

+
+
+

Parameters

+
+
Git\Repository repository
+
Repository class
+
+
+
+

Return Values

+

Git\Commit

+
+
+

Examples

+
<?php
+
+$repository = new Git\Repository("/path/to/repository");
+$author = new Git\Commit($repository);
+
+
+
+
+

See Also

+

Git\Signature

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_author.html b/classes/commit/get_author.html new file mode 100644 index 0000000000..3aa9769514 --- /dev/null +++ b/classes/commit/get_author.html @@ -0,0 +1,154 @@ + + + + + + + + + + Git\Commit::getAuthor — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::__construct

+

Next topic

+

Git\Commit::getCommitter

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getAuthor

+
+

Description

+

public Git\Commit::getAuthor ()

+
+
+

Parameters

+
+
+

Return Values

+

Git\Signature

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/repository");
+$ref  = $repo->lookupRef("refs/heads/master");
+$commit = $repo->getCommit($ref->getId());
+$author = $commit->getAuthor();
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_committer.html b/classes/commit/get_committer.html new file mode 100644 index 0000000000..0867becc1d --- /dev/null +++ b/classes/commit/get_committer.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Commit::getCommitter — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getAuthor

+

Next topic

+

Git\Commit::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getCommitter

+
+

Description

+

public Git\Commit::getCommitter ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/repository");
+$ref  = $repo->lookupRef("refs/heads/master");
+$commit = $repo->getCommit($ref->getId());
+$committer = $commit->getCommitter();
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_id.html b/classes/commit/get_id.html new file mode 100644 index 0000000000..cf815efaf8 --- /dev/null +++ b/classes/commit/get_id.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Commit::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getCommitter

+

Next topic

+

Git\Commit::getMessage

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getId

+
+

Description

+

public Git\Commit::getId ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_message.html b/classes/commit/get_message.html new file mode 100644 index 0000000000..5648f46b85 --- /dev/null +++ b/classes/commit/get_message.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Commit::getMessage — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getId

+

Next topic

+

Git\Commit::getParent

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getMessage

+
+

Description

+

public Git\Commit::getMessage ()

+
+
+

Parameters

+
+
+

Return Values

+

string

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/repository");
+$ref  = $repo->lookupRef("refs/heads/master");
+$commit = $repo->getCommit($ref->getId());
+$message = $commit->getMessage();
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_parent.html b/classes/commit/get_parent.html new file mode 100644 index 0000000000..9a48b88cfe --- /dev/null +++ b/classes/commit/get_parent.html @@ -0,0 +1,149 @@ + + + + + + + + + + Git\Commit::getParent — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getMessage

+

Next topic

+

Git\Commit::getShortMessage

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getParent

+
+

Description

+

public Git\Commit::getParent (int $offset = 0)

+
+
+

Parameters

+
+
int offset
+
specified parent offset.
+
+
+
+

Return Values

+

Git\Commit

+
+
+

Examples

+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_short_message.html b/classes/commit/get_short_message.html new file mode 100644 index 0000000000..1bc8098c22 --- /dev/null +++ b/classes/commit/get_short_message.html @@ -0,0 +1,150 @@ + + + + + + + + + + Git\Commit::getShortMessage — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getParent

+

Next topic

+

Git\Commit::getTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getShortMessage

+
+

Description

+

public Git\Commit::getShortMessage ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/repository");
+$ref  = $repo->lookupRef("refs/heads/master");
+$commit = $repo->getCommit($ref->getId());
+$message = $commit->getShortMessage();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/get_tree.html b/classes/commit/get_tree.html new file mode 100644 index 0000000000..2c0b5b8c87 --- /dev/null +++ b/classes/commit/get_tree.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Commit::getTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getShortMessage

+

Next topic

+

Git\Commit::setAuthor

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::getTree

+
+

Description

+

public Git\Commit::getTree ()

+
+
+

Parameters

+
+
+

Return Values

+

Git\Tree

+
+
+

Examples

+
<?php
+$repo   = new Git\Repository("/path/repository");
+$ref    = $repo->lookupRef("refs/heads/master");
+$commit = $repo->getCommit($ref->getId());
+$tree   = $commit->getTree();
+
+
+
+
+

See Also

+

Git\Tree +Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/index.html b/classes/commit/index.html new file mode 100644 index 0000000000..8f419eae7f --- /dev/null +++ b/classes/commit/index.html @@ -0,0 +1,130 @@ + + + + + + + + + + Git\Commit — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Blob::write

+

Next topic

+

Git\Commit::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/commit/set_author.html b/classes/commit/set_author.html new file mode 100644 index 0000000000..6f5af951f6 --- /dev/null +++ b/classes/commit/set_author.html @@ -0,0 +1,157 @@ + + + + + + + + + + Git\Commit::setAuthor — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::getTree

+

Next topic

+

Git\Commit::setCommitter

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::setAuthor

+
+

Description

+

public Git\Commit::setAuthor (Git\Signature $author)

+
+
+

Parameters

+
+
author
+
author signature.
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$commit = new Git\Commit($repository);
+$commit->setAuthor(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo"))));
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/set_committer.html b/classes/commit/set_committer.html new file mode 100644 index 0000000000..e76297af25 --- /dev/null +++ b/classes/commit/set_committer.html @@ -0,0 +1,157 @@ + + + + + + + + + + Git\Commit::setCommitter — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::setAuthor

+

Next topic

+

Git\Commit::setMessage

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::setCommitter

+
+

Description

+

public Git\Commit::setCommitter (Git\Signature $committer)

+
+
+

Parameters

+
+
committer
+
committer signature
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$commit = new Git\Commit($repository);
+$commit->setCommitter(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo"))));
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/set_message.html b/classes/commit/set_message.html new file mode 100644 index 0000000000..13ca3cc236 --- /dev/null +++ b/classes/commit/set_message.html @@ -0,0 +1,162 @@ + + + + + + + + + + Git\Commit::setMessage — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::setCommitter

+

Next topic

+

Git\Commit::setParent

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::setMessage

+
+

Note

+

have to set commit message when writing commit.

+
+
+

Description

+

public Git\Commit::setMessage (string $message)

+
+
+

Parameters

+
+
message
+
commit message.
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$commit = new Git\Commit($repository);
+$commit->setMessage(
+    "initial import\n" // short message
+    ."\n"
+    ."import from https://github.com/...\n"
+            );
+
+
+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/set_parent.html b/classes/commit/set_parent.html new file mode 100644 index 0000000000..bd62501c4d --- /dev/null +++ b/classes/commit/set_parent.html @@ -0,0 +1,180 @@ + + + + + + + + + + Git\Commit::setParent — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::setMessage

+

Next topic

+

Git\Commit::setTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::setParent

+
+

Note

+

php-git can’t add multiple parents now. +this limit will fix later.

+
+
+

Note

+

do not call this method when first commit.

+
+
+

Description

+

public Git\Commit::setParent (string $hash)

+
+
+

Parameters

+
+
hash
+
commit hash id
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
    +
  • First Commit
  • +
+
<?php
+$repository = Git\Repository::init("/sample.git",true);
+$blob = new Git\Blob($repository);
+$blob->setContent("First Object1");
+$hash = $blob->write();
+$tree = new Git\Tree($repository);
+$tree->add($hash,"README",100644);
+$tree_hash = $tree->write();
+$commit = new Git\Commit($repository);
+$commit->setAuthor(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo"))));
+$commit->setCommitter(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo"))));
+$commit->setTree($tree->getId());
+// when first commit. do not call setParent.
+//$commit->setParent("");
+$commit->setMessage("initial import");
+$master_hash = $commit->write();
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/set_tree.html b/classes/commit/set_tree.html new file mode 100644 index 0000000000..a7f3b89f30 --- /dev/null +++ b/classes/commit/set_tree.html @@ -0,0 +1,148 @@ + + + + + + + + + + Git\Commit::setTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::setParent

+

Next topic

+

Git\Commit::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::setTree

+
+

Description

+

public Git\Commit::setTree (string $tree)

+
+
+

Parameters

+
+
tree
+
tree hash id
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/commit/write.html b/classes/commit/write.html new file mode 100644 index 0000000000..b2fade829a --- /dev/null +++ b/classes/commit/write.html @@ -0,0 +1,146 @@ + + + + + + + + + + Git\Commit::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Commit::setTree

+

Next topic

+

Git\Tree\Entry

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Commit::write

+

write current commit.

+
+

Description

+

public Git\Commit::write ()

+
+
+

Parameters

+
+
+

Return Values

+

boolean

+
+
+

Examples

+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/entry/__construct.html b/classes/entry/__construct.html new file mode 100644 index 0000000000..e17901cd78 --- /dev/null +++ b/classes/entry/__construct.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tree\Entry::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree\Entry

+

Next topic

+

Git\Tree\Entry::toObject

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree\Entry::__construct

+
+

Description

+

Git\Tree\Entry::__construct ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/entry/index.html b/classes/entry/index.html new file mode 100644 index 0000000000..c13caff956 --- /dev/null +++ b/classes/entry/index.html @@ -0,0 +1,118 @@ + + + + + + + + + + Git\Tree\Entry — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Commit::write

+

Next topic

+

Git\Tree\Entry::__construct

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree\Entry

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/entry/to_object.html b/classes/entry/to_object.html new file mode 100644 index 0000000000..d302c7558b --- /dev/null +++ b/classes/entry/to_object.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tree\Entry::toObject — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree\Entry::__construct

+

Next topic

+

Git\Git

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree\Entry::toObject

+
+

Description

+

public Git\Tree\Entry::toObject ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/git/index.html b/classes/git/index.html new file mode 100644 index 0000000000..453f97e5b0 --- /dev/null +++ b/classes/git/index.html @@ -0,0 +1,116 @@ + + + + + + + + + + Git\Git — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Tree\Entry::toObject

+

Next topic

+

Git\Index

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Git

+
+
    +
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/add.html b/classes/index/add.html new file mode 100644 index 0000000000..f718f47d37 --- /dev/null +++ b/classes/index/add.html @@ -0,0 +1,156 @@ + + + + + + + + + + Git\Index::add — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index

+

Next topic

+

Git\Index::count

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::add

+

add specified file to your index. you have to call Git::Index::write after this method.

+
+

Description

+

public Git\Index::add (string $path,int $staging = 0)

+
+
+

Parameters

+
+
path
+
file path.
+
+
+
+

Return Values

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/sample/.git");
+$index = $repo->getIndex();
+$index->add("newcontents.txt");
+$index->write();
+$index->refresh();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/count.html b/classes/index/count.html new file mode 100644 index 0000000000..f65be9a46e --- /dev/null +++ b/classes/index/count.html @@ -0,0 +1,152 @@ + + + + + + + + + + Git\Index::count — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index::add

+

Next topic

+

Git\Index::find

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::count

+

Countable Interface. you can count(Git::Index) this method.

+
+

Description

+

public Git\Index::count ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
<?php
+
+$repo = new Git\Repository("/tmp/specified.git");
+$index = $repo->getIndex();
+echo count($index);
+// same as echo $index->count();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/find.html b/classes/index/find.html new file mode 100644 index 0000000000..6745e43291 --- /dev/null +++ b/classes/index/find.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Index::find — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index::count

+

Next topic

+

Git\Index::getEntry

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::find

+

returns specified file offset in git_index.

+
+

Note

+

this method may change next development.

+
+
+

Description

+

public Git\Index::find (string $path)

+
+
+

Parameters

+
+
path
+
file name
+
+
+
+

Return Values

+

int offset

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/get_entry.html b/classes/index/get_entry.html new file mode 100644 index 0000000000..5868950489 --- /dev/null +++ b/classes/index/get_entry.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Index::getEntry — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index::find

+

Next topic

+

Git\Index::getIterator

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::getEntry

+

returns specified index entry.

+
+

Description

+

public Git\Index::getEntry (int $offset = 0)

+
+
+

Parameters

+
+
offset
+
index offset
+
+
+
+

Return Values

+

Stdclass

+
+
+

Examples

+
+

Note

+

return object may change next development

+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/get_iterator.html b/classes/index/get_iterator.html new file mode 100644 index 0000000000..85cfba237a --- /dev/null +++ b/classes/index/get_iterator.html @@ -0,0 +1,144 @@ + + + + + + + + + + Git\Index::getIterator — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index::getEntry

+

Next topic

+

Git\Index::refresh

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::getIterator

+

IteratorAggregate interface.

+
+

Description

+

public Git\Index::getIterator ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/index.html b/classes/index/index.html new file mode 100644 index 0000000000..ce68c6eb3c --- /dev/null +++ b/classes/index/index.html @@ -0,0 +1,124 @@ + + + + + + + + + + Git\Index — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Git

+

Next topic

+

Git\Index::add

+

This Page

+ + + +
+
+ +
+
+ +
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/refresh.html b/classes/index/refresh.html new file mode 100644 index 0000000000..6967fd2d58 --- /dev/null +++ b/classes/index/refresh.html @@ -0,0 +1,145 @@ + + + + + + + + + + Git\Index::refresh — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index::getIterator

+

Next topic

+

Git\Index::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::refresh

+

reloading current repository index.

+
+

Description

+

public Git\Index::refresh ()

+
+
+

Parameters

+
+
+

Return Values

+

void

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/index/write.html b/classes/index/write.html new file mode 100644 index 0000000000..f55044e44a --- /dev/null +++ b/classes/index/write.html @@ -0,0 +1,144 @@ + + + + + + + + + + Git\Index::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Index::refresh

+

Next topic

+

Git\Reference\Manager

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Index::write

+

write current index to filesystem.

+
+

Description

+

public Git\Index::write ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/manager/__construct.html b/classes/manager/__construct.html new file mode 100644 index 0000000000..32b5b01bae --- /dev/null +++ b/classes/manager/__construct.html @@ -0,0 +1,155 @@ + + + + + + + + + + Git\Reference\Manager::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference\Manager

+

Next topic

+

Git\Reference\Manager::create

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference\Manager::__construct

+
+

Description

+

public Git\Reference\Manager::__construct (Git\Repository $repository)

+
+
+

Parameters

+
+
repository
+
Git\Repository
+
+
+
+

Return Values

+

Git\Reference\Manager

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repo);
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/manager/create.html b/classes/manager/create.html new file mode 100644 index 0000000000..b3d372f71c --- /dev/null +++ b/classes/manager/create.html @@ -0,0 +1,165 @@ + + + + + + + + + + Git\Reference\Manager::create — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference\Manager::__construct

+

Next topic

+

Git\Reference\Manager::getList

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference\Manager::create

+
+

Note

+

Currentry can create non symbolic reference only. +(this is php-git limits. this issue fix soon)

+
+
+

Description

+

public Git\Reference\Manager::create (string $name,string $oid)

+
+
+

Parameters

+
+
name
+
reference name (e.g. refs/heads/reference-name)
+
oid
+
target commit id
+
+
+
+

Return Values

+

boolean

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repo);
+$master = $repo->lookupRef("refs/heads/master");
+//create new branch `new-branch` what targets `master` commit.
+$manager->create("refs/heads/new-branch",$master->getId());
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/manager/get_list.html b/classes/manager/get_list.html new file mode 100644 index 0000000000..7160f3e044 --- /dev/null +++ b/classes/manager/get_list.html @@ -0,0 +1,152 @@ + + + + + + + + + + Git\Reference\Manager::getList — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference\Manager::create

+

Next topic

+

Git\Reference\Manager::lookup

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference\Manager::getList

+

get available reference list.

+
+

Description

+

public Git\Reference\Manager::getList ()

+
+
+

Parameters

+
+
+

Return Values

+

array Git\Reference

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repo);
+$lists = $manager->getList();
+
+
+
+
+

See Also

+

Git\Reference

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/manager/index.html b/classes/manager/index.html new file mode 100644 index 0000000000..07ff74e2a8 --- /dev/null +++ b/classes/manager/index.html @@ -0,0 +1,121 @@ + + + + + + + + + + Git\Reference\Manager — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Index::write

+

Next topic

+

Git\Reference\Manager::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/manager/lookup.html b/classes/manager/lookup.html new file mode 100644 index 0000000000..110f464454 --- /dev/null +++ b/classes/manager/lookup.html @@ -0,0 +1,164 @@ + + + + + + + + + + Git\Reference\Manager::lookup — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference\Manager::getList

+

Next topic

+

Git\Reference\Manager::pack

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference\Manager::lookup

+

this method same as GitRepository::lookup();

+
+

Description

+

public Git\Reference\Manager::lookup (string $name)

+
+
+

Parameters

+
+
name
+
reference name (e.g. refs/heads/master)
+
+
+
+

Return Values

+

Git\Reference

+
+
+

ChangeLog

+
    +
  • method name changed from lookupRef to lookup. +(can’t define lookup method because php-compat defines lookup preprocessor.)
  • +
+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repo);
+$ref = $manager->lookup("refs/heads/master");
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/manager/pack.html b/classes/manager/pack.html new file mode 100644 index 0000000000..e40ab0a2fb --- /dev/null +++ b/classes/manager/pack.html @@ -0,0 +1,154 @@ + + + + + + + + + + Git\Reference\Manager::pack — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference\Manager::lookup

+

Next topic

+

Git\Object

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference\Manager::pack

+
+

Note

+

WARNING: calling this method may invalidate any existing references previously loaded on the cache.

+
+
+

Description

+

public Git\Reference\Manager::pack ()

+
+
+

Parameters

+
+
+

Return Values

+

boolean

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repo);
+$manager->pack();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/object/get_id.html b/classes/object/get_id.html new file mode 100644 index 0000000000..edf86c5031 --- /dev/null +++ b/classes/object/get_id.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Object::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Object

+

Next topic

+

Git\Object::getType

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Object::getId

+
+

Description

+

public Git\Object::getId ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/object/get_type.html b/classes/object/get_type.html new file mode 100644 index 0000000000..bd5e0608dd --- /dev/null +++ b/classes/object/get_type.html @@ -0,0 +1,161 @@ + + + + + + + + + + Git\Object::getType — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Object::getId

+

Next topic

+

Git\Object::isBlob

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Object::getType

+

returns current object type

+
+

Description

+

public Git\Object::getType ()

+
+
+

Parameters

+
+
+

Return Values

+

int object_type

+
    +
  • Git\Object\Tree
  • +
  • Git\Object\Blob
  • +
+
+
+

Examples

+
<?php
+
+foreach($tree->entries as $entry){
+   $object = $entry->toObject();
+   if($object->getType() == Git\Object\Tree){
+       //
+   }
+}
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/object/index.html b/classes/object/index.html new file mode 100644 index 0000000000..3c3f17db67 --- /dev/null +++ b/classes/object/index.html @@ -0,0 +1,122 @@ + + + + + + + + + + Git\Object — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Reference\Manager::pack

+

Next topic

+

Git\Object::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Object

+

Base class for Git\Commit, Git\Blob, Git\Tree, Git\Commit

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/object/is_blob.html b/classes/object/is_blob.html new file mode 100644 index 0000000000..c4f23862ae --- /dev/null +++ b/classes/object/is_blob.html @@ -0,0 +1,158 @@ + + + + + + + + + + Git\Object::isBlob — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Object::getType

+

Next topic

+

Git\Object::isTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Object::isBlob

+

return true when object is blob.

+
+

Description

+

public Git\Object::isBlob ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
<?php
+
+foreach($tree->entries as $entry){
+   $object = $entry->toObject();
+   if($object->isTree()){
+       //
+   } else if($object->isBlob()){
+       //
+   }
+}
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/object/is_tree.html b/classes/object/is_tree.html new file mode 100644 index 0000000000..2bcb761d78 --- /dev/null +++ b/classes/object/is_tree.html @@ -0,0 +1,159 @@ + + + + + + + + + + Git\Object::isTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Object::isBlob

+

Next topic

+

Git\Object::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Object::isTree

+

return true when object is tree.

+
+

Description

+

public Git\Object::isTree ()

+
+
+

Parameters

+
+
+

Return Values

+

boolean

+
+
+

Examples

+
<?php
+
+foreach($tree->entries as $entry){
+   $object = $entry->toObject();
+   if($object->isTree()){
+       //
+   } else if($object->isBlob()){
+       //
+   }
+}
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/object/write.html b/classes/object/write.html new file mode 100644 index 0000000000..8b2038673c --- /dev/null +++ b/classes/object/write.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Object::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Object::isTree

+

Next topic

+

Git\ODB

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Object::write

+
+

Description

+

public Git\Object::write ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/odb/__construct.html b/classes/odb/__construct.html new file mode 100644 index 0000000000..43d35a4e9b --- /dev/null +++ b/classes/odb/__construct.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\ODB::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\ODB

+

Next topic

+

Git\ODB::addAlternate

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\ODB::__construct

+
+

Description

+

public Git\ODB::__construct ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/odb/add_alternate.html b/classes/odb/add_alternate.html new file mode 100644 index 0000000000..da9c6ff263 --- /dev/null +++ b/classes/odb/add_alternate.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\ODB::addAlternate — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\ODB::__construct

+

Next topic

+

Git\ODB::addBackend

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\ODB::addAlternate

+
+

Description

+

public Git\ODB::addAlternate (GitBackend $backend)

+
+
+

Parameters

+
+
GitBackend backend
+
custom backend object
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/odb/add_backend.html b/classes/odb/add_backend.html new file mode 100644 index 0000000000..a2a9078da4 --- /dev/null +++ b/classes/odb/add_backend.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\ODB::addBackend — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\ODB::addAlternate

+

Next topic

+

Git\RawObject

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\ODB::addBackend

+
+

Description

+

public Git\ODB::addBackend (GitBackend $backend)

+
+
+

Parameters

+
+
GitBackend backend
+
custom backend object
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/odb/index.html b/classes/odb/index.html new file mode 100644 index 0000000000..518df88c58 --- /dev/null +++ b/classes/odb/index.html @@ -0,0 +1,119 @@ + + + + + + + + + + Git\ODB — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Object::write

+

Next topic

+

Git\ODB::__construct

+

This Page

+ + + +
+
+ +
+
+ +
+
+
+ + + + \ No newline at end of file diff --git a/classes/rawobject/__construct.html b/classes/rawobject/__construct.html new file mode 100644 index 0000000000..b2f52c3f13 --- /dev/null +++ b/classes/rawobject/__construct.html @@ -0,0 +1,151 @@ + + + + + + + + + + Git\RawObject::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\RawObject

+

Next topic

+

Git\RawObject::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\RawObject::__construct

+
+

Description

+

public Git\RawObject::__construct (int $type, string $data, [int $len])

+
+
+

Parameters

+
+
type
+
object type.
+
data
+
object data
+
len
+
object data length
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/rawobject/get_id.html b/classes/rawobject/get_id.html new file mode 100644 index 0000000000..4c611c4bbd --- /dev/null +++ b/classes/rawobject/get_id.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\RawObject::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\RawObject::__construct

+

Next topic

+

Git\Reference

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\RawObject::getId

+
+

Description

+

public Git\RawObject::getId ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/rawobject/index.html b/classes/rawobject/index.html new file mode 100644 index 0000000000..2487601315 --- /dev/null +++ b/classes/rawobject/index.html @@ -0,0 +1,120 @@ + + + + + + + + + + Git\RawObject — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\ODB::addBackend

+

Next topic

+

Git\RawObject::__construct

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\RawObject

+

this class uses php-git internal. +see also Git\Backend

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/__construct.html b/classes/reference/__construct.html new file mode 100644 index 0000000000..7a39cfe601 --- /dev/null +++ b/classes/reference/__construct.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Reference::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference

+

Next topic

+

Git\Reference::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::__construct

+
+

Description

+

public Git\Reference::__construct (GitRepository $repository)

+
+
+

Parameters

+
+
GitRepository repository
+
GitRepository object.
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/get_id.html b/classes/reference/get_id.html new file mode 100644 index 0000000000..1ec71a933e --- /dev/null +++ b/classes/reference/get_id.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::__construct

+

Next topic

+

Git\Reference::getName

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::getId

+
+

Description

+

public Git\Reference::getId ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/get_name.html b/classes/reference/get_name.html new file mode 100644 index 0000000000..e8071677f2 --- /dev/null +++ b/classes/reference/get_name.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::getName — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::getId

+

Next topic

+

Git\Reference::getTarget

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::getName

+
+

Description

+

public Git\Reference::getName ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/get_target.html b/classes/reference/get_target.html new file mode 100644 index 0000000000..b2165d6293 --- /dev/null +++ b/classes/reference/get_target.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::getTarget — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::getName

+

Next topic

+

Git\Reference::getType

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::getTarget

+
+

Description

+

public Git\Reference::getTarget ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/get_type.html b/classes/reference/get_type.html new file mode 100644 index 0000000000..973edfe717 --- /dev/null +++ b/classes/reference/get_type.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::getType — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::getTarget

+

Next topic

+

Git\Reference::isBlob

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::getType

+
+

Description

+

public Git\Reference::getType ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/index.html b/classes/reference/index.html new file mode 100644 index 0000000000..10b8c58a4b --- /dev/null +++ b/classes/reference/index.html @@ -0,0 +1,128 @@ + + + + + + + + + + Git\Reference — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\RawObject::getId

+

Next topic

+

Git\Reference::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/reference/is_blob.html b/classes/reference/is_blob.html new file mode 100644 index 0000000000..30ffa1d34e --- /dev/null +++ b/classes/reference/is_blob.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::isBlob — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::getType

+

Next topic

+

Git\Reference::isTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::isBlob

+
+

Description

+

public Git\Reference::isBlob ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/is_tree.html b/classes/reference/is_tree.html new file mode 100644 index 0000000000..e33784f74b --- /dev/null +++ b/classes/reference/is_tree.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::isTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::isBlob

+

Next topic

+

Git\Reference::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::isTree

+
+

Description

+

public Git\Reference::isTree ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/reference/write.html b/classes/reference/write.html new file mode 100644 index 0000000000..f6239f8786 --- /dev/null +++ b/classes/reference/write.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Reference::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Reference::isTree

+

Next topic

+

Git\Repository

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Reference::write

+
+

Description

+

public Git\Reference::write ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/__construct.html b/classes/repository/__construct.html new file mode 100644 index 0000000000..3190c93866 --- /dev/null +++ b/classes/repository/__construct.html @@ -0,0 +1,152 @@ + + + + + + + + + + Git\Repository::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository

+

Next topic

+

Git\Repository::addAlternate

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::__construct

+
+

Description

+

public Git\Repository::__construct ( [$repository_path])

+
+
+

Parameters

+
+
repository_path
+
git repository path.
+
+
+
+

Return Values

+

GitRepository

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/specified.git");
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/add_alternate.html b/classes/repository/add_alternate.html new file mode 100644 index 0000000000..b75a12cbb3 --- /dev/null +++ b/classes/repository/add_alternate.html @@ -0,0 +1,152 @@ + + + + + + + + + + Git\Repository::addAlternate — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::__construct

+

Next topic

+

Git\Repository::addBackend

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::addAlternate

+

add alternate backend. this feature can resolve external objects.

+
+

Description

+

public Git\Repository::addAlternate ($backend, $priority)

+
+
+

Parameters

+
+
backend
+
Specifies a class that inherits from Git\Backend
+
priority
+
[low] 1 ... 5[high]
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
+
+

See Also

+

Git\Backend

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/add_backend.html b/classes/repository/add_backend.html new file mode 100644 index 0000000000..e4be811d2a --- /dev/null +++ b/classes/repository/add_backend.html @@ -0,0 +1,234 @@ + + + + + + + + + + Git\Repository::addBackend — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::addAlternate

+

Next topic

+

Git\Repository::getCommit

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::addBackend

+
+

Description

+

public Git\Repository::addBackend ($backend, $priority)

+
+
+

Parameters

+
+
backend
+
Specifies a class that inherits from Git\Backend
+
priority
+
[low] 1 ... 5[high]
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+/**
+ * PHP Memory Backend.
+ *
+ * You have to inherits Git\Backend to create own custom backend.
+ *
+ */
+class MemoryBackend extends \Git\Backend
+{
+    protected $memory = array();
+
+    /**
+     * Read Data
+     *
+     * @param string $key  sha1 hash.
+     * @return Git\RawObject
+     *
+     * Note: libgit2 usualy use internal cache.
+     *       so this method does not call everytime.
+     */
+    public function read($key){
+       if($this->exists($key)){
+           $object = $this->get($key);
+           return $object;
+       }
+    }
+
+    /**
+     * Read Header
+     *
+     * @param string $key  sha1 hash.
+     * @return Git\RawObject
+     */
+    public function read_header($key){
+       if(isset($this->memory[$key])){
+           return new \Git\RawObject($obj->type,"",$obj->len);
+       }
+    }
+
+    /**
+     * check specified contents.
+     *
+     * @param string $key  sha1 hash.
+     * @return boolean
+     */
+    public function exists($key){
+        if(isset($this->memory[$key])){
+            return true;
+        }else{
+            return false;
+        }
+    }
+
+    /**
+     * write contents
+     *
+     * you have to write key,data,type your storage engine.
+     *
+     * @param string $key  sha1 hash.
+     * @param Git\RawObject $object.
+     * @return hash
+     */
+    public function write($object){
+        $key = $object->getId();
+        $std = new \Stdclass();
+        $std->data = $object->data;
+        $std->type = $object->type;
+        $std->len = $object->len;
+        $this->memory[$key] = $std;
+        return $key;
+    }
+
+    public function free()
+    {
+        unset($this->memory);
+    }
+}
+
+
+$repository = new Git\Repository("/tmp/example/.git");
+$repository->addBackend(new MemoryBackend(), 5);// higher priority.
+
+
+
+
+

See Also

+

Git\Backend

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/get_commit.html b/classes/repository/get_commit.html new file mode 100644 index 0000000000..2d94f00596 --- /dev/null +++ b/classes/repository/get_commit.html @@ -0,0 +1,155 @@ + + + + + + + + + + Git\Repository::getCommit — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::addBackend

+

Next topic

+

Git\Repository::getIndex

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::getCommit

+

returns specified Git\Commit.

+
+

Description

+

public Git\Repository::getCommit (string $hash)

+
+
+

Parameters

+
+
hash
+
commit hash id.
+
+
+
+

Return Values

+

Git\Commit

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/specified.git");
+$commit = $repository->getCommit("cd584aba22827a6a59cad3ab1b4e026418558bfb");
+
+
+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/get_index.html b/classes/repository/get_index.html new file mode 100644 index 0000000000..ff36fcf476 --- /dev/null +++ b/classes/repository/get_index.html @@ -0,0 +1,150 @@ + + + + + + + + + + Git\Repository::getIndex — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::getCommit

+

Next topic

+

Git\Repository::getObject

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::getIndex

+

returns current GitIndex object. this method will fail when bare repository.

+
+

Description

+

public Git\Repository::getIndex ()

+
+
+

Parameters

+
+
+

Return Values

+

Git\Index

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/example/.git");
+$index = $repository->getIndex();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/get_object.html b/classes/repository/get_object.html new file mode 100644 index 0000000000..ccf8ae9697 --- /dev/null +++ b/classes/repository/get_object.html @@ -0,0 +1,159 @@ + + + + + + + + + + Git\Repository::getObject — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::getIndex

+

Next topic

+

Git\Repository::getReferences

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::getObject

+

returns specified Git\Blob.

+
+

Note

+

this method will rename to Git\Repository::getBlob

+
+
+

Description

+

public Git\Repository::getObject ($hash)

+
+
+

Parameters

+
+
hash
+
blob hash id.
+
+
+
+

Return Values

+

Git\Blob

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/specified.git");
+$blob = $repository->getObject("cd584aba22827a6a59cad3ab1b4e026418558bfb");
+
+
+
+
+

See Also

+

Git\Blob

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/get_references.html b/classes/repository/get_references.html new file mode 100644 index 0000000000..dce4337bda --- /dev/null +++ b/classes/repository/get_references.html @@ -0,0 +1,159 @@ + + + + + + + + + + Git\Repository::getReferences — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::getObject

+

Next topic

+

Git\Repository::getTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::getReferences

+

returns a list with all the references that can be found in a repository.

+
+

Note

+

this method may changed next development.

+
+
+

Description

+

public Git\Repository::getReferences (int $flag)

+
+
+

Parameters

+
+
flag
+
fill them out lator
+
+
+
+

Return Values

+

array Git\References

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/specified.git");
+$refs = $repository->getReferences();
+
+
+
+
+

See Also

+

Git\Reference

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/get_tree.html b/classes/repository/get_tree.html new file mode 100644 index 0000000000..f08f946430 --- /dev/null +++ b/classes/repository/get_tree.html @@ -0,0 +1,155 @@ + + + + + + + + + + Git\Repository::getTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::getReferences

+

Next topic

+

Git\Repository::getWalker

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::getTree

+

returns specified Git\Tree.

+
+

Description

+

public Git\Repository::getTree ($hash)

+
+
+

Parameters

+
+
hash
+
tree hash id.
+
+
+
+

Return Values

+

Git\Tree

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/specified.git");
+$tree = $repository->getTree("cd584aba22827a6a59cad3ab1b4e026418558bfb");
+
+
+
+
+

See Also

+

Git\Tree

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/get_walker.html b/classes/repository/get_walker.html new file mode 100644 index 0000000000..eb49300fc0 --- /dev/null +++ b/classes/repository/get_walker.html @@ -0,0 +1,158 @@ + + + + + + + + + + Git\Repository::getWalker — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::getTree

+

Next topic

+

Git\Repository::init

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::getWalker

+

returns GitRevwalk.

+
+

Description

+

public Git\Repository::getWalker ()

+
+
+

Parameters

+
+
+

Return Values

+

Git\Revwalk

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$reference = $repo->lookupRef("refs/heads/master");
+$walker = $repo->getWalker();
+$walker->push($reference->getId());
+
+while($commit = $walker->next()){
+  var_dump($commit);
+}
+
+
+
+
+

See Also

+

Git\Revwalk +Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/index.html b/classes/repository/index.html new file mode 100644 index 0000000000..a6ba16e79e --- /dev/null +++ b/classes/repository/index.html @@ -0,0 +1,130 @@ + + + + + + + + + + Git\Repository — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Reference::write

+

Next topic

+

Git\Repository::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/repository/init.html b/classes/repository/init.html new file mode 100644 index 0000000000..87d69eec72 --- /dev/null +++ b/classes/repository/init.html @@ -0,0 +1,160 @@ + + + + + + + + + + Git\Repository::init — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::getWalker

+

Next topic

+

Git\Repository::lookupRef

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::init

+

create a new git repository on your filesystem.

+
+

Description

+

public static Git\Repository::init ($path, $is_bare)

+
+
+

Parameters

+
+
path
+
blank directory
+
is_bare
+
create bare repository when is_bare is true.
+
+
+

Note

+

do not call this method when specified repository exists.

+
+
+
+

Return Values

+

Git\Repository

+
+
+

Examples

+
<?php
+$repo = Git\Repository::init("/tmp/new.git",true);
+
+
+
+
+

See Also

+

Git\Repository

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/lookup_ref.html b/classes/repository/lookup_ref.html new file mode 100644 index 0000000000..a5ebbc949a --- /dev/null +++ b/classes/repository/lookup_ref.html @@ -0,0 +1,155 @@ + + + + + + + + + + Git\Repository::lookupRef — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::init

+

Next topic

+

Git\Repository::open2

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::lookupRef

+

return specified reference object.

+
+

Description

+

public Git\Repository::lookupRef ($name)

+
+
+

Parameters

+
+
name
+
reference name.
+
+
+
+

Return Values

+

Git\Reference

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$reference = $repo->lookupRef("refs/heads/master");
+
+
+
+
+

See Also

+

Git\Reference

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/open2.html b/classes/repository/open2.html new file mode 100644 index 0000000000..148db9919b --- /dev/null +++ b/classes/repository/open2.html @@ -0,0 +1,167 @@ + + + + + + + + + + Git\Repository::open2 — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::lookupRef

+

Next topic

+

Git\Repository::open3

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::open2

+
+

Description

+

public Git\Repository::open2 (string $git_dir, string $git_object_dir, string $git_index_file, string $git_working_tree)

+
+
+

Parameters

+
+
git_dir
+
git repository directory
+
git_object_dir
+
object directory
+
git_index_file
+
index file
+
git_working_tree
+
working tree directory
+
+
+
+

Return Values

+

boolean

+
+
+

Examples

+
<?php
+
+use Git\Repository;
+
+$repo = new Repository();
+$repo->open2(
+    "/home/chobie/src/libgit2/.git",        // git directory
+    "/home/chobie/src/libgit2/.git/objects",// git object directory
+    "/home/chobie/src/libgit2/.git/index",  // git index file
+    "/home/chobie/src/libgit2/"             // git working tree
+    );
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/repository/open3.html b/classes/repository/open3.html new file mode 100644 index 0000000000..a12f7cad77 --- /dev/null +++ b/classes/repository/open3.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Repository::open3 — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Repository::open2

+

Next topic

+

Git\Revwalk

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Repository::open3

+
+

Description

+

public Git\Repository::open3 (string $git_dir, [GitOdb $odb], [string $index], [string $tree])

+
+
+

Parameters

+
+
git_dir
+
specified git repository directory
+
odb
+
GitOdb object which added custom backends.
+
index
+
specified git index path.
+
tree
+
specified git working tree path.
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/revwalk/__construct.html b/classes/revwalk/__construct.html new file mode 100644 index 0000000000..8c80ffb16a --- /dev/null +++ b/classes/revwalk/__construct.html @@ -0,0 +1,149 @@ + + + + + + + + + + Git\Revwalk::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Revwalk

+

Next topic

+

Git\Revwalk::hide

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Revwalk::__construct

+
+

Note

+

you should use Git\Repository::getWalker() instead.

+
+
+

Description

+

public Git\Revwalk::__construct ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/revwalk/hide.html b/classes/revwalk/hide.html new file mode 100644 index 0000000000..54ecc1d087 --- /dev/null +++ b/classes/revwalk/hide.html @@ -0,0 +1,164 @@ + + + + + + + + + + Git\Revwalk::hide — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Revwalk::__construct

+

Next topic

+

Git\Revwalk::next

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Revwalk::hide

+

hide uninterested commits.

+
o---o---o---o---o---o---o---o
+             `--o---o--/
+                ^hide
+
+
o---o---o---o---o---o---o---o
+
+
+
+

Description

+

public Git\Revwalk::hide ($hash)

+
+
+

Parameters

+
+
hash
+
uninterested commit id
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$master = $repo->lookupRef("refs/heads/master");
+$revwalk = $repo->getWalker();
+$uninterested = "";// specified uninterested commit id
+$revwalk->hide($uninterested);
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/revwalk/index.html b/classes/revwalk/index.html new file mode 100644 index 0000000000..a92b07e09b --- /dev/null +++ b/classes/revwalk/index.html @@ -0,0 +1,122 @@ + + + + + + + + + + Git\Revwalk — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Repository::open3

+

Next topic

+

Git\Revwalk::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/revwalk/next.html b/classes/revwalk/next.html new file mode 100644 index 0000000000..9633fbd2e8 --- /dev/null +++ b/classes/revwalk/next.html @@ -0,0 +1,154 @@ + + + + + + + + + + Git\Revwalk::next — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Revwalk::hide

+

Next topic

+

Git\Revwalk::push

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Revwalk::next

+

get next travasable commit.

+
+

Description

+

public Git\Revwalk::next ()

+
+
+

Parameters

+
+
+

Return Values

+

Git\Commit

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$master = $repo->lookupRef("refs/heads/master");
+$revwalk = $repo->getWalker();
+$revwalk->push($master->getId());
+$commit = $revwalk->next();
+
+
+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/revwalk/push.html b/classes/revwalk/push.html new file mode 100644 index 0000000000..a2105b9114 --- /dev/null +++ b/classes/revwalk/push.html @@ -0,0 +1,161 @@ + + + + + + + + + + Git\Revwalk::push — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Revwalk::next

+

Next topic

+

Git\Revwalk::reset

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Revwalk::push

+

push commit to revwalk object.

+
+

Description

+

public Git\Revwalk::push (string $hash)

+
+
+

Parameters

+
+
hash
+
commit id
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$master = $repo->lookupRef("refs/heads/master");
+$revwalk = $repo->getWalker();
+$revwalk->push($master->getId());
+while($commit = $revwalk->next()){
+   //
+}
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/revwalk/reset.html b/classes/revwalk/reset.html new file mode 100644 index 0000000000..2e8492f824 --- /dev/null +++ b/classes/revwalk/reset.html @@ -0,0 +1,154 @@ + + + + + + + + + + Git\Revwalk::reset — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Revwalk::push

+

Next topic

+

Git\Revwalk::sort

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Revwalk::reset

+

reset internal pointer.

+
+

Description

+

public Git\Revwalk::reset ()

+
+
+

Parameters

+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$master = $repo->lookupRef("refs/heads/master");
+$revwalk = $repo->getWalker();
+$revwalk->push($master->getId());
+$commit = $revwalk->next();
+$revwalk->reset();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/revwalk/sort.html b/classes/revwalk/sort.html new file mode 100644 index 0000000000..70b4b907cb --- /dev/null +++ b/classes/revwalk/sort.html @@ -0,0 +1,162 @@ + + + + + + + + + + Git\Revwalk::sort — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Revwalk::reset

+

Next topic

+

Git\Signature

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Revwalk::sort

+
+

Description

+

public Git\Revwalk::sort (int $sort_type)

+
+
+

Parameters

+
+
sort_type
+
specified sort type
+
+
    +
  • Git\Revwalk\SORT_NONE
  • +
  • Git\Revwalk\SORT_TOPO
  • +
  • Git\Revwalk\SORT_DATE
  • +
  • Git\Revwalk\SORT_REVERSE
  • +
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$repo = new Git\Repository("/tmp/specified.git");
+$master = $repo->lookupRef("refs/heads/master");
+$revwalk = $repo->getWalker();
+$revwalk->sort(Git\Revwalk\SORT_REVERSE);
+$revwalk->push($master->getId());
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/signature/__construct.html b/classes/signature/__construct.html new file mode 100644 index 0000000000..e813dfdad1 --- /dev/null +++ b/classes/signature/__construct.html @@ -0,0 +1,162 @@ + + + + + + + + + + Git\Signature::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Signature

+

Next topic

+

Git\Tag

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Signature::__construct

+

create signature.

+
+

Description

+

public Git\Signature::__construct (string $name,string $email, \DateTime $when)

+
+
+

Parameters

+
+
name
+
full name. e.g) John Smith
+
email
+
email. e.g) john.smith@example.com
+
when
+
commit time
+
+
+
+

Return Values

+

Git\Signature

+
+
+

Examples

+
<?php
+$sig = new Git\Signature("John Smith","john.smith@example.com",new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))));
+
+
+
+

Note

+

should not specified unixtime. e.g) new DateTime(“@1294147094”)

+
+
+
+

See Also

+

Git\Commit

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/signature/index.html b/classes/signature/index.html new file mode 100644 index 0000000000..a27517679d --- /dev/null +++ b/classes/signature/index.html @@ -0,0 +1,117 @@ + + + + + + + + + + Git\Signature — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Revwalk::sort

+

Next topic

+

Git\Signature::__construct

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Signature

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/__construct.html b/classes/tag/__construct.html new file mode 100644 index 0000000000..3fdaf9a0c9 --- /dev/null +++ b/classes/tag/__construct.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Tag::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag

+

Next topic

+

Git\Tag::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::__construct

+
+

Description

+

public Git\Tag::__construct ($repository)

+
+
+

Parameters

+
+
repository
+
fill them out later
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/get_id.html b/classes/tag/get_id.html new file mode 100644 index 0000000000..541c8b9609 --- /dev/null +++ b/classes/tag/get_id.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::__construct

+

Next topic

+

Git\Tag::getMessage

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::getId

+
+

Description

+

public Git\Tag::getId ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/get_message.html b/classes/tag/get_message.html new file mode 100644 index 0000000000..43d2437c9f --- /dev/null +++ b/classes/tag/get_message.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::getMessage — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::getId

+

Next topic

+

Git\Tag::getName

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::getMessage

+
+

Description

+

public Git\Tag::getMessage ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/get_name.html b/classes/tag/get_name.html new file mode 100644 index 0000000000..139abd2a1a --- /dev/null +++ b/classes/tag/get_name.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::getName — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::getMessage

+

Next topic

+

Git\Tag::getTarget

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::getName

+
+

Description

+

public Git\Tag::getName ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/get_target.html b/classes/tag/get_target.html new file mode 100644 index 0000000000..a8b5b528a5 --- /dev/null +++ b/classes/tag/get_target.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::getTarget — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::getName

+

Next topic

+

Git\Tag::getType

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::getTarget

+
+

Description

+

public Git\Tag::getTarget ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/get_type.html b/classes/tag/get_type.html new file mode 100644 index 0000000000..f6f9ff7996 --- /dev/null +++ b/classes/tag/get_type.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::getType — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::getTarget

+

Next topic

+

Git\Tag::isBlob

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::getType

+
+

Description

+

public Git\Tag::getType ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/index.html b/classes/tag/index.html new file mode 100644 index 0000000000..f18c17f5f1 --- /dev/null +++ b/classes/tag/index.html @@ -0,0 +1,132 @@ + + + + + + + + + + Git\Tag — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Signature::__construct

+

Next topic

+

Git\Tag::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/tag/is_blob.html b/classes/tag/is_blob.html new file mode 100644 index 0000000000..0a76ad25e0 --- /dev/null +++ b/classes/tag/is_blob.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::isBlob — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::getType

+

Next topic

+

Git\Tag::isTree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::isBlob

+
+

Description

+

public Git\Tag::isBlob ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/is_tree.html b/classes/tag/is_tree.html new file mode 100644 index 0000000000..6addd8f5b5 --- /dev/null +++ b/classes/tag/is_tree.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::isTree — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::isBlob

+

Next topic

+

Git\Tag::setMessage

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::isTree

+
+

Description

+

public Git\Tag::isTree ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/set_message.html b/classes/tag/set_message.html new file mode 100644 index 0000000000..5994dae11d --- /dev/null +++ b/classes/tag/set_message.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Tag::setMessage — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::isTree

+

Next topic

+

Git\Tag::setName

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::setMessage

+
+

Description

+

public Git\Tag::setMessage ($message)

+
+
+

Parameters

+
+
message
+
fill them out later
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/set_name.html b/classes/tag/set_name.html new file mode 100644 index 0000000000..8b22986725 --- /dev/null +++ b/classes/tag/set_name.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Tag::setName — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::setMessage

+

Next topic

+

Git\Tag::setTarget

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::setName

+
+

Description

+

public Git\Tag::setName ($name)

+
+
+

Parameters

+
+
name
+
fill them out later
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/set_target.html b/classes/tag/set_target.html new file mode 100644 index 0000000000..477b9b1152 --- /dev/null +++ b/classes/tag/set_target.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Tag::setTarget — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::setName

+

Next topic

+

Git\Tag::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::setTarget

+
+

Description

+

public Git\Tag::setTarget ($target)

+
+
+

Parameters

+
+
target
+
fill them out later
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tag/write.html b/classes/tag/write.html new file mode 100644 index 0000000000..487b7a6f10 --- /dev/null +++ b/classes/tag/write.html @@ -0,0 +1,143 @@ + + + + + + + + + + Git\Tag::write — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tag::setTarget

+

Next topic

+

Git\Tree

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tag::write

+
+

Description

+

public Git\Tag::write ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/__construct.html b/classes/tree/__construct.html new file mode 100644 index 0000000000..4edc8021e9 --- /dev/null +++ b/classes/tree/__construct.html @@ -0,0 +1,147 @@ + + + + + + + + + + Git\Tree::__construct — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree

+

Next topic

+

Git\Tree::add

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::__construct

+
+

Description

+

public Git\Tree::__construct (GitRepository $repository)

+
+
+

Parameters

+
+
repository
+
GitRepository Object
+
+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/add.html b/classes/tree/add.html new file mode 100644 index 0000000000..ab98ccdc0c --- /dev/null +++ b/classes/tree/add.html @@ -0,0 +1,187 @@ + + + + + + + + + + Git\Tree::add — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::__construct

+

Next topic

+

Git\Tree::count

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::add

+
+

Description

+

public Git\Tree::add (string $hash, string $name, int $mode)

+
+
+

Parameters

+
+
hash
+
specified object id.
+
name
+
file name.
+
mode
+

file attribute.

+
+
++++ + + + + + + + + + + + + + + + + + +
100644Regular file
100755Regular file & executable
120000Symbolic link
40000Directory
160000submodule
+
+
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/path/to/repository");
+$hash = "";// blob / tree hash.
+$tree = new Git\Tree($repository);
+$tree->add($hash,"README",100644);
+$tree_hash = $tree->write();
+
+
+
+
+

See Also

+

Git\Tree

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/count.html b/classes/tree/count.html new file mode 100644 index 0000000000..4592fbed3e --- /dev/null +++ b/classes/tree/count.html @@ -0,0 +1,153 @@ + + + + + + + + + + Git\Tree::count — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::add

+

Next topic

+

Git\Tree::getEntries

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::count

+

Countable interface.

+
+

Description

+

public Git\Tree::count ()

+
+
+

Parameters

+
+
+

Return Values

+

int count.

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/path/to/repository");
+$refs = $repository->lookupRef("refs/heads/master");
+$tree = $repository->getTree($refs->getId());
+echo count($tree); // or echo $tree->count();
+
+
+
+
+

See Also

+

Countable Interface (PHP Documents)

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/get_entries.html b/classes/tree/get_entries.html new file mode 100644 index 0000000000..b21dde8921 --- /dev/null +++ b/classes/tree/get_entries.html @@ -0,0 +1,145 @@ + + + + + + + + + + Git\Tree::getEntries — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::count

+

Next topic

+

Git\Tree::getEntry

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::getEntries

+

returns tree entry array.

+
+

Description

+

public Git\Tree::getEntries ()

+
+
+

Parameters

+
+
+

Return Values

+

array GitTreeEntry

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/get_entry.html b/classes/tree/get_entry.html new file mode 100644 index 0000000000..f2df429196 --- /dev/null +++ b/classes/tree/get_entry.html @@ -0,0 +1,149 @@ + + + + + + + + + + Git\Tree::getEntry — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::getEntries

+

Next topic

+

Git\Tree::getId

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::getEntry

+

returns specified tree entry.

+
+

Description

+

public Git\Tree::getEntry (int $offset = 0)

+
+
+

Parameters

+
+
offset
+
tree entry offset
+
+
+
+

Return Values

+

GitTreeEntry

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/get_id.html b/classes/tree/get_id.html new file mode 100644 index 0000000000..05dd352141 --- /dev/null +++ b/classes/tree/get_id.html @@ -0,0 +1,152 @@ + + + + + + + + + + Git\Tree::getId — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::getEntry

+

Next topic

+

Git\Tree::getIterator

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::getId

+

returns tree hash id.

+
+

Description

+

public Git\Tree::getId ()

+
+
+

Parameters

+
+
+

Return Values

+

string hash id

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/path/to/repository");
+$refs = $repository->lookupRef("refs/heads/master");
+$tree = $repository->getTree($refs->getId());
+echo $tree->getId();
+
+
+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/get_iterator.html b/classes/tree/get_iterator.html new file mode 100644 index 0000000000..38db9835f7 --- /dev/null +++ b/classes/tree/get_iterator.html @@ -0,0 +1,144 @@ + + + + + + + + + + Git\Tree::getIterator — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::getId

+

Next topic

+

Git\Tree::getType

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::getIterator

+

IteratorAggregate interface.

+
+

Description

+

public Git\Tree::getIterator ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/get_type.html b/classes/tree/get_type.html new file mode 100644 index 0000000000..741272ffdd --- /dev/null +++ b/classes/tree/get_type.html @@ -0,0 +1,145 @@ + + + + + + + + + + Git\Tree::getType — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::getIterator

+

Next topic

+

Git\Tree::path

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::getType

+

inherits Git\Object.

+
+

Description

+

public Git\Tree::getType ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
+
+

See Also

+

Git\Object::getType

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/index.html b/classes/tree/index.html new file mode 100644 index 0000000000..f5bb4e2b46 --- /dev/null +++ b/classes/tree/index.html @@ -0,0 +1,128 @@ + + + + + + + + + + Git\Tree — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Git\Tag::write

+

Next topic

+

Git\Tree::__construct

+

This Page

+ + + +
+
+ + + + + + \ No newline at end of file diff --git a/classes/tree/path.html b/classes/tree/path.html new file mode 100644 index 0000000000..babc73d5e0 --- /dev/null +++ b/classes/tree/path.html @@ -0,0 +1,160 @@ + + + + + + + + + + Git\Tree::path — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::getType

+

Next topic

+

Git\Tree::remove

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::path

+

returns specified GitTreeEntry.

+
+

Description

+

public Git\Tree::path ($path)

+
+
+

Parameters

+
+
path
+
file name
+
+
+
+

Return Values

+

Git\TreeEntry

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/tmp/specified.git");
+$tree = $repository->getTree("cd584aba22827a6a59cad3ab1b4e026418558bfb");
+$entry = $tree->path("README.md");
+
+
+
+

Note

+

this method can’t resolve recursive yet.

+
+
+
+

See Also

+

Git\Tree\Entry

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/remove.html b/classes/tree/remove.html new file mode 100644 index 0000000000..23833356a9 --- /dev/null +++ b/classes/tree/remove.html @@ -0,0 +1,157 @@ + + + + + + + + + + Git\Tree::remove — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::path

+

Next topic

+

Git\Tree::write

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::remove

+
+

Description

+

public Git\Tree::remove (string $name)

+
+
+

Parameters

+
+
name
+
specified file name
+
+
+
+

Return Values

+

void

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/path/to/repository");
+$hash = "";// blob / tree hash.
+$tree = new Git\Tree($repository);
+$tree->remove("README");
+$tree_hash = $tree->write();
+
+
+
+
+

See Also

+

Git\Tree

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/classes/tree/write.html b/classes/tree/write.html new file mode 100644 index 0000000000..227885f5c3 --- /dev/null +++ b/classes/tree/write.html @@ -0,0 +1,142 @@ + + + + + + + + + + Git\Tree::write — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Git\Tree::remove

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Git\Tree::write

+
+

Description

+

public Git\Tree::write ()

+
+
+

Parameters

+
+
+

Return Values

+
+
+

Examples

+
<?php
+$repository = new Git\Repository("/path/to/repository");
+$hash = "";// blob / tree hash.
+$tree = new Git\Tree($repository);
+$tree->add($hash,"README",100644);
+$tree_hash = $tree->write();
+
+
+
+
+

See Also

+

Git\Object::write

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/clone.c b/clone.c deleted file mode 100644 index 095aa5dc38..0000000000 --- a/clone.c +++ /dev/null @@ -1,68 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "clone.h" - -static void php_git2_git_clone_options_to_array(git_clone_options *options, zval **out TSRMLS_DC) -{ - zval *result, *pathspec; - - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("version"), options->version); - add_assoc_long_ex(result, ZEND_STRS("bare"), options->bare); - add_assoc_long_ex(result, ZEND_STRS("ignore_cert_errors"), options->ignore_cert_errors); - /* TODO: make other options available */ - *out = result; -} - -static void php_git2_array_to_git_clone_options(git_clone_options *options, zval *array TSRMLS_DC) -{ - options->version = php_git2_read_arrval_long2(array, ZEND_STRS("version"), 1 TSRMLS_CC); - options->bare = php_git2_read_arrval_long2(array, ZEND_STRS("bare"), 0 TSRMLS_CC); - options->ignore_cert_errors = php_git2_read_arrval_long2(array, ZEND_STRS("ignore_cert_errors"), 0 TSRMLS_CC); -} - -/* {{{ proto resource git_clone(string $url, string $localpath[, array $options]) -*/ -PHP_FUNCTION(git_clone) -{ - char *url, *localpath; - int url_len, localpath_len; - zval *opts = NULL;// = GIT_OPTIONS_INIT; - php_git2_t *git2; - git_repository *repository; - int error; - git_clone_options options = GIT_CLONE_OPTIONS_INIT; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ss|a", &url, &url_len, &localpath, &localpath_len, &opts) == FAILURE) { - return; - } - - /* TODO(chobie): convert options to git_clone_options */ - - php_git2_array_to_git_clone_options(&options, opts TSRMLS_CC); - - - error = git_clone(&repository, url, localpath, &options); - if (php_git2_check_error(error, "git_clone" TSRMLS_CC)) { - RETURN_FALSE - } - - PHP_GIT2_MAKE_RESOURCE(git2); - - PHP_GIT2_V(git2, repository) = repository; - git2->type = PHP_GIT2_TYPE_REPOSITORY; - git2->resource_id = PHP_GIT2_LIST_INSERT(git2, git2_resource_handle); - git2->should_free_v = 1; - - ZVAL_RESOURCE(return_value, git2->resource_id); -} - -/* {{{ proto int git_clone_into(resource $repository, resource $remote, long $co_opts, string $branch) -*/ -PHP_FUNCTION(git_clone_into) -{ - /* TODO(chobie): implement this*/ -} diff --git a/clone.h b/clone.h deleted file mode 100644 index a6d759016a..0000000000 --- a/clone.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_CLONE_H -#define PHP_GIT2_CLONE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_clone, 0, 0, 3) - ZEND_ARG_INFO(0, url) - ZEND_ARG_INFO(0, localpath) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_clone_into, 0, 0, 4) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, co_opts) - ZEND_ARG_INFO(0, branch) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_clone(string $url, string $localpath[, long $options]) -*/ -PHP_FUNCTION(git_clone); - -/* {{{ proto int git_clone_into(resource $repository, resource $remote, long $co_opts, string $branch) -*/ -PHP_FUNCTION(git_clone_into); - -#endif \ No newline at end of file diff --git a/commit.c b/commit.c deleted file mode 100644 index 1f38036672..0000000000 --- a/commit.c +++ /dev/null @@ -1,489 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "commit.h" - -/* {{{ proto long git_commit_lookup(resource $repo, string $id) - */ -PHP_FUNCTION(git_commit_lookup) -{ - int result = 0, id_len = 0; - git_commit *commit = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL, *_result = NULL; - char *id = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_commit_lookup(&commit, PHP_GIT2_V(_repo, repository), &__id); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_COMMIT, commit, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto resource git_commit_author(resource $commit) -*/ -PHP_FUNCTION(git_commit_author) -{ - php_git2_t *git2; - zval *commit; - git_signature *author; - zval *result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - author = git_commit_author(PHP_GIT2_V(git2, commit)); - php_git2_signature_to_array(author, &result TSRMLS_CC); - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_tree(resource $commit) - */ -PHP_FUNCTION(git_commit_tree) -{ - php_git2_t *result = NULL, *_commit = NULL; - git_tree *tree_out = NULL; - zval *commit = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_commit_tree(&tree_out, PHP_GIT2_V(_commit, commit)); - if (php_git2_check_error(error, "git_commit_tree" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_TREE, tree_out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_commit_lookup_prefix(resource $repo, string $id, long $len) - */ -PHP_FUNCTION(git_commit_lookup_prefix) -{ - int result = 0, id_len = 0; - git_commit *commit = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL, *_result = NULL; - char *id = NULL; - git_oid __id = {0}; - long len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &repo, &id, &id_len, &len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_commit_lookup_prefix(&commit, PHP_GIT2_V(_repo, repository), &__id, len); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_COMMIT, commit, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto resource git_commit_id(resource $commit) - */ -PHP_FUNCTION(git_commit_id) -{ - const git_oid *result = NULL; - zval *commit = NULL; - php_git2_t *_commit = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_commit_id(PHP_GIT2_V(_commit, commit)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_owner(resource $commit) - */ -PHP_FUNCTION(git_commit_owner) -{ - git_repository *result = NULL; - zval *commit = NULL; - php_git2_t *_commit = NULL, *__result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_commit_owner(PHP_GIT2_V(_commit, commit)); - if (php_git2_make_resource(&__result, PHP_GIT2_TYPE_COMMIT, result, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(__result)); -} -/* }}} */ - - -/* {{{ proto resource git_commit_message_encoding(commit) -*/ -PHP_FUNCTION(git_commit_message_encoding) -{ - zval *commit; - php_git2_t *_commit; - const char *encoding; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - encoding = git_commit_message_encoding(PHP_GIT2_V(_commit, commit)); - RETURN_STRING(encoding, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_message(commit) -*/ -PHP_FUNCTION(git_commit_message) -{ - zval *commit; - php_git2_t *_commit; - const char *message; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - message = git_commit_message(PHP_GIT2_V(_commit, commit)); - RETURN_STRING(message, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_message_raw(commit) -*/ -PHP_FUNCTION(git_commit_message_raw) -{ - zval *commit; - php_git2_t *_commit; - const char *message; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - message = git_commit_message_raw(PHP_GIT2_V(_commit, commit)); - RETURN_STRING(message, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_time(commit) -*/ -PHP_FUNCTION(git_commit_time) -{ - zval *commit; - php_git2_t *_commit; - git_time_t time; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - time = git_commit_time(PHP_GIT2_V(_commit, commit)); - - /* NOTE(chobie) should this return as a string? */ - RETURN_LONG(time); -} -/* }}} */ - -/* {{{ proto long git_commit_time_offset(commit) -*/ -PHP_FUNCTION(git_commit_time_offset) -{ - zval *commit; - php_git2_t *_commit; - int result = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_commit_time_offset(PHP_GIT2_V(_commit, commit)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_commit_committer(commit) -*/ -PHP_FUNCTION(git_commit_committer) -{ - zval *commit; - php_git2_t *git2; - git_signature *committer; - zval *result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - committer = git_commit_committer(PHP_GIT2_V(git2, commit)); - php_git2_signature_to_array(committer, &result TSRMLS_CC); - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_raw_header(commit) -*/ -PHP_FUNCTION(git_commit_raw_header) -{ - zval *commit; - php_git2_t *_commit; - const char *header; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - header = git_commit_raw_header(PHP_GIT2_V(_commit, commit)); - - RETURN_STRING(header, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_tree_id(commit) -*/ -PHP_FUNCTION(git_commit_tree_id) -{ - zval *commit; - php_git2_t *_commit; - char out[GIT2_OID_HEXSIZE] = {0}; - const git_oid *id; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - id = git_commit_tree_id(PHP_GIT2_V(_commit, commit)); - - git_oid_fmt(out, id); - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_parentcount(commit) -*/ -PHP_FUNCTION(git_commit_parentcount) -{ - zval *commit; - php_git2_t *_commit; - unsigned long count; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &commit) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - count = git_commit_parentcount(PHP_GIT2_V(_commit, commit)); - RETURN_LONG(count); -} -/* }}} */ - -/* {{{ proto resource git_commit_parent(commit, n) -*/ -PHP_FUNCTION(git_commit_parent) -{ - zval *commit; - php_git2_t *_commit, *result; - git_commit *parent; - long n = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &commit, &n) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_commit_parent(&parent, PHP_GIT2_V(_commit, commit), n); - if (php_git2_check_error(error, "git_commit_parent" TSRMLS_CC)) { - RETURN_FALSE - } - - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, commit) = parent; - result->type = PHP_GIT2_TYPE_COMMIT; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 0; - - ZVAL_RESOURCE(return_value, result->resource_id); -} -/* }}} */ - -/* {{{ proto resource git_commit_parent_id(commit, n) -*/ -PHP_FUNCTION(git_commit_parent_id) -{ - zval *commit; - php_git2_t *_commit; - long n; - git_oid *oid; - char out[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &commit, &n) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - oid = git_commit_parent_id(PHP_GIT2_V(_commit, commit), n); - git_oid_fmt(out, oid); - - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto resource git_commit_nth_gen_ancestor(commit, n) -*/ -PHP_FUNCTION(git_commit_nth_gen_ancestor) -{ - zval *commit; - php_git2_t *_commit, *result; - git_commit *ancestor; - long n; - int error; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &commit, &n) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_commit, php_git2_t*, &commit, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_commit_nth_gen_ancestor(&ancestor, PHP_GIT2_V(_commit, commit), n); - if (php_git2_check_error(error, "git_commit_nth_gen_ancestor" TSRMLS_CC)) { - RETURN_FALSE - } - - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, commit) = ancestor; - result->type = PHP_GIT2_TYPE_COMMIT; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 0; - - ZVAL_RESOURCE(return_value, result->resource_id); - -} -/* }}} */ - -/* {{{ proto resource git_commit_create( - resource $repo, string $update_ref, array $author, array $committer, - string $message_encoding, string $message, resource $tree, array $parents) -*/ -PHP_FUNCTION(git_commit_create) -{ - zval *repo, *tree, *parents, *committer, *author, **element; - char *update_ref = {0}, *message_encoding = {0}, *message = {0}; - int update_ref_len, message_encoding_len, message_len, parent_count = 0, error = 0, i; - php_git2_t *_repo, *_tree; - git_signature __author, __committer; - char out[GIT2_OID_HEXSIZE] = {0}; - git_oid oid; - const git_commit **__parents = NULL; - HashPosition pos; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsaassra", &repo, &update_ref, &update_ref_len, &author, - &committer, &message_encoding, &message_encoding_len, &message, - &message_len, &tree, &parents) == FAILURE) { - return; - } - - memset(&__author, '\0', sizeof(git_signature)); - memset(&__committer, '\0', sizeof(git_signature)); - - if (committer == NULL || Z_TYPE_P(committer) == IS_NULL) { - committer = author; - } - - php_git2_array_to_signature(&__author, author TSRMLS_CC); - php_git2_array_to_signature(&__committer, committer TSRMLS_CC); - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_tree, php_git2_t*, &tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - parent_count = zend_hash_num_elements(Z_ARRVAL_P(parents)); - __parents = emalloc(parent_count * sizeof(void *)); - for(i = 0, zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(parents), &pos); - zend_hash_get_current_data_ex(Z_ARRVAL_P(parents), (void **)&element, &pos) == SUCCESS; - zend_hash_move_forward_ex(Z_ARRVAL_P(parents), &pos) - ) { - git_commit *p = NULL; - - if (Z_TYPE_PP(element) == IS_STRING) { - error = git_oid_fromstr(&oid, Z_STRVAL_PP(element)); - git_commit_lookup(&p, PHP_GIT2_V(_repo, repository), &oid); - } else if (Z_TYPE_PP(element) == IS_RESOURCE) { - php_git2_t *t; - ZEND_FETCH_RESOURCE(t, php_git2_t*, element, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - p = PHP_GIT2_V(t, commit); - } - - __parents[i] = p; - i++; - } - - error = git_commit_create( - &oid, - PHP_GIT2_V(_repo, repository), - update_ref, - &__author, - &__committer, - message_encoding, - message, - PHP_GIT2_V(_tree, tree), - parent_count, - __parents - ); - - efree(__parents); - - if (php_git2_check_error(error, "git_commit_create" TSRMLS_CC)) { - RETURN_FALSE - } - - git_oid_fmt(out, &oid); - RETURN_STRING(out, 1); -} \ No newline at end of file diff --git a/commit.h b/commit.h deleted file mode 100644 index fd3af615a8..0000000000 --- a/commit.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_COMMIT_H -#define PHP_GIT2_COMMIT_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_lookup, 0, 0, 2) - ZEND_ARG_INFO(0, repository) - ZEND_ARG_INFO(0, oid) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_author, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_tree, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_lookup_prefix, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, len) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_id, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_owner, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_message_encoding, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_message, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_message_raw, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_time, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_time_offset, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_committer, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_raw_header, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_tree_id, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_parentcount, 0, 0, 1) - ZEND_ARG_INFO(0, commit) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_parent, 0, 0, 2) - ZEND_ARG_INFO(0, commit) - ZEND_ARG_INFO(0, n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_parent_id, 0, 0, 2) - ZEND_ARG_INFO(0, commit) - ZEND_ARG_INFO(0, n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_nth_gen_ancestor, 0, 0, 2) - ZEND_ARG_INFO(0, commit) - ZEND_ARG_INFO(0, n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_commit_create, 0, 0, 8) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, update_ref) - ZEND_ARG_INFO(0, author) - ZEND_ARG_INFO(0, committer) - ZEND_ARG_INFO(0, message_encoding) - ZEND_ARG_INFO(0, message) - ZEND_ARG_INFO(0, tree) - ZEND_ARG_INFO(0, parents) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_commit_lookup(resource $repository, mixed $oid) -*/ -PHP_FUNCTION(git_commit_lookup); - -/* {{{ proto resource git_commit_author(resource $commit) -*/ -PHP_FUNCTION(git_commit_author); - -/* {{{ proto resource git_commit_tree(resource $commit) -*/ -PHP_FUNCTION(git_commit_tree); - -/* {{{ proto resource git_commit_lookup_prefix(repo, id, len) -*/ -PHP_FUNCTION(git_commit_lookup_prefix); - -/* {{{ proto resource git_commit_id(commit) -*/ -PHP_FUNCTION(git_commit_id); - -/* {{{ proto resource git_commit_owner(commit) -*/ -PHP_FUNCTION(git_commit_owner); - -/* {{{ proto resource git_commit_message_encoding(commit) -*/ -PHP_FUNCTION(git_commit_message_encoding); - -/* {{{ proto resource git_commit_message(commit) -*/ -PHP_FUNCTION(git_commit_message); - -/* {{{ proto resource git_commit_message_raw(commit) -*/ -PHP_FUNCTION(git_commit_message_raw); - -/* {{{ proto resource git_commit_time(commit) -*/ -PHP_FUNCTION(git_commit_time); - -/* {{{ proto long git_commit_time_offset(commit) -*/ -PHP_FUNCTION(git_commit_time_offset); - -/* {{{ proto resource git_commit_committer(commit) -*/ -PHP_FUNCTION(git_commit_committer); - -/* {{{ proto resource git_commit_raw_header(commit) -*/ -PHP_FUNCTION(git_commit_raw_header); - -/* {{{ proto resource git_commit_tree(commit) -*/ -PHP_FUNCTION(git_commit_tree); - -/* {{{ proto resource git_commit_tree_id(commit) -*/ -PHP_FUNCTION(git_commit_tree_id); - -/* {{{ proto resource git_commit_parentcount(commit) -*/ -PHP_FUNCTION(git_commit_parentcount); - -/* {{{ proto resource git_commit_parent(commit, n) -*/ -PHP_FUNCTION(git_commit_parent); - -/* {{{ proto resource git_commit_parent_id(commit, n) -*/ -PHP_FUNCTION(git_commit_parent_id); - -/* {{{ proto resource git_commit_nth_gen_ancestor(commit, n) -*/ -PHP_FUNCTION(git_commit_nth_gen_ancestor); - -/* {{{ proto resource git_commit_create( - resource $repo, string $update_ref, array $author, array $committer, - string $message_encoding, string $message, resource $tree, array $parents) -*/ -PHP_FUNCTION(git_commit_create); - -#endif \ No newline at end of file diff --git a/config.m4 b/config.m4 deleted file mode 100644 index fed1775bce..0000000000 --- a/config.m4 +++ /dev/null @@ -1,28 +0,0 @@ -PHP_ARG_ENABLE(git2, Whether to enable the "git2" extension, - [ --enable-git2 Enable "php-git2" extension support]) - -PHP_ARG_ENABLE(git2-debug, for git2 debug support, - [ --enable-git2-debug Enable git2 debug support], no, no) - -if test $PHP_GIT2 != "no"; then - PHP_SUBST(GIT2_SHARED_LIBADD) - - PHP_NEW_EXTENSION(git2, php_git2.c repository.c commit.c tree.c clone.c blob.c helper.c revwalk.c treebuilder.c reference.c g_config.c object.c index.c revparse.c branch.c tag.c status.c cred.c remote.c transport.c diff.c checkout.c filter.c ignore.c indexer.c pathspec.c patch.c merge.c note.c odb.c reflog.c blame.c packbuilder.c stash.c signature.c attr.c reset.c message.c submodule.c giterr.c push.c refspec.c graph.c, $ext_shared) - PHP_ADD_INCLUDE([$ext_srcdir/libgit2/include]) - - # for now - CFLAGS=" $CFLAGS -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Winline -Wunused-macros -Wredundant-decls -Wstrict-aliasing=2 -Wswitch-enum -Wdeclaration-after-statement -Wl,libgit2/build/libgit2.a" - - if test "$PHP_GIT2_DEBUG" != "no"; then - CFLAGS="-g -O0 $CFLAGS" - fi - - PHP_ADD_LIBPATH($ext_srcdir/libgit2/build, GIT2_SHARED_LIBADD) - #PHP_ADD_LIBRARY(git2,, GIT2_SHARED_LIBADD) - PHP_SUBST([CFLAGS]) - - ifdef([PHP_ADD_EXTENSION_DEP], - [ - PHP_ADD_EXTENSION_DEP(git2, spl, true) - ]) -fi diff --git a/constants.html b/constants.html new file mode 100644 index 0000000000..a21e0de031 --- /dev/null +++ b/constants.html @@ -0,0 +1,155 @@ + + + + + + + + + + Predefined Constants — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Resources

+

Next topic

+

Examples

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Predefined Constants

+ ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyValue
Git\Revwalk\SORT_NONE0
Git\Revwalk\SORT_TOPO1
Git\Revwalk\SORT_DATE2
Git\Revwalk\SORT_REVERSE4
Git\Object\AnyGIT_OBJ_ANY
Git\Object\BadGIT_OBJ_BAD
Git\Object\CommitGIT_OBJ_COMMIT
Git\Object\TreeGit_OBJ_TREE
Git\Object\BlobGit_OBJ_BLOB
Git\Object\TAGGit_OBJ_TAG
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/cred.c b/cred.c deleted file mode 100644 index d3a2f1c95d..0000000000 --- a/cred.c +++ /dev/null @@ -1,128 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "cred.h" - -/* {{{ proto long git_cred_has_username(resource $cred) - */ -PHP_FUNCTION(git_cred_has_username) -{ - int result = 0; - zval *cred = NULL; - php_git2_t *_cred = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &cred) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cred, php_git2_t*, &cred, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_cred_has_username(PHP_GIT2_V(_cred, cred)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto resource git_cred_userpass_plaintext_new(string $username, string $password) - */ -PHP_FUNCTION(git_cred_userpass_plaintext_new) -{ - php_git2_t *result = NULL; - git_cred *out = NULL; - char *username = NULL, *password = NULL; - int username_len = 0, password_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ss", &username, &username_len, &password, &password_len) == FAILURE) { - return; - } - - error = git_cred_userpass_plaintext_new(&out, username, password); - if (php_git2_check_error(error, "git_cred_userpass_plaintext_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CRED, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_cred_ssh_key_new(string $username, string $publickey, string $privatekey, string $passphrase) - */ -PHP_FUNCTION(git_cred_ssh_key_new) -{ - php_git2_t *result = NULL; - git_cred *out = NULL; - char *username = NULL, *publickey = NULL, *privatekey = NULL, *passphrase = NULL; - int username_len = 0, publickey_len = 0, privatekey_len = 0, passphrase_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ssss", &username, &username_len, &publickey, &publickey_len, &privatekey, &privatekey_len, &passphrase, &passphrase_len) == FAILURE) { - return; - } - - error = git_cred_ssh_key_new(&out, username, publickey, privatekey, passphrase); - if (php_git2_check_error(error, "git_cred_ssh_key_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CRED, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - - -/* {{{ proto resource git_cred_ssh_custom_new(username, publickey, publickey_len, sign_fn, sign_data) -*/ -PHP_FUNCTION(git_cred_ssh_custom_new) -{ - - /* TODO(chobie): implement this */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_cred_ssh_custom_new not implemented yet"); - return; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "ssr", &username, &username_len, &publickey, &publickey_len, &publickey_len, &sign_fn, &sign_data) == FAILURE) { -// return; -// } -// ZEND_FETCH_RESOURCE(_username, php_git2_t*, &username, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -} - -/* {{{ proto resource git_cred_default_new() - */ -PHP_FUNCTION(git_cred_default_new) -{ - php_git2_t *result = NULL; - git_cred *out = NULL; - int error = 0; - - error = git_cred_default_new(&out); - if (php_git2_check_error(error, "git_cred_default_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CRED, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - - -/* {{{ proto resource git_cred_userpass(url, user_from_url, allowed_types, payload) -*/ -PHP_FUNCTION(git_cred_userpass) -{ - - /* TODO(chobie): implement this */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_cred_userpass not implemented yet"); - return; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "ssl", &url, &url_len, &user_from_url, &user_from_url_len, &allowed_types, &payload) == FAILURE) { -// return; -// } -} - diff --git a/cred.h b/cred.h deleted file mode 100644 index d21c744600..0000000000 --- a/cred.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_CRED_H -#define PHP_GIT2_CRED_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_cred_has_username, 0, 0, 1) - ZEND_ARG_INFO(0, cred) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_cred_userpass_plaintext_new, 0, 0, 2) - ZEND_ARG_INFO(0, username) - ZEND_ARG_INFO(0, password) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_cred_ssh_key_new, 0, 0, 4) - ZEND_ARG_INFO(0, username) - ZEND_ARG_INFO(0, publickey) - ZEND_ARG_INFO(0, privatekey) - ZEND_ARG_INFO(0, passphrase) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_cred_ssh_custom_new, 0, 0, 5) - ZEND_ARG_INFO(0, username) - ZEND_ARG_INFO(0, publickey) - ZEND_ARG_INFO(0, publickey_len) - ZEND_ARG_INFO(0, sign_fn) - ZEND_ARG_INFO(0, sign_data) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_cred_default_new, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_cred_userpass, 0, 0, 4) - ZEND_ARG_INFO(0, url) - ZEND_ARG_INFO(0, user_from_url) - ZEND_ARG_INFO(0, allowed_types) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_cred_has_username(cred) -*/ -PHP_FUNCTION(git_cred_has_username); - -/* {{{ proto resource git_cred_userpass_plaintext_new(username, password) -*/ -PHP_FUNCTION(git_cred_userpass_plaintext_new); - -/* {{{ proto resource git_cred_ssh_key_new(username, publickey, privatekey, passphrase) -*/ -PHP_FUNCTION(git_cred_ssh_key_new); - -/* {{{ proto resource git_cred_ssh_custom_new(username, publickey, publickey_len, sign_fn, sign_data) -*/ -PHP_FUNCTION(git_cred_ssh_custom_new); - -/* {{{ proto resource git_cred_default_new() -*/ -PHP_FUNCTION(git_cred_default_new); - -/* {{{ proto resource git_cred_userpass(url, user_from_url, allowed_types, payload) -*/ -PHP_FUNCTION(git_cred_userpass); - -#endif \ No newline at end of file diff --git a/diff.c b/diff.c deleted file mode 100644 index 7acd39a64c..0000000000 --- a/diff.c +++ /dev/null @@ -1,469 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "diff.h" - -/* {{{ proto void git_diff_free(resource $diff) - */ -PHP_FUNCTION(git_diff_free) -{ - zval *diff = NULL; - php_git2_t *_diff = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &diff) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_diff)) { - git_diff_free(PHP_GIT2_V(_diff, diff)); - GIT2_SHOULD_FREE(_diff) = 0; - }; - zval_ptr_dtor(&diff); -} -/* }}} */ - -/* {{{ proto long git_diff_tree_to_tree(resource $repo, resource $old_tree, resource $new_tree, $opts) - */ -PHP_FUNCTION(git_diff_tree_to_tree) -{ - int result = 0; - git_diff *diff = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - zval *old_tree = NULL; - php_git2_t *_old_tree = NULL; - zval *new_tree = NULL; - php_git2_t *_new_tree = NULL; - zval *opts = NULL; - git_diff_options options = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrra", &repo, &old_tree, &new_tree, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_old_tree, php_git2_t*, &old_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_new_tree, php_git2_t*, &new_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - result = git_diff_tree_to_tree(&diff, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_old_tree, tree), PHP_GIT2_V(_new_tree, tree), opts); - php_git2_git_diff_options_free(&options); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_diff_tree_to_index(resource $repo, resource $old_tree, resource $index, $opts) - */ -PHP_FUNCTION(git_diff_tree_to_index) -{ - int result = 0; - git_diff *diff = NULL; - zval *repo = NULL, *old_tree = NULL, *index = NULL, *opts = NULL; - php_git2_t *_repo = NULL, *_old_tree = NULL, *_index = NULL, *_diff = NULL; - git_diff_options options = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrra", &repo, &old_tree, &index, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_old_tree, php_git2_t*, &old_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - result = git_diff_tree_to_index(&diff, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_old_tree, tree), PHP_GIT2_V(_index, index), opts); - php_git2_git_diff_options_free(&options); - if (php_git2_make_resource(&_diff, PHP_GIT2_TYPE_DIFF, diff, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_diff)); - -} -/* }}} */ - -/* {{{ proto long git_diff_index_to_workdir(resource $repo, resource $index, $opts) - */ -PHP_FUNCTION(git_diff_index_to_workdir) -{ - int result = 0; - git_diff *diff = NULL; - zval *repo = NULL, *index = NULL, *opts = NULL; - php_git2_t *_repo = NULL, *_index = NULL, *_diff = NULL; - git_diff_options options = GIT_DIFF_OPTIONS_INIT; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rra", &repo, &index, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - result = git_diff_index_to_workdir(&diff, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_index, index), opts); - php_git2_git_diff_options_free(&options); - if (php_git2_make_resource(&_diff, PHP_GIT2_TYPE_DIFF, diff, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_diff)); -} -/* }}} */ - -/* {{{ proto long git_diff_tree_to_workdir(resource $repo, resource $old_tree, $opts) - */ -PHP_FUNCTION(git_diff_tree_to_workdir) -{ - int result = 0; - git_diff *diff = NULL; - zval *repo = NULL, *old_tree = NULL, *opts = NULL; - php_git2_t *_repo = NULL, *_old_tree = NULL, *_result; - git_diff_options options = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rra", &repo, &old_tree, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_old_tree, php_git2_t*, &old_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - result = git_diff_tree_to_workdir(&diff, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_old_tree, tree), &options); - if (php_git2_check_error(result, "git_diff_tree_to_workdir" TSRMLS_CC)) { - php_git2_git_diff_options_free(&options); - RETURN_FALSE - } - - php_git2_git_diff_options_free(&options); - - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_DIFF, diff, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto long git_diff_tree_to_workdir_with_index(resource $repo, resource $old_tree, $opts) - */ -PHP_FUNCTION(git_diff_tree_to_workdir_with_index) -{ - int result = 0; - git_diff *diff = NULL; - zval *repo = NULL, *old_tree = NULL, *opts = NULL; - php_git2_t *_repo = NULL, *_old_tree = NULL, *_diff = NULL; - git_diff_options options = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rra", &repo, &old_tree, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_old_tree, php_git2_t*, &old_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - result = git_diff_tree_to_workdir_with_index(&diff, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_old_tree, tree), opts); - php_git2_git_diff_options_free(&options); - if (php_git2_make_resource(&_diff, PHP_GIT2_TYPE_DIFF, diff, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_diff)); -} -/* }}} */ - -/* {{{ proto long git_diff_merge(resource $onto, resource $from) - */ -PHP_FUNCTION(git_diff_merge) -{ - int result = 0; - zval *onto = NULL, *from = NULL; - php_git2_t *_onto = NULL, *_from = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &onto, &from) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_onto, php_git2_t*, &onto, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_from, php_git2_t*, &from, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_diff_merge(PHP_GIT2_V(_onto, diff), PHP_GIT2_V(_from, diff)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_diff_find_similar(resource $diff, $options) - */ -PHP_FUNCTION(git_diff_find_similar) -{ - int result = 0; - zval *diff = NULL; - php_git2_t *_diff = NULL; - zval *options = NULL; - git_diff_options _options = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ra", &diff, &options) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&_options, options TSRMLS_CC); - result = git_diff_find_similar(PHP_GIT2_V(_diff, diff), &_options); - php_git2_git_diff_options_free(&_options); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_diff_options_init(long $version) - */ -PHP_FUNCTION(git_diff_options_init) -{ - int result = 0; - git_diff_options options = {0}; - long version = GIT_DIFF_OPTIONS_VERSION; - zval *out; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "|l", &version) == FAILURE) { - return; - } - - result = git_diff_options_init(&options, version); - php_git2_git_diff_options_to_array(&options, &out TSRMLS_CC); - RETURN_ZVAL(out, 0, 1); -} -/* }}} */ - -/* {{{ proto long git_diff_num_deltas(resource $diff) - */ -PHP_FUNCTION(git_diff_num_deltas) -{ - size_t result = 0; - zval *diff = NULL; - php_git2_t *_diff = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &diff) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_diff_num_deltas(PHP_GIT2_V(_diff, diff)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_diff_num_deltas_of_type(resource $diff, $type) - */ -PHP_FUNCTION(git_diff_num_deltas_of_type) -{ - size_t result = 0; - zval *diff = NULL; - php_git2_t *_diff = NULL; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &diff, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_diff_num_deltas_of_type(PHP_GIT2_V(_diff, diff), type); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_diff_get_delta(resource $diff, long $idx) - */ -PHP_FUNCTION(git_diff_get_delta) -{ - const git_diff_delta *result = NULL; - zval *diff = NULL, *_result; - php_git2_t *_diff = NULL; - long idx = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &diff, &idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_diff_get_delta(PHP_GIT2_V(_diff, diff), idx); - php_git2_diff_delta_to_array(result, &_result TSRMLS_CC); - RETURN_ZVAL(_result, 0, 1); -} -/* }}} */ - -/* {{{ proto long git_diff_is_sorted_icase(resource $diff) - */ -PHP_FUNCTION(git_diff_is_sorted_icase) -{ - int result = 0; - zval *diff = NULL; - php_git2_t *_diff = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &diff) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_diff_is_sorted_icase(PHP_GIT2_V(_diff, diff)); - RETURN_BOOL(result); -} -/* }}} */ - - -/* {{{ proto long git_diff_foreach(resource $diff, Callable $file_cb, Callable $hunk_cb, Callable $line_cb, $payload) - */ -PHP_FUNCTION(git_diff_foreach) -{ - int result = 0; - zval *diff = NULL, *payload = NULL; - php_git2_t *_diff = NULL; - zend_fcall_info file_fci = empty_fcall_info; - zend_fcall_info_cache file_fcc = empty_fcall_info_cache; - zend_fcall_info hunk_fci = empty_fcall_info; - zend_fcall_info_cache hunk_fcc = empty_fcall_info_cache; - zend_fcall_info line_fci = empty_fcall_info; - zend_fcall_info_cache line_fcc = empty_fcall_info_cache; - php_git2_multi_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfffz", &diff, &file_fci, &file_fcc, &hunk_fci, &hunk_fcc, &line_fci, &line_fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_multi_cb_init(&cb, payload TSRMLS_CC, 3, - &file_fci, &file_fcc, - &hunk_fci, &hunk_fcc, - &line_fci, &line_fcc - ); - - result = git_diff_foreach(PHP_GIT2_V(_diff, diff), php_git2_git_diff_file_cb, php_git2_git_diff_hunk_cb, php_git2_git_diff_line_cb, cb); - php_git2_multi_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto string git_diff_status_char( $status) - */ -PHP_FUNCTION(git_diff_status_char) -{ - char result; - long status = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "l", &status) == FAILURE) { - return; - } - - result = git_diff_status_char(status); - RETURN_STRINGL(&result, 1, 1); -} -/* }}} */ - -/* {{{ proto long git_diff_print(resource $diff, long $format, Callable $print_cb, $payload) - */ -PHP_FUNCTION(git_diff_print) -{ - int result = 0; - zval *diff = NULL, *payload = NULL; - php_git2_t *_diff = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_multi_cb_t *cb = NULL; - long format = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlfz", &diff, &format, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_multi_cb_init(&cb, payload TSRMLS_CC, 3, &empty_fcall_info, &empty_fcall_info_cache, &empty_fcall_info, &empty_fcall_info_cache, &fci, &fcc)) { - RETURN_FALSE; - } - result = git_diff_print(PHP_GIT2_V(_diff, diff), format, php_git2_git_diff_line_cb, cb); - php_git2_multi_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_diff_blobs(resource $old_blob, string $old_as_path, resource $new_blob, string $new_as_path, $options, Callable $file_cb, Callable $hunk_cb, Callable $line_cb, $payload) - */ -PHP_FUNCTION(git_diff_blobs) -{ - int result = 0, old_as_path_len = 0, new_as_path_len = 0; - zval *old_blob = NULL, *new_blob = NULL, *options = NULL, *payload = NULL; - php_git2_t *_old_blob = NULL, *_new_blob = NULL; - char *old_as_path = NULL, *new_as_path = NULL; - zend_fcall_info file_fci = empty_fcall_info; - zend_fcall_info_cache file_fcc = empty_fcall_info_cache; - zend_fcall_info hunk_fci = empty_fcall_info; - zend_fcall_info_cache hunk_fcc = empty_fcall_info_cache; - zend_fcall_info line_fci = empty_fcall_info; - zend_fcall_info_cache line_fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsrsafffz", &old_blob, &old_as_path, &old_as_path_len, &new_blob, &new_as_path, &new_as_path_len, &options, - &file_fci, &file_fcc, &hunk_fci, &hunk_fcc, &line_fci, &line_fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_old_blob, php_git2_t*, &old_blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_new_blob, php_git2_t*, &new_blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_multi_cb_init(&cb, payload TSRMLS_CC, 3, - &file_fci, &file_fcc, - &hunk_fci, &hunk_fcc, - &line_fci, &line_fcc - ); - result = git_diff_blobs( - PHP_GIT2_V(_old_blob, blob), old_as_path, - PHP_GIT2_V(_new_blob, blob), new_as_path, NULL, - php_git2_git_diff_file_cb, php_git2_git_diff_hunk_cb, php_git2_git_diff_line_cb, cb); - php_git2_multi_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_diff_blob_to_buffer(resource $old_blob, string $old_as_path, string $buffer, long $buffer_len, string $buffer_as_path, $options, Callable $file_cb, Callable $hunk_cb, Callable $line_cb, $payload) - */ -PHP_FUNCTION(git_diff_blob_to_buffer) -{ - int result = 0, old_as_path_len = 0, buffer_len = 0, buffer_as_path_len = 0; - zval *old_blob = NULL, *options = NULL, *payload = NULL; - php_git2_t *_old_blob = NULL; - char *old_as_path = NULL, *buffer = NULL, *buffer_as_path = NULL; - zend_fcall_info file_fci = empty_fcall_info; - zend_fcall_info_cache file_fcc = empty_fcall_info_cache; - zend_fcall_info hunk_fci = empty_fcall_info; - zend_fcall_info_cache hunk_fcc = empty_fcall_info_cache; - zend_fcall_info line_fci = empty_fcall_info; - zend_fcall_info_cache line_fcc = empty_fcall_info_cache; - php_git2_multi_cb_t *cb = NULL; - git_diff_options opts = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsslsafffz", &old_blob, &old_as_path, &old_as_path_len, - &buffer, &buffer_len, &buffer_len, &buffer_as_path, &buffer_as_path_len, &options, - &file_fci, &file_fcc, &hunk_fci, &hunk_fcc, &line_fci, &line_fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_old_blob, php_git2_t*, &old_blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_multi_cb_init(&cb, payload TSRMLS_CC, 3, - &file_fci, &file_fcc, - &hunk_fci, &hunk_fcc, - &line_fci, &line_fcc - ); - result = git_diff_blob_to_buffer( - PHP_GIT2_V(_old_blob, blob), old_as_path, - buffer, buffer_len, buffer_as_path, - &opts, - php_git2_git_diff_file_cb, php_git2_git_diff_hunk_cb, php_git2_git_diff_line_cb, cb); - php_git2_multi_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ diff --git a/diff.h b/diff.h deleted file mode 100644 index 2f3b99c872..0000000000 --- a/diff.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_DIFF_H -#define PHP_GIT2_DIFF_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_free, 0, 0, 1) - ZEND_ARG_INFO(0, diff) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_tree_to_tree, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, old_tree) - ZEND_ARG_INFO(0, new_tree) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_tree_to_index, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, old_tree) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_index_to_workdir, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_tree_to_workdir, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, old_tree) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_tree_to_workdir_with_index, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, old_tree) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_merge, 0, 0, 2) - ZEND_ARG_INFO(0, onto) - ZEND_ARG_INFO(0, from) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_find_similar, 0, 0, 2) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_options_init, 0, 0, 2) - ZEND_ARG_INFO(0, options) - ZEND_ARG_INFO(0, version) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_num_deltas, 0, 0, 1) - ZEND_ARG_INFO(0, diff) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_num_deltas_of_type, 0, 0, 2) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_get_delta, 0, 0, 2) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, idx) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_is_sorted_icase, 0, 0, 1) - ZEND_ARG_INFO(0, diff) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_foreach, 0, 0, 5) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, file_cb) - ZEND_ARG_INFO(0, hunk_cb) - ZEND_ARG_INFO(0, line_cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_status_char, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_print, 0, 0, 4) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, print_cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_blobs, 0, 0, 9) - ZEND_ARG_INFO(0, old_blob) - ZEND_ARG_INFO(0, old_as_path) - ZEND_ARG_INFO(0, new_blob) - ZEND_ARG_INFO(0, new_as_path) - ZEND_ARG_INFO(0, options) - ZEND_ARG_INFO(0, file_cb) - ZEND_ARG_INFO(0, hunk_cb) - ZEND_ARG_INFO(0, line_cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_diff_blob_to_buffer, 0, 0, 10) - ZEND_ARG_INFO(0, old_blob) - ZEND_ARG_INFO(0, old_as_path) - ZEND_ARG_INFO(0, buffer) - ZEND_ARG_INFO(0, buffer_len) - ZEND_ARG_INFO(0, buffer_as_path) - ZEND_ARG_INFO(0, options) - ZEND_ARG_INFO(0, file_cb) - ZEND_ARG_INFO(0, hunk_cb) - ZEND_ARG_INFO(0, line_cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -/* {{{ proto void git_diff_free(diff) -*/ -PHP_FUNCTION(git_diff_free); - -/* {{{ proto resource git_diff_tree_to_tree(repo, old_tree, new_tree, opts) -*/ -PHP_FUNCTION(git_diff_tree_to_tree); - -/* {{{ proto resource git_diff_tree_to_index(repo, old_tree, index, opts) -*/ -PHP_FUNCTION(git_diff_tree_to_index); - -/* {{{ proto resource git_diff_index_to_workdir(repo, index, opts) -*/ -PHP_FUNCTION(git_diff_index_to_workdir); - -/* {{{ proto resource git_diff_tree_to_workdir(repo, old_tree, opts) -*/ -PHP_FUNCTION(git_diff_tree_to_workdir); - -/* {{{ proto resource git_diff_tree_to_workdir_with_index(repo, old_tree, opts) -*/ -PHP_FUNCTION(git_diff_tree_to_workdir_with_index); - -/* {{{ proto long git_diff_merge(onto, from) -*/ -PHP_FUNCTION(git_diff_merge); - -/* {{{ proto long git_diff_find_similar(diff, options) -*/ -PHP_FUNCTION(git_diff_find_similar); - -/* {{{ proto long git_diff_options_init(options, version) -*/ -PHP_FUNCTION(git_diff_options_init); - -/* {{{ proto resource git_diff_num_deltas(diff) -*/ -PHP_FUNCTION(git_diff_num_deltas); - -/* {{{ proto resource git_diff_num_deltas_of_type(diff, type) -*/ -PHP_FUNCTION(git_diff_num_deltas_of_type); - -/* {{{ proto resource git_diff_get_delta(diff, idx) -*/ -PHP_FUNCTION(git_diff_get_delta); - -/* {{{ proto long git_diff_is_sorted_icase(diff) -*/ -PHP_FUNCTION(git_diff_is_sorted_icase); - -/* {{{ proto long git_diff_foreach(diff, file_cb, hunk_cb, line_cb, payload) -*/ -PHP_FUNCTION(git_diff_foreach); - -/* {{{ proto resource git_diff_status_char(status) -*/ -PHP_FUNCTION(git_diff_status_char); - -/* {{{ proto long git_diff_print(diff, format, print_cb, payload) -*/ -PHP_FUNCTION(git_diff_print); - -/* {{{ proto long git_diff_blobs(old_blob, old_as_path, new_blob, new_as_path, options, file_cb, hunk_cb, line_cb, payload) -*/ -PHP_FUNCTION(git_diff_blobs); - -/* {{{ proto long git_diff_blob_to_buffer(old_blob, old_as_path, buffer, buffer_len, buffer_as_path, options, file_cb, hunk_cb, line_cb, payload) -*/ -PHP_FUNCTION(git_diff_blob_to_buffer); - - -#endif \ No newline at end of file diff --git a/example/blame.php b/example/blame.php deleted file mode 100644 index 66e6ca70b3..0000000000 --- a/example/blame.php +++ /dev/null @@ -1,25 +0,0 @@ -", $hunk['final_signature']['name'], $hunk['final_signature']['email']); - printf("%s ( %-30s, %4d) %s\n", substr($hunk['final_commit_id'], 10), - $sig, - $i+1, - $data - ); - $i++; -} \ No newline at end of file diff --git a/example/clone.php b/example/clone.php deleted file mode 100644 index 4b671805b1..0000000000 --- a/example/clone.php +++ /dev/null @@ -1,2 +0,0 @@ - "chobie filter", - "initialize" => function () { - echo "\e[32m# Initialize\e[m\n"; - }, - "check" => function ($payload, $src, $attr) { - echo "\e[32m# Check\e[m\n"; - var_dump($src); - var_dump($attr); - - // return true means apply filter to this file. - return true; - }, - "apply" => function ($payload, $from, $src) { - echo "\e[32m# Apply\e[m\n"; - // apply function should return string or GIT_PASSTHROUGH - return preg_replace("/\s/", "", $from); - }, - "shutdown" => function () { - echo "\n\e[32m# Shutdown\e[m\n"; - }, - "cleanup" => function () { - echo "\e[32m# clean up\e[m\n"; - } -); - -$v = git_filter_new($a); -git_filter_register("chobie", $v, 100); - -$blob = git_blob_lookup($repo, "74f5770df516cbbef16372a7628a9528277637d6"); -$l = git_filter_list_load($repo, $blob, "example/diff.php", GIT_FILTER_SMUDGE); - -echo "\e[32m# <<< ORIGINAL CONTENT >>>\e[m\n"; -echo git_blob_rawcontent($blob); - -echo "\e[32m# <<< FILTERED CONTENT >>>\e[m\n"; -$out = git_filter_list_apply_to_blob($l, $blob); -echo $out; diff --git a/example/odb_backend.php b/example/odb_backend.php deleted file mode 100644 index fc83a8225a..0000000000 --- a/example/odb_backend.php +++ /dev/null @@ -1,103 +0,0 @@ - function($oid){ - echo "\e[32m# read $oid\e[m\n"; - return array( - Pool::$pool[$oid][0], - Pool::$pool[$oid][1], - ); - }, - "read_prefix" => function($short_oid){ - echo "\e[32m# read_prefix $short_oid\e[m\n"; - - $actual_oid = null; - foreach (Pool::$pool as $key => $value) { - if (preg_match("/^{$short_oid}/", $key)) { - $actual_oid = $key; - break; - } - } - - return array( - Pool::$pool[$actual_oid][0], - Pool::$pool[$actual_oid][1], - $actual_oid, - ); - }, - "read_header" => function($oid) { - echo "\e[32m# read header$oid\e[m\n"; - return array( - strlen(Pool::$pool[$oid][0]), - Pool::$pool[$oid][1], - ); - }, - "write" => function($oid, $buffer, $otype) { - echo "\e[32m# write $oid\e[m\n"; - Pool::$pool[$oid] = array($buffer, $otype); - }, - "writestream" => function() { - - }, - "readstream" => function() { - - }, - "exists" => function($oid) { - $retval = 0; - if (isset(Pool::$pool[$oid])) { - $retval = 1; - } - - echo "\e[32m# exists $retval\e[m\n"; - return $retval; - }, - "refresh" => function() { - echo "\e[32m# refreshed!\e[m\n"; - }, - "foreach" => function($foreach_cb, &$payload) { // this payload was passed by git_odb_foreach callback. - echo "\e[32m# foreach (iterate all backends)\e[m\n"; - foreach (Pool::$pool as $oid => $value) { - $retval = $foreach_cb($oid, $payload); - if ($retval == GIT_EUSER) { - return $retval; - } - } - return 0; - }, - "writepack" => function() { - - }, - "free" => function() { - echo "\e[32m# free'd!\e[m\n"; - } -); -$memory_backend = git_odb_backend_new($a); - -$repo = git_repository_open("."); -$odb = git_repository_odb($repo); -git_odb_add_backend($odb, $memory_backend, 1000); - -$oid = git_odb_write($odb, "Helo World(php memory backend)", GIT_OBJ_BLOB); -$obj = git_odb_read($odb, $oid); - -echo git_odb_object_data($obj); -echo "\n"; - -$header = git_odb_read_header($odb, $oid); -var_dump($header); // size, otype - -$obj = git_odb_read_prefix($odb, substr($oid, 0, 10)); -var_dump($obj); - -$payload = array(); -git_odb_foreach($odb, function($oid, &$payload) { - echo "."; -}, $payload); -echo PHP_EOL; -git_odb_refresh($odb); -exit; diff --git a/example/odb_foreach.php b/example/odb_foreach.php deleted file mode 100644 index f3655fb318..0000000000 --- a/example/odb_foreach.php +++ /dev/null @@ -1,8 +0,0 @@ - function($url, $username_from_url, $allowed_types, &$payload) { - // NOTE(chobie): you need to build with LibSSH2 when communicating with ssh protocol. */ - if ($allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT) { - return git_cred_userpass_plaintext_new("chobie", getenv("GITHUB_TOKEN")); - } else { - error_log("not supported allowed types"); - } -}]; - -git_remote_set_callbacks($remote, $remote_callbacks); -if (git_remote_connect($remote, GIT_DIRECTION_PUSH)) { - $push = git_push_new($remote); - - git_push_add_refspec($push, "refs/heads/master:refs/heads/master"); - git_push_finish($push); - git_push_unpack_ok($push); - - git_push_status_foreach($push, function($ref, $name, &$payload){ - var_dump($ref, $name, $payload); - }, $payload); - - git_push_update_tips($push); - git_remote_disconnect($remote); -} diff --git a/example/ref_lookup.php b/example/ref_lookup.php deleted file mode 100644 index de7e40629b..0000000000 --- a/example/ref_lookup.php +++ /dev/null @@ -1,6 +0,0 @@ -...\" to unstage)\n"); -printf("#\n"); - -$cnt = git_status_list_entrycount($list); -for ($i = 0; $i < $cnt; $i++) { - $entry = git_status_byindex($list, $i); - $flags = $entry['status']; - $stat = getStat($flags); - - if (is_array($entry['head_to_index'])) { - printf("# %15s %s\n", $stat, $entry['head_to_index']['new_file']['path']); - } -} - -printf("#\n"); -printf("# Changes not staged for commit:\n"); -printf("# (use \"git add ...\" to update what will be committed)\n"); -printf("# (use \"git checkout -- ...\" to discard changes in working directory)\n"); -printf("#\n"); - -for ($i = 0; $i < $cnt; $i++) { - $entry = git_status_byindex($list, $i); - $flags = $entry['status']; - $stat = getStat($flags); - - if (is_array($entry['index_to_workdir'])) { - printf("# %15s %s\n", $stat, $entry['index_to_workdir']['new_file']['path']); - } -} -printf("#\n"); - - -function getStat($flags) -{ - $stat = ""; - if ($flags & GIT_STATUS_IGNORED) { - return; - } - if ($flags == GIT_STATUS_CURRENT) { - return; - } - if ($flags & GIT_STATUS_INDEX_NEW){ - $stat = "new file:"; - } - if ($flags & GIT_STATUS_WT_NEW) { - $stat = "untracked:"; - } - if ($flags & GIT_STATUS_INDEX_MODIFIED ||$flags & GIT_STATUS_WT_MODIFIED) { - $stat = "modified:"; - } - if ($flags & GIT_STATUS_INDEX_DELETED || $flags & GIT_STATUS_WT_DELETED) { - $stat = "deleted:"; - } - if ($flags & GIT_STATUS_INDEX_RENAMED || $flags & GIT_STATUS_WT_RENAMED) { - $stat = "renamed:"; - } - if ($flags & GIT_STATUS_INDEX_TYPECHANGE || $flags & GIT_STATUS_WT_TYPECHANGE) { - $stat = "typechange:"; - } - return $stat; -} \ No newline at end of file diff --git a/example/submodule.php b/example/submodule.php deleted file mode 100644 index 23313573fe..0000000000 --- a/example/submodule.php +++ /dev/null @@ -1,9 +0,0 @@ - + + + + + + + Examples — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

Predefined Constants

+

Next topic

+

Git\Backend

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Examples

+

php-git examples.these example uses experimental API.

+
+

Create new blob

+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$blob = new Git\Blob($repository);
+$blob->setContent("First Object1");
+$blobHash = $blob->write();
+
+
+

GitBlob::setContent

+
+

Note

+

maybe this API will change next release.

+
+
+
+

Create new Tree

+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$tree = new Git\Tree($repository);
+$tree->add($hash,"README",100644);
+$tree_hash = $tree->write();
+
+
+

GitTree::add

+
+

Note

+

maybe this API will change next release.

+
+
+
+

Create new Commit

+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$tree = new Git\Tree($repository);
+$tree->add($hash,"README",100644);
+$tree_hash = $tree->write();
+$commit = new Git\Commit($repository);
+$commit->setAuthor(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo"))));
+$commit->setCommitter(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo"))));
+$commit->setTree($tree->getId());
+// when first commit. you dont call setParent.
+//$commit->setParent($last_commit->getParent()->getId());
+$commit->setMessage("initial import");
+
+$master_hash = $commit->write();
+
+
+

GitTree::add +GitCommit::setAuthor +GitCommit::setCommitter +GitCommit::setTree +GitCommit::setParent +GitCommit::setMessage

+
+

Note

+

php-git can’t manage multiple parents now. this will fix next release.

+
+
+
+

get master tree

+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$master_commit = $repository->getCommit($repository->lookupRef("refs/heads/master"));
+$tree = $master_commit->getTree();
+// or $tree->getEntries()
+foreach($tree->getIterator() as $entry){
+   var_dump($entry);
+}
+
+
+
+
+

revision walking

+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$master_commit = $repository->getCommit($repository->lookupRef("refs/heads/master"));
+$walker = $master_commit->getWalker();
+$walker->push($master_commit->getId());
+while($commit = $walker->next()){
+    var_dump($commit);
+}
+
+
+
+
+

custom backends

+

see also Git\Repository\addBackend

+
+
+

get available references

+
+

Note

+

maybe this API will change next release.

+
+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repository);
+$manager->getList();
+
+
+

Git\Reference\Manager

+

this method gets available all references.if you want gets available branches.you have to check manualy now.

+
<?php
+$repository = new Git\Repository("/path/to/repository/.git");
+$manager = new Git\Reference\Manager($repository);
+$branches = array();
+foreach($manager->getList() as $ref){
+   if(strpos($ref->name,"refs/heads")){
+       $brandhes[] $ref;
+   }
+}
+
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/fe.php b/fe.php deleted file mode 100644 index da2f61e4e7..0000000000 --- a/fe.php +++ /dev/null @@ -1,9 +0,0 @@ -multi; - const unsigned char *ptr = self->attributes; - int last_is_space = 0; - int attribute_count = 0, len = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - if (self->attributes != NULL) { - while (*ptr != '\0') { - if (*ptr == 0x09 || *ptr == 0x20 && last_is_space == 0) { - attribute_count++; - } - - if (*ptr == 0x09 || *ptr == 0x20) { - last_is_space = 1; - } else { - last_is_space = 0; - } - ptr++; - len++; - } - if (len > 0) { - attribute_count++; - } - } - - MAKE_STD_ZVAL(param_payload); - MAKE_STD_ZVAL(param_source); - MAKE_STD_ZVAL(param_attr); - ZVAL_NULL(param_payload); - if (php_git2_make_resource(&filter_source, PHP_GIT2_TYPE_FILTER_SOURCE, src, 0 TSRMLS_CC)) { - return GIT_EUSER; - } - ZVAL_RESOURCE(param_source, GIT2_RVAL_P(filter_source)); - - array_init(param_attr); - - if (attribute_count > 0) { - int y = 0; - for (y = 0; y < attribute_count; y++) { - if (GIT_ATTR_TRUE(attr_values[y])) { - add_next_index_bool(param_attr, 1); - } else if (GIT_ATTR_FALSE(attr_values[y])) { - add_next_index_bool(param_attr, 0); - } else if (GIT_ATTR_UNSPECIFIED(attr_values[y])) { - add_next_index_null(param_attr); - } else { - add_next_index_string(param_attr, attr_values[y], 1); - } - } - } else { - } - - if (php_git2_call_function_v(&p->callbacks[2].fci, &p->callbacks[2].fcc TSRMLS_CC, &retval_ptr, 3, - ¶m_payload, ¶m_source, ¶m_attr)) { - return GIT_EUSER; - } - - if (retval_ptr) { - result = Z_LVAL_P(retval_ptr); - - /* NOTE(chobie): adjust return value */ - if (result == 0) { - result = GIT_PASSTHROUGH; - } else if (result == 1) { - result = 0; - } - } - zval_ptr_dtor(&retval_ptr); - - return result; -} - -static void php_git2_git_filter_shutdown_fn(git_filter *self) -{ - zval *param_self = NULL, *param_payload = NULL, *retval_ptr = NULL; - php_git2_filter *filter = (php_git2_filter*)self; - php_git2_multi_cb_t *p = filter->multi; - GIT2_TSRMLS_SET(p->tsrm_ls) - - MAKE_STD_ZVAL(param_self); - MAKE_STD_ZVAL(param_payload); - ZVAL_NULL(param_self); - ZVAL_NULL(param_payload); - - if (php_git2_call_function_v(&p->callbacks[1].fci, &p->callbacks[1].fcc TSRMLS_CC, &retval_ptr, 2, ¶m_self, ¶m_payload)) { - } - zval_ptr_dtor(&retval_ptr); -} - -static int php_git2_git_filter_init_fn(git_filter *self) -{ - zval *param_self = NULL, *param_payload = NULL, *retval_ptr = NULL; - php_git2_filter *filter = (php_git2_filter*)self; - php_git2_multi_cb_t *p = filter->multi; - GIT2_TSRMLS_SET(p->tsrm_ls) - - MAKE_STD_ZVAL(param_self); - MAKE_STD_ZVAL(param_payload); - ZVAL_NULL(param_self); - ZVAL_NULL(param_payload); - - if (php_git2_call_function_v(&p->callbacks[0].fci, &p->callbacks[0].fcc TSRMLS_CC, &retval_ptr, 2, ¶m_self, ¶m_payload)) { - } - zval_ptr_dtor(&retval_ptr); -} - -static int php_git2_git_filter_apply_fn( - git_filter *self, - void **payload, /* may be read and/or set */ - git_buf *to, - const git_buf *from, - const git_filter_source *src) -{ - php_git2_filter *filter = (php_git2_filter*)self; - php_git2_t *filter_source; - zval *param_payload = NULL, *param_from = NULL, *param_src = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = filter->multi; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - MAKE_STD_ZVAL(param_payload); - MAKE_STD_ZVAL(param_from); - MAKE_STD_ZVAL(param_src); - ZVAL_NULL(param_payload); - ZVAL_STRINGL(param_from, from->ptr, from->size, 1); - if (php_git2_make_resource(&filter_source, PHP_GIT2_TYPE_FILTER_SOURCE, src, 0 TSRMLS_CC)) { - return GIT_EUSER; - } - ZVAL_RESOURCE(param_src, GIT2_RVAL_P(filter_source)); - - if (php_git2_call_function_v(&p->callbacks[3].fci, &p->callbacks[3].fcc TSRMLS_CC, &retval_ptr, 3, - ¶m_payload, ¶m_from, ¶m_src)) { - return GIT_EUSER; - } - - if (retval_ptr) { - if (Z_TYPE_P(retval_ptr) == IS_LONG) { - retval = Z_LVAL_P(retval_ptr); - } else { - if (Z_TYPE_P(retval_ptr) != IS_STRING) { - convert_to_string(retval_ptr); - } - git_buf_set(to, Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr)); - } - } - - zval_ptr_dtor(&retval_ptr); - return retval; -} - -static void php_git2_git_filter_cleanup_fn( - git_filter *self, - void *payload) -{ - zval *param_self = NULL, *param_payload = NULL, *retval_ptr = NULL; - php_git2_filter *filter = (php_git2_filter*)self; - php_git2_multi_cb_t *p = filter->multi; - GIT2_TSRMLS_SET(p->tsrm_ls) - - MAKE_STD_ZVAL(param_self); - MAKE_STD_ZVAL(param_payload); - ZVAL_NULL(param_self); - ZVAL_NULL(param_payload); - - if (php_git2_call_function_v(&p->callbacks[4].fci, &p->callbacks[4].fcc TSRMLS_CC, &retval_ptr, 2, ¶m_self, ¶m_payload)) { - } -} - -/* {{{ proto long git_filter_list_load(resource $repo, resource $blob, string $path, $mode) - */ -PHP_FUNCTION(git_filter_list_load) -{ - int result = 0, path_len = 0; - git_filter_list *filters = NULL; - zval *repo = NULL, *blob = NULL; - php_git2_t *_repo = NULL, *_blob = NULL, *_result; - char *path = NULL; - long mode = 0; - git_blob *__blob = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r|zsl", &repo, &blob, &path, &path_len, &mode) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - if (blob != NULL && Z_TYPE_P(blob) == IS_RESOURCE) { - ZEND_FETCH_RESOURCE(_blob, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - __blob = PHP_GIT2_V(_blob, blob); - } - - result = git_filter_list_load(&filters, PHP_GIT2_V(_repo, repository), blob, path, mode); - if (php_git2_check_error(result, "git_filter_list_load" TSRMLS_CC)) { - RETURN_FALSE - } - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_FILTER_LIST, filters, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto resource git_filter_list_apply_to_data(resource $filters, resource $in) - */ -PHP_FUNCTION(git_filter_list_apply_to_data) -{ - php_git2_t *_filters = NULL, *_in = NULL; - git_buf out = {0}; - zval *filters = NULL, *in = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &filters, &in) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_filters, php_git2_t*, &filters, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_in, php_git2_t*, &in, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_filter_list_apply_to_data(&out, PHP_GIT2_V(_filters, filter_list), PHP_GIT2_V(_in, buf)); - if (php_git2_check_error(error, "git_filter_list_apply_to_data" TSRMLS_CC)) { - RETURN_FALSE; - } - RETVAL_STRINGL(out.ptr, out.size, 1); - git_buf_free(&out); -} -/* }}} */ - -/* {{{ proto resource git_filter_list_apply_to_file(resource $filters, resource $repo, string $path) - */ -PHP_FUNCTION(git_filter_list_apply_to_file) -{ - php_git2_t *_filters = NULL, *_repo = NULL; - git_buf out = {0}; - zval *filters = NULL, *repo = NULL; - char *path = NULL; - int path_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrs", &filters, &repo, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_filters, php_git2_t*, &filters, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_filter_list_apply_to_file(&out, PHP_GIT2_V(_filters, filter_list), PHP_GIT2_V(_repo, repository), path); - if (php_git2_check_error(error, "git_filter_list_apply_to_file" TSRMLS_CC)) { - RETURN_FALSE; - } - RETVAL_STRINGL(out.ptr, out.size, 1); - git_buf_free(&out); -} -/* }}} */ - -/* {{{ proto resource git_filter_list_apply_to_blob(resource $filters, resource $blob) - */ -PHP_FUNCTION(git_filter_list_apply_to_blob) -{ - php_git2_t *result = NULL, *_filters = NULL, *_blob = NULL; - git_buf out = {0}; - zval *filters = NULL, *blob = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &filters, &blob) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_filters, php_git2_t*, &filters, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_blob, php_git2_t*, &blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_filter_list_apply_to_blob(&out, PHP_GIT2_V(_filters, filter_list), PHP_GIT2_V(_blob, blob)); - if (php_git2_check_error(error, "git_filter_list_apply_to_blob" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_BUF, &out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - RETVAL_STRINGL(out.ptr, out.size, 1); - git_buf_free(&out); -} -/* }}} */ - -/* {{{ proto void git_filter_list_free(resource $filters) - */ -PHP_FUNCTION(git_filter_list_free) -{ - zval *filters = NULL; - php_git2_t *_filters = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &filters) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_filters, php_git2_t*, &filters, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_filters)) { - git_filter_list_free(PHP_GIT2_V(_filters, filter_list)); - GIT2_SHOULD_FREE(_filters) = 0; - }; - zval_ptr_dtor(&filters); -} -/* }}} */ - - -/* sys/filter */ - -/* {{{ proto resource git_filter_lookup(string $name) - */ -PHP_FUNCTION(git_filter_lookup) -{ - git_filter *result = NULL; - char *name = NULL; - int name_len = 0; - zval *filter; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &name, &name_len) == FAILURE) { - return; - } - - result = git_filter_lookup(name); - if (result == NULL) { - RETURN_FALSE; - } - MAKE_STD_ZVAL(filter); - array_init(filter); - add_assoc_long_ex(filter, ZEND_STRS("version"), result->version); - - RETURN_ZVAL(filter, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_filter_list_new(resource $repo, $mode) - */ -PHP_FUNCTION(git_filter_list_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_filter_list *out = NULL; - zval *repo = NULL; - long mode = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &repo, &mode) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_filter_list_new(&out, PHP_GIT2_V(_repo, repository), mode); - if (php_git2_check_error(error, "git_filter_list_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_FILTER_LIST, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_filter_list_push(resource $fl, resource $filter, mixed $payload) - */ -PHP_FUNCTION(git_filter_list_push) -{ - int result = 0; - zval *fl = NULL, *filter = NULL, *payload = NULL; - php_git2_t *_fl = NULL, *_filter = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr|z", &fl, &filter, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_fl, php_git2_t*, &fl, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_filter, php_git2_t*, &filter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_list_push(PHP_GIT2_V(_fl, filter_list), PHP_GIT2_V(_filter, filter), NULL); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_filter_list_length(resource $fl) - */ -PHP_FUNCTION(git_filter_list_length) -{ - size_t result = 0; - zval *fl = NULL; - php_git2_t *_fl = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &fl) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_fl, php_git2_t*, &fl, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_list_length(PHP_GIT2_V(_fl, filter_list)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_filter_source_repo(resource $src) - */ -PHP_FUNCTION(git_filter_source_repo) -{ - git_repository *result = NULL; - zval *src = NULL; - php_git2_t *_src = NULL, *_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &src) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_src, php_git2_t*, &src, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_source_repo(PHP_GIT2_V(_src, filter_source)); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_REPOSITORY, result, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto string git_filter_source_path(resource $src) - */ -PHP_FUNCTION(git_filter_source_path) -{ - const char *result = NULL; - zval *src = NULL; - php_git2_t *_src = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &src) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_src, php_git2_t*, &src, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_source_path(PHP_GIT2_V(_src, filter_source)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto long git_filter_source_filemode(resource $src) - */ -PHP_FUNCTION(git_filter_source_filemode) -{ - uint16_t result = 0; - zval *src = NULL; - php_git2_t *_src = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &src) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_src, php_git2_t*, &src, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_source_filemode(PHP_GIT2_V(_src, filter_source)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_filter_source_id(resource $src) - */ -PHP_FUNCTION(git_filter_source_id) -{ - const git_oid *result = NULL; - zval *src = NULL; - php_git2_t *_src = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &src) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_src, php_git2_t*, &src, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_source_id(PHP_GIT2_V(_src, filter_source)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto long git_filter_source_mode(resource $src) - */ -PHP_FUNCTION(git_filter_source_mode) -{ - git_filter_mode_t result; - zval *src = NULL; - php_git2_t *_src = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &src) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_src, php_git2_t*, &src, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_source_mode(PHP_GIT2_V(_src, filter_source)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_filter_register(string $name, resource $filter, long $priority) - */ -PHP_FUNCTION(git_filter_register) -{ - int result = 0, name_len = 0; - char *name = NULL; - zval *filter = NULL; - php_git2_t *_filter = NULL; - long priority = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "srl", &name, &name_len, &filter, &priority) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_filter, php_git2_t*, &filter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_filter_register(name, PHP_GIT2_V(_filter, filter), priority); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_filter_unregister(string $name) - */ -PHP_FUNCTION(git_filter_unregister) -{ - int result = 0, name_len = 0; - char *name = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &name, &name_len) == FAILURE) { - return; - } - - result = git_filter_unregister(name); - RETURN_LONG(result); -} -/* }}} */ - -PHP_FUNCTION(git_filter_new) -{ - git_filter *filter = NULL; - php_git2_t *result = NULL; - php_git2_filter *_filter = NULL; - zval *mixed = NULL, *tmp = NULL; - zend_fcall_info initialize_fci, shutdown_fci, check_fci, apply_fci, cleanup_fci; - zend_fcall_info_cache initialize_fcc, shutdown_fcc, check_fcc, apply_fcc, cleanup_fcc; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "a", &mixed) == FAILURE) { - return; - } - - _filter = (php_git2_filter*)ecalloc(1, sizeof(php_git2_filter)); - filter = (git_filter*)&_filter->super; - filter->version = GIT_FILTER_VERSION; - filter->attributes = php_git2_read_arrval_string(mixed, ZEND_STRS("attributes") TSRMLS_CC); - - if (tmp = php_git2_read_arrval(mixed, ZEND_STRS("initialize") TSRMLS_CC)) { - php_git2_fcall_info_wrapper2(tmp, &initialize_fci, &initialize_fcc TSRMLS_CC); - } - if (tmp = php_git2_read_arrval(mixed, ZEND_STRS("shutdown") TSRMLS_CC)) { - php_git2_fcall_info_wrapper2(tmp, &shutdown_fci, &shutdown_fcc TSRMLS_CC); - } - if (tmp = php_git2_read_arrval(mixed, ZEND_STRS("check") TSRMLS_CC)) { - php_git2_fcall_info_wrapper2(tmp, &check_fci, &check_fcc TSRMLS_CC); - } - if (tmp = php_git2_read_arrval(mixed, ZEND_STRS("apply") TSRMLS_CC)) { - php_git2_fcall_info_wrapper2(tmp, &apply_fci, &apply_fcc TSRMLS_CC); - } - if (tmp = php_git2_read_arrval(mixed, ZEND_STRS("cleanup") TSRMLS_CC)) { - php_git2_fcall_info_wrapper2(tmp, &cleanup_fci, &cleanup_fcc TSRMLS_CC); - } - - filter->initialize = php_git2_git_filter_init_fn; - filter->shutdown = php_git2_git_filter_shutdown_fn; - filter->check = php_git2_git_filter_check_fn; - filter->apply = php_git2_git_filter_apply_fn; - filter->cleanup = php_git2_git_filter_cleanup_fn; - - Z_ADDREF_P(mixed); - php_git2_multi_cb_init(&_filter->multi, mixed TSRMLS_CC, 5, - &initialize_fci, &initialize_fcc, - &shutdown_fci, &shutdown_fcc, - &check_fci, &check_fcc, - &apply_fci, &apply_fcc, - &cleanup_fci, &cleanup_fcc - ); - - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_FILTER, filter, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} diff --git a/filter.h b/filter.h deleted file mode 100644 index c24bc8a056..0000000000 --- a/filter.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_FILTER_H -#define PHP_GIT2_FILTER_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_load, 0, 0, 1) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, blob) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, mode) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_apply_to_data, 0, 0, 2) - ZEND_ARG_INFO(0, filters) - ZEND_ARG_INFO(0, in) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_apply_to_file, 0, 0, 3) - ZEND_ARG_INFO(0, filters) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_apply_to_blob, 0, 0, 2) - ZEND_ARG_INFO(0, filters) - ZEND_ARG_INFO(0, blob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_free, 0, 0, 1) - ZEND_ARG_INFO(0, filters) -ZEND_END_ARG_INFO() - - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_lookup, 0, 0, 1) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_new, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, mode) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_push, 0, 0, 3) - ZEND_ARG_INFO(0, fl) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_list_length, 0, 0, 1) - ZEND_ARG_INFO(0, fl) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_source_repo, 0, 0, 1) - ZEND_ARG_INFO(0, src) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_source_path, 0, 0, 1) - ZEND_ARG_INFO(0, src) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_source_filemode, 0, 0, 1) - ZEND_ARG_INFO(0, src) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_source_id, 0, 0, 1) - ZEND_ARG_INFO(0, src) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_source_mode, 0, 0, 1) - ZEND_ARG_INFO(0, src) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_register, 0, 0, 3) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_INFO(0, priority) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_unregister, 0, 0, 1) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_filter_new, 0, 0, 1) - ZEND_ARG_INFO(0, payload) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_filter_list_load(repo, blob, path, mode) -*/ -PHP_FUNCTION(git_filter_list_load); - -/* {{{ proto resource git_filter_list_apply_to_data(filters, in) -*/ -PHP_FUNCTION(git_filter_list_apply_to_data); - -/* {{{ proto resource git_filter_list_apply_to_file(filters, repo, path) -*/ -PHP_FUNCTION(git_filter_list_apply_to_file); - -/* {{{ proto resource git_filter_list_apply_to_blob(filters, blob) -*/ -PHP_FUNCTION(git_filter_list_apply_to_blob); - -/* {{{ proto void git_filter_list_free(filters) -*/ -PHP_FUNCTION(git_filter_list_free); - -/* {{{ proto resource git_filter_lookup(name) -*/ -PHP_FUNCTION(git_filter_lookup); - -/* {{{ proto resource git_filter_list_new(repo, mode) -*/ -PHP_FUNCTION(git_filter_list_new); - -/* {{{ proto long git_filter_list_push(fl, filter, payload) -*/ -PHP_FUNCTION(git_filter_list_push); - -/* {{{ proto resource git_filter_list_length(fl) -*/ -PHP_FUNCTION(git_filter_list_length); - -/* {{{ proto resource git_filter_source_repo(src) -*/ -PHP_FUNCTION(git_filter_source_repo); - -/* {{{ proto resource git_filter_source_path(src) -*/ -PHP_FUNCTION(git_filter_source_path); - -/* {{{ proto resource git_filter_source_filemode(src) -*/ -PHP_FUNCTION(git_filter_source_filemode); - -/* {{{ proto resource git_filter_source_id(src) -*/ -PHP_FUNCTION(git_filter_source_id); - -/* {{{ proto resource git_filter_source_mode(src) -*/ -PHP_FUNCTION(git_filter_source_mode); - -/* {{{ proto long git_filter_register(name, filter, priority) -*/ -PHP_FUNCTION(git_filter_register); - -/* {{{ proto long git_filter_unregister(name) -*/ -PHP_FUNCTION(git_filter_unregister); - -/* {{{ proto resource git_filter_new(payload) -*/ -PHP_FUNCTION(git_filter_new); - -#endif diff --git a/fixer.php b/fixer.php deleted file mode 100644 index 3a7ccafe09..0000000000 --- a/fixer.php +++ /dev/null @@ -1,265 +0,0 @@ - error.log -// grep "unused variables" error.log > error2.log -// php fixer.php -$data = file_get_contents("error2.log"); -$result = array(); -foreach (explode("\n", $data) as $line) { - if (preg_match("!(.+?):(\d+):(\d+): warning: unused variable '(.+?)'!", $line, $match)) { - $filename = basename($match[1]); - $line = $match[2]; - $columns = $match[3]; - $name = $match[4]; - - if ($filename == $target) { - $result[$filename][] = array( - "line" => $line, - "columns" => $columns, - "name" => $name, - ); - } - } -} - -//var_dump($result); -$file = file_get_contents($target); -$lines = explode("\n", $file); -if (!isset($result[$target])) { - echo "nothing"; - exit; -} -foreach ($result[$target] as $value) { - //echo $lines[$value['line']-1] . PHP_EOL; - - $line = $lines[$value['line']-1]; - $l = parseLine($line); - $l->remove($value['name']); - $hhh = $l->toLine(); - $lines[$value['line']-1] = $hhh; -} -$buffer = ""; -for ($i = 0; $i < count($lines); $i++) { - $line = $lines[$i]; - if ($line == "==========REMOVED==========") { - continue; - } - $buffer .= $line; - if ($i + 1 < count($lines)) { - $buffer .= "\n"; - } -} -//echo $buffer;exit; -file_put_contents($target, $buffer); - -function parseLine($line) -{ - for ($i = 0; $i < strlen($line); $i++) { - if ($line[$i] == "\t") { - continue; - } else { - break; - } - } - - $l = new Line($i); - $arg = substr($line, $i); - $type = null; - $args = array(); - $tmp = null; - $base = null; - foreach (explode(",", $arg) as $arg2) { - $tokens = preg_split("/(\s+|;)/", $arg2); - - $cnt = count($tokens); - $state = 0; - for ($i = 0; $i < $cnt; $i++) { - if ($state == 0) { - if (empty($tokens[$i])) { - continue; - } - if (!$type) { - if ($tokens[$i] != "const") { - $type = $tokens[$i]; - $state = 1; - if (!$tmp) { - $tmp = new Variable(); - $tmp->setType($tokens[$i]); - $base = clone $tmp; - } - } else { - $tmp = new Variable(); - $tmp->is_const = 1; - $tmp->setType($tokens[$i+1]); - $i++; - $state = 1; - $base = clone $tmp; - } - } else { - $state = 1; - $tmp = clone $base; - $tmp->setName($tokens[$i]); - } - } else if ($state == 1) { - if ($tokens[$i] == "=") { - $state = 2; - } else { - $tmp->setName($tokens[$i]); - } - } else if ($state == 2) { - $tmp->setDefault($tokens[$i]); - $l->add($tmp); - unset($tmp); - $state = 0; - } - } - if (isset($tmp)) { - $l->add($tmp); - } - } - - return $l; -} - -class Line -{ - public $indent; - public $variables = array(); - - public function __construct($indent) - { - $this->indent = $indent; - } - - public function add(Variable $var) - { - $this->variables[] = $var; - } - - public function remove($name) - { - foreach ($this->variables as $o => $var) { - if ($var->name == $name) { - unset($this->variables[$o]); - } - } - } - - public function isEmpty() - { - if (count($this->variables)) { - return false; - } else { - return true; - } - } - - public function toLine() - { - $type = null; - $buffer = str_repeat("\t", $this->indent); - $values = array(); - foreach ($this->variables as $var) { - if (!$type) { - if ($var->getNameWithPtr() === "") { - continue; - } - - $type = $var->type; - if ($var->is_const) { - $buffer .= "const "; - } - $buffer .= sprintf("%s ", $var->type); - - if ($var->default !== NULL) { - $values[] = sprintf("%s = %s", $var->getNameWithPtr(), $var->default); - } else { - $values[] = $var->getNameWithPtr(); - } - } else { - if ($var->getNameWithPtr() === "") { - continue; - } - - - if ($var->default !== NULL) { - $values[] = sprintf("%s = %s", $var->getNameWithPtr(), $var->default); - } else { - $values[] = $var->getNameWithPtr(); - } - } - } - - if (count($values)) { - $buffer .= join(", ", $values); - } else { - return "==========REMOVED=========="; - } - if (strlen($buffer) > $this->indent) { - $buffer .= ";"; - } - - $check = trim($buffer, " \t"); - if (!$check) { - return "==========REMOVED=========="; - } - - return $buffer; - } -} - -class Variable -{ - public $name; - public $type; - public $default; - public $is_static; - public $is_const; - public $ptr = 0; - - public function __construct() - { - } - - public function setType($type) - { - $this->type = $type; - } - - public function setName($name) - { - $ptr = 0; - for ($i =0; $i < strlen($name); $i++) { - if ($name[$i] == '*') { - $ptr++; - } - } - - $this->name = substr($name, $ptr); - if ($ptr) { - $this->ptr = $ptr; - } - } - - public function setPtr($ptr) - { - $this->ptr = $ptr; - } - - public function setDefault($default) - { - $this->default = $default; - } - - public function getNameWithPtr() - { - if ($this->name) { - return str_repeat("*", $this->ptr) . $this->name; - } else { - return ""; - } - } -} diff --git a/g_config.c b/g_config.c deleted file mode 100644 index cb15c30ad5..0000000000 --- a/g_config.c +++ /dev/null @@ -1,867 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "g_config.h" - -enum php_git2_config { - PHP_GIT2_CONFIG_STRING, - PHP_GIT2_CONFIG_BOOL, - PHP_GIT2_CONFIG_INT64, - PHP_GIT2_CONFIG_INT32, -}; - -static void php_git2_config_entry_to_array(git_config_entry *entry, zval **result); - -static int php_git2_config_foreach_cb(const git_config_entry *entry, void *payload) -{ - php_git2_t *result; - zval *param_config_entry, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - php_git2_config_entry_to_array(entry, ¶m_config_entry); - Z_ADDREF_P(p->payload); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 2, ¶m_config_entry, &p->payload)) { - zval_ptr_dtor(¶m_config_entry); - zval_ptr_dtor(&p->payload); - zend_list_delete(result->resource_id); - retval = 0; - return 0; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - - -static void php_git2_config_get_with(INTERNAL_FUNCTION_PARAMETERS, enum php_git2_config type) -{ - zval *cfg; - php_git2_t *_cfg; - char *name = {0}; - int name_len; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &cfg, &name, &name_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - switch (type) { - case PHP_GIT2_CONFIG_STRING: { - const char *ptr; - error = git_config_get_string(&ptr, PHP_GIT2_V(_cfg, config), name); - if (php_git2_check_error(error, "git_config_get_string" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_STRING(ptr, 1); - break; - } - case PHP_GIT2_CONFIG_BOOL: { - int ptr; - error = git_config_get_bool(&ptr, PHP_GIT2_V(_cfg, config), name); - if (php_git2_check_error(error, "git_config_get_bool" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_BOOL(ptr); - break; - } - case PHP_GIT2_CONFIG_INT64: { - int64_t ptr; - error = git_config_get_int64(&ptr, PHP_GIT2_V(_cfg, config), name); - if (php_git2_check_error(error, "git_config_get_int64" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_LONG(ptr); - break; - } - case PHP_GIT2_CONFIG_INT32: { - int32_t ptr; - error = git_config_get_int32(&ptr, PHP_GIT2_V(_cfg, config), name); - if (php_git2_check_error(error, "git_config_get_int32" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_LONG(ptr); - break; - } - } -} - -static void php_git2_config_set_with(INTERNAL_FUNCTION_PARAMETERS, enum php_git2_config type) -{ - zval *cfg; - php_git2_t *_cfg; - char *name = {0}; - int name_len; - int error = 0; - zval *value; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsz", &cfg, &name, &name_len, &value) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - switch (type) { - case PHP_GIT2_CONFIG_STRING: { - if (Z_TYPE_P(value) != IS_STRING) { - convert_to_string(value); - } - error = git_config_set_string(PHP_GIT2_V(_cfg, config), name, Z_STRVAL_P(value)); - if (php_git2_check_error(error, "git_config_set_string" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; - break; - } - case PHP_GIT2_CONFIG_BOOL: { - if (Z_TYPE_P(value) != IS_BOOL) { - convert_to_boolean(value); - } - error = git_config_set_bool(PHP_GIT2_V(_cfg, config), name, Z_LVAL_P(value)); - if (php_git2_check_error(error, "git_config_set_bool" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; - break; - } - case PHP_GIT2_CONFIG_INT32: { - if (Z_TYPE_P(value) != IS_LONG) { - convert_to_long(value); - } - error = git_config_set_int32(PHP_GIT2_V(_cfg, config), name, Z_LVAL_P(value)); - if (php_git2_check_error(error, "git_config_set_int32" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; - break; - } - case PHP_GIT2_CONFIG_INT64: { - if (Z_TYPE_P(value) != IS_LONG) { - convert_to_long(value); - } - error = git_config_set_int64(PHP_GIT2_V(_cfg, config), name, Z_LVAL_P(value)); - if (php_git2_check_error(error, "git_config_set_int64" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; - break; - } - } -} - - -static void php_git2_config_parse_with(INTERNAL_FUNCTION_PARAMETERS, enum php_git2_config type) -{ - char *value = {0}; - int value_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &value, &value_len) == FAILURE) { - return; - } - - switch (type) { - case PHP_GIT2_CONFIG_BOOL: { - int result; - result = git_config_parse_bool(&result, value); - RETURN_BOOL(result); - break; - } - case PHP_GIT2_CONFIG_INT32: { - int32_t result; - result = git_config_parse_int32(&result, value); - RETURN_LONG(result); - break; - } - case PHP_GIT2_CONFIG_INT64: { - int64_t result; - result = git_config_parse_int64(&result, value); - RETURN_LONG(result); - break; - } - } -} - -static void php_git2_config_entry_to_array(git_config_entry *entry, zval **result) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - array_init(tmp); - - add_assoc_string_ex(tmp, ZEND_STRS("name"), entry->name, 1); - add_assoc_string_ex(tmp, ZEND_STRS("value"), entry->value, 1); - add_assoc_long_ex(tmp, ZEND_STRS("level"), entry->level); - *result = tmp; -} - -/* {{{ proto resource git_config_find_global() -*/ -PHP_FUNCTION(git_config_find_global) -{ - char buffer[GIT2_BUFFER_SIZE]; - size_t buffer_len = GIT2_BUFFER_SIZE; - int error = 0; - - error = git_config_find_global(buffer, buffer_len); - if (php_git2_check_error(error, "git_config_find_global" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_STRING(buffer, 1); -} - -/* {{{ proto resource git_config_find_xdg(length) -*/ -PHP_FUNCTION(git_config_find_xdg) -{ - - /* TODO(chobie): implement this */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_config_find_xdg not implemented yet"); - return; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "", &length) == FAILURE) { -// return; -// } -} - -/* {{{ proto resource git_config_find_system(length) -*/ -PHP_FUNCTION(git_config_find_system) -{ - char buffer[GIT2_BUFFER_SIZE]; - size_t buffer_len = GIT2_BUFFER_SIZE; - int error = 0; - - error = git_config_find_system(buffer, buffer_len); - if (php_git2_check_error(error, "git_config_find_system" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_STRING(buffer, 1); -} - -/* {{{ proto resource git_config_open_default() -*/ -PHP_FUNCTION(git_config_open_default) -{ - git_config *config; - int error = 0; - php_git2_t *result; - - error = git_config_open_default(&config); - if (php_git2_check_error(error, "git_config_open_default" TSRMLS_CC)) { - RETURN_FALSE - } - - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, config) = config; - result->type = PHP_GIT2_TYPE_CONFIG; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 1; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto resource git_config_new() -*/ -PHP_FUNCTION(git_config_new) -{ - git_config *config; - php_git2_t *result; - int error = 0; - - error = git_config_new(&config); - if (php_git2_check_error(error, "git_config_new" TSRMLS_CC)) { - RETURN_FALSE - } - - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, config) = config; - result->type = PHP_GIT2_TYPE_CONFIG; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 1; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto long git_config_add_file_ondisk(cfg, path, level, force) -*/ -PHP_FUNCTION(git_config_add_file_ondisk) -{ - zval *cfg; - php_git2_t *_cfg; - char *path = {0}; - int path_len; - long level; - long force = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsrl", &cfg, &path, &path_len, &level, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_add_file_ondisk(PHP_GIT2_V(_cfg, config), path, level, force); - if (php_git2_check_error(error, "git_config_add_file_ondisk" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto resource git_config_open_ondisk(path) -*/ -PHP_FUNCTION(git_config_open_ondisk) -{ - char *path = {0}; - int path_len; - git_config *config; - php_git2_t *result; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &path, &path_len) == FAILURE) { - return; - } - error = git_config_open_ondisk(&config, path); - if (php_git2_check_error(error, "git_config_open_ondisk" TSRMLS_CC)) { - RETURN_FALSE - } - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, config) = config; - result->type = PHP_GIT2_TYPE_CONFIG; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 1; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto resource git_config_open_level(parent, level) -*/ -PHP_FUNCTION(git_config_open_level) -{ - zval *parent; - php_git2_t *_parent, *result; - long level; - int error = 0; - git_config *out; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &parent, &level) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_parent, php_git2_t*, &parent, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_config_open_level(&out, PHP_GIT2_V(_parent, config), level); - if (php_git2_check_error(error, "git_config_open_level" TSRMLS_CC)) { - RETURN_FALSE - } - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, config) = out; - result->type = PHP_GIT2_TYPE_CONFIG; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 1; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto resource git_config_open_global(config) -*/ -PHP_FUNCTION(git_config_open_global) -{ - zval *config; - php_git2_t *_config, *result; - git_config *out; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &config) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_config, php_git2_t*, &config, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_open_global(&out, PHP_GIT2_V(_config, config)); - if (php_git2_check_error(error, "git_config_open_global" TSRMLS_CC)) { - RETURN_FALSE - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CONFIG, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto long git_config_refresh(cfg) -*/ -PHP_FUNCTION(git_config_refresh) -{ - zval *cfg; - php_git2_t *_cfg; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &cfg) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_refresh(PHP_GIT2_V(_cfg, config)); - if (php_git2_check_error(error, "git_config_refresh" TSRMLS_CC)) { - RETURN_FALSE - } - - RETURN_TRUE; -} - -/* {{{ proto void git_config_free(resource $cfg) - */ -PHP_FUNCTION(git_config_free) -{ - zval *cfg = NULL; - php_git2_t *_cfg = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &cfg) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_cfg)) { - git_config_free(PHP_GIT2_V(_cfg, config)); - GIT2_SHOULD_FREE(_cfg) = 0; - }; - zval_ptr_dtor(&cfg); -} -/* }}} */ - -/* {{{ proto resource git_config_get_entry(cfg, name) -*/ -PHP_FUNCTION(git_config_get_entry) -{ - zval *cfg; - php_git2_t *_cfg; - char *name = {0}; - int name_len; - git_config_entry *entry; - int error = 0; - zval *result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &cfg, &name, &name_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_get_entry(&entry, PHP_GIT2_V(_cfg, config), name); - if (php_git2_check_error(error, "git_config_get_entry" TSRMLS_CC)) { - RETURN_FALSE - } - - php_git2_config_entry_to_array(entry, &result); - RETURN_ZVAL(result, 0, 1); -} - -/* {{{ proto resource git_config_get_int32(cfg, name) -*/ -PHP_FUNCTION(git_config_get_int32) -{ - php_git2_config_get_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_INT32); -} - -/* {{{ proto resource git_config_get_int64(cfg, name) -*/ -PHP_FUNCTION(git_config_get_int64) -{ - php_git2_config_get_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_INT64); -} - -/* {{{ proto resource git_config_get_bool(cfg, name) -*/ -PHP_FUNCTION(git_config_get_bool) -{ - php_git2_config_get_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_BOOL); -} - -/* {{{ proto resource git_config_get_string(cfg, name) -*/ -PHP_FUNCTION(git_config_get_string) -{ - php_git2_config_get_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_STRING); -} - -/* {{{ proto long git_config_get_multivar_foreach(resource $cfg, string $name, string $regexp, Callable $callback, $payload) - */ -PHP_FUNCTION(git_config_get_multivar_foreach) -{ - int result = 0, name_len = 0, regexp_len = 0; - zval *cfg = NULL, *payload = NULL; - php_git2_t *_cfg = NULL; - char *name = NULL, *regexp = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rssfz", &cfg, &name, &name_len, ®exp, ®exp_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_config_get_multivar_foreach(PHP_GIT2_V(_cfg, config), name, regexp, php_git2_config_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_config_multivar_iterator_new(resource $cfg, string $name, string $regexp) - */ -PHP_FUNCTION(git_config_multivar_iterator_new) -{ - php_git2_t *result = NULL, *_cfg = NULL; - git_config_iterator *out = NULL; - zval *cfg = NULL; - char *name = NULL, *regexp = NULL; - int name_len = 0, regexp_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &cfg, &name, &name_len, ®exp, ®exp_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_multivar_iterator_new(&out, PHP_GIT2_V(_cfg, config), name, regexp); - if (php_git2_check_error(error, "git_config_multivar_iterator_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CONFIG_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_config_next(resource $iter) - */ -PHP_FUNCTION(git_config_next) -{ - int result = 0; - git_config_entry *entry = NULL; - zval *iter = NULL; - php_git2_t *_iter = NULL; - zval *out; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_config_next(&entry, PHP_GIT2_V(_iter, config_iterator)); - if (result == GIT_ITEROVER || php_git2_check_error(result, "git_config_next" TSRMLS_CC)) { - RETURN_FALSE - } - php_git2_config_entry_to_array(entry, &out); - RETURN_ZVAL(out, 0, 1); -} -/* }}} */ - -/* {{{ proto void git_config_iterator_free(resource $iter) - */ -PHP_FUNCTION(git_config_iterator_free) -{ - zval *iter = NULL; - php_git2_t *_iter = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_iter)) { - git_config_iterator_free(PHP_GIT2_V(_iter, config_iterator)); - GIT2_SHOULD_FREE(_iter) = 0; - }; - zval_ptr_dtor(&iter); -} -/* }}} */ - -/* {{{ proto long git_config_set_int32(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_int32) -{ - php_git2_config_set_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_INT32); -} - -/* {{{ proto long git_config_set_int64(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_int64) -{ - php_git2_config_set_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_INT64); -} - -/* {{{ proto long git_config_set_bool(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_bool) -{ - php_git2_config_set_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_BOOL); -} - -/* {{{ proto long git_config_set_string(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_string) -{ - php_git2_config_set_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_STRING); -} - -/* {{{ proto long git_config_set_multivar(resource $cfg, string $name, string $regexp, string $value) - */ -PHP_FUNCTION(git_config_set_multivar) -{ - int result = 0, name_len = 0, regexp_len = 0, value_len = 0; - zval *cfg = NULL; - php_git2_t *_cfg = NULL; - char *name = NULL, *regexp = NULL, *value = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsss", &cfg, &name, &name_len, ®exp, ®exp_len, &value, &value_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_config_set_multivar(PHP_GIT2_V(_cfg, config), name, regexp, value); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_config_delete_entry(cfg, name) -*/ -PHP_FUNCTION(git_config_delete_entry) -{ - zval *cfg; - php_git2_t *_cfg; - char *name = {0}; - int name_len; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &cfg, &name, &name_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_config_delete_entry(PHP_GIT2_V(_cfg, config), name); - if (php_git2_check_error(error, "git_config_delete_entry" TSRMLS_CC)) { - RETURN_FALSE - } - - RETURN_TRUE; -} - -/* {{{ proto long git_config_delete_multivar(resource $cfg, string $name, string $regexp) - */ -PHP_FUNCTION(git_config_delete_multivar) -{ - int result = 0, name_len = 0, regexp_len = 0; - zval *cfg = NULL; - php_git2_t *_cfg = NULL; - char *name = NULL, *regexp = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &cfg, &name, &name_len, ®exp, ®exp_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_config_delete_multivar(PHP_GIT2_V(_cfg, config), name, regexp); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_config_foreach(resource $cfg, $callback, $payload) - */ -PHP_FUNCTION(git_config_foreach) -{ - int result = 0; - zval *cfg = NULL; - php_git2_t *_cfg = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb; - zval *payload = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &cfg, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_config_foreach(PHP_GIT2_V(_cfg, config), php_git2_config_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_config_iterator_new(resource $cfg) - */ -PHP_FUNCTION(git_config_iterator_new) -{ - php_git2_t *result = NULL, *_cfg = NULL; - git_config_iterator *out = NULL; - zval *cfg = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &cfg) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_iterator_new(&out, PHP_GIT2_V(_cfg, config)); - if (php_git2_check_error(error, "git_config_iterator_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CONFIG_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_config_iterator_glob_new(resource $cfg, string $regexp) - */ -PHP_FUNCTION(git_config_iterator_glob_new) -{ - php_git2_t *result = NULL, *_cfg = NULL; - git_config_iterator *out = NULL; - zval *cfg = NULL; - char *regexp = NULL; - int regexp_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &cfg, ®exp, ®exp_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_config_iterator_glob_new(&out, PHP_GIT2_V(_cfg, config), regexp); - if (php_git2_check_error(error, "git_config_iterator_glob_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CONFIG_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_config_foreach_match(resource $cfg, string $regexp, Callable $callback, $payload) - */ -PHP_FUNCTION(git_config_foreach_match) -{ - int result = 0, regexp_len = 0; - zval *cfg = NULL, *payload = NULL; - php_git2_t *_cfg = NULL; - char *regexp = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsfz", &cfg, ®exp, ®exp_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_config_foreach_match(PHP_GIT2_V(_cfg, config), regexp, php_git2_config_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_config_get_mapped(cfg, name, maps, map_n) -*/ -PHP_FUNCTION(git_config_get_mapped) -{ - - /* TODO(chobie): implement this */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_config_get_mapped not implemented yet"); - return; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "rsr", &cfg, &name, &name_len, &maps, &map_n) == FAILURE) { -// return; -// } -// ZEND_FETCH_RESOURCE(_cfg, php_git2_t*, &cfg, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -} - -/* {{{ proto resource git_config_lookup_map_value(maps, map_n, value) -*/ -PHP_FUNCTION(git_config_lookup_map_value) -{ - zval *maps; - php_git2_t *_maps; - - /* TODO(chobie): implement this */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_config_lookup_map_value not implemented yet"); - return; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "rs", &maps, &map_n, &value, &value_len) == FAILURE) { -// return; -// } - ZEND_FETCH_RESOURCE(_maps, php_git2_t*, &maps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -} - -/* {{{ proto resource git_config_parse_bool(value) -*/ -PHP_FUNCTION(git_config_parse_bool) -{ - php_git2_config_parse_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_BOOL); -} - -/* {{{ proto resource git_config_parse_int32(value) -*/ -PHP_FUNCTION(git_config_parse_int32) -{ - php_git2_config_parse_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_INT32); -} - -/* {{{ proto resource git_config_parse_int64(value) -*/ -PHP_FUNCTION(git_config_parse_int64) -{ - php_git2_config_parse_with(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GIT2_CONFIG_INT64); -} - -/* {{{ proto long git_config_backend_foreach_match(backend, regexp, , ), data) -*/ -PHP_FUNCTION(git_config_backend_foreach_match) -{ - zval *backend; - php_git2_t *_backend; - long ; - - /* TODO(chobie): implement this */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_config_backend_foreach_match not implemented yet"); - return; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "rsl", &backend, ®exp, ®exp_len, &, &), &data) == FAILURE) { -// return; -// } - ZEND_FETCH_RESOURCE(_backend, php_git2_t*, &backend, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -} diff --git a/g_config.h b/g_config.h deleted file mode 100644 index c4874a8ecc..0000000000 --- a/g_config.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_G_CONFIG_H -#define PHP_GIT2_G_CONFIG_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_find_global, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_find_xdg, 0, 0, 2) - ZEND_ARG_INFO(0, length) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_find_system, 0, 0, 2) - ZEND_ARG_INFO(0, length) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_open_default, 0, 0, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_new, 0, 0, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_add_file_ondisk, 0, 0, 4) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, level) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_open_ondisk, 0, 0, 2) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_open_level, 0, 0, 3) - ZEND_ARG_INFO(0, parent) - ZEND_ARG_INFO(0, level) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_open_global, 0, 0, 2) - ZEND_ARG_INFO(0, config) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_refresh, 0, 0, 1) - ZEND_ARG_INFO(0, cfg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_free, 0, 0, 1) - ZEND_ARG_INFO(0, cfg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_entry, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_int32, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_int64, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_bool, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_string, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_multivar_foreach, 0, 0, 5) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, regexp) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_multivar_iterator_new, 0, 0, 4) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, regexp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_next, 0, 0, 2) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_iterator_free, 0, 0, 1) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_set_int32, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_set_int64, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_set_bool, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_set_string, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_set_multivar, 0, 0, 4) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, regexp) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_delete_entry, 0, 0, 2) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_delete_multivar, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, regexp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_iterator_new, 0, 0, 2) - ZEND_ARG_INFO(0, cfg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_iterator_glob_new, 0, 0, 3) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, regexp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_foreach_match, 0, 0, 4) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, regexp) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_get_mapped, 0, 0, 5) - ZEND_ARG_INFO(0, cfg) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, maps) - ZEND_ARG_INFO(0, map_n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_lookup_map_value, 0, 0, 4) - ZEND_ARG_INFO(0, maps) - ZEND_ARG_INFO(0, map_n) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_parse_bool, 0, 0, 2) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_parse_int32, 0, 0, 2) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_parse_int64, 0, 0, 2) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_config_backend_foreach_match, 0, 0, 5) - ZEND_ARG_INFO(0, backend) - ZEND_ARG_INFO(0, regexp) -// ZEND_ARG_INFO(0, ) -// ZEND_ARG_INFO(0, )) -// ZEND_ARG_INFO(0, data) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_config_find_global(length) -*/ -PHP_FUNCTION(git_config_find_global); - -/* {{{ proto resource git_config_find_xdg(length) -*/ -PHP_FUNCTION(git_config_find_xdg); - -/* {{{ proto resource git_config_find_system(length) -*/ -PHP_FUNCTION(git_config_find_system); - -/* {{{ proto resource git_config_open_default() -*/ -PHP_FUNCTION(git_config_open_default); - -/* {{{ proto resource git_config_new() -*/ -PHP_FUNCTION(git_config_new); - -/* {{{ proto long git_config_add_file_ondisk(cfg, path, level, force) -*/ -PHP_FUNCTION(git_config_add_file_ondisk); - -/* {{{ proto resource git_config_open_ondisk(path) -*/ -PHP_FUNCTION(git_config_open_ondisk); - -/* {{{ proto resource git_config_open_level(parent, level) -*/ -PHP_FUNCTION(git_config_open_level); - -/* {{{ proto resource git_config_open_global(config) -*/ -PHP_FUNCTION(git_config_open_global); - -/* {{{ proto long git_config_refresh(cfg) -*/ -PHP_FUNCTION(git_config_refresh); - -/* {{{ proto void git_config_free(cfg) -*/ -PHP_FUNCTION(git_config_free); - -/* {{{ proto resource git_config_get_entry(cfg, name) -*/ -PHP_FUNCTION(git_config_get_entry); - -/* {{{ proto resource git_config_get_int32(cfg, name) -*/ -PHP_FUNCTION(git_config_get_int32); - -/* {{{ proto resource git_config_get_int64(cfg, name) -*/ -PHP_FUNCTION(git_config_get_int64); - -/* {{{ proto resource git_config_get_bool(cfg, name) -*/ -PHP_FUNCTION(git_config_get_bool); - -/* {{{ proto resource git_config_get_string(cfg, name) -*/ -PHP_FUNCTION(git_config_get_string); - -/* {{{ proto long git_config_get_multivar_foreach(cfg, name, regexp, callback, payload) -*/ -PHP_FUNCTION(git_config_get_multivar_foreach); - -/* {{{ proto resource git_config_multivar_iterator_new(cfg, name, regexp) -*/ -PHP_FUNCTION(git_config_multivar_iterator_new); - -/* {{{ proto resource git_config_next(iter) -*/ -PHP_FUNCTION(git_config_next); - -/* {{{ proto void git_config_iterator_free(iter) -*/ -PHP_FUNCTION(git_config_iterator_free); - -/* {{{ proto long git_config_set_int32(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_int32); - -/* {{{ proto long git_config_set_int64(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_int64); - -/* {{{ proto long git_config_set_bool(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_bool); - -/* {{{ proto long git_config_set_string(cfg, name, value) -*/ -PHP_FUNCTION(git_config_set_string); - -/* {{{ proto long git_config_set_multivar(cfg, name, regexp, value) -*/ -PHP_FUNCTION(git_config_set_multivar); - -/* {{{ proto long git_config_delete_entry(cfg, name) -*/ -PHP_FUNCTION(git_config_delete_entry); - -/* {{{ proto long git_config_delete_multivar(cfg, name, regexp) -*/ -PHP_FUNCTION(git_config_delete_multivar); - -/* {{{ proto long git_config_foreach(cfg, callback, payload) -*/ -PHP_FUNCTION(git_config_foreach); - -/* {{{ proto resource git_config_iterator_new(cfg) -*/ -PHP_FUNCTION(git_config_iterator_new); - -/* {{{ proto resource git_config_iterator_glob_new(cfg, regexp) -*/ -PHP_FUNCTION(git_config_iterator_glob_new); - -/* {{{ proto long git_config_foreach_match(cfg, regexp, callback, payload) -*/ -PHP_FUNCTION(git_config_foreach_match); - -/* {{{ proto resource git_config_get_mapped(cfg, name, maps, map_n) -*/ -PHP_FUNCTION(git_config_get_mapped); - -/* {{{ proto resource git_config_lookup_map_value(maps, map_n, value) -*/ -PHP_FUNCTION(git_config_lookup_map_value); - -/* {{{ proto resource git_config_parse_bool(value) -*/ -PHP_FUNCTION(git_config_parse_bool); - -/* {{{ proto resource git_config_parse_int32(value) -*/ -PHP_FUNCTION(git_config_parse_int32); - -/* {{{ proto resource git_config_parse_int64(value) -*/ -PHP_FUNCTION(git_config_parse_int64); - -/* {{{ proto long git_config_backend_foreach_match(backend, regexp, , ), data) -*/ -PHP_FUNCTION(git_config_backend_foreach_match); - -#endif \ No newline at end of file diff --git a/gen.php b/gen.php deleted file mode 100644 index 78824e1149..0000000000 --- a/gen.php +++ /dev/null @@ -1,224 +0,0 @@ - generate header -// 1 => generate source -// -// filter: -// - prefix: don't show matched keywords -// e.g ) -cred -// will ignore codes which have `cred` keyword -// default: show matched keywords only -// e.g ) cred -// will show codes which have `cred` keyword -// -// php gen.php libgit2/include/git2/.h (0|1) [filter] > target.h or target.c - -$data = file_get_contents($_SERVER['argv'][1]); - -$table = array(); -$buffer = ""; -if (preg_match_all("/GIT_EXTERN\((.+?)\)\s*([a-zA-Z0-9_-]+)\((.+?)\);/s", $data, $match)) { - - for ($i = 0; $i < count($match[0]); $i++) { - $tmp = array( - "args" => array(), - ); - - $list = array_map("trim", explode(",", $match[3][$i])); - - $tmp['name'] = $match[2][$i]; - $tmp['retval'] = $match[1][$i]; - - $d = count($list); - if ((preg_match("/(\*\*|out)/", $list[0]) || preg_match("/(write|create|new)/", $match[2][$i]))) { - $d--; - } - - - if (isset($_SERVER['argv'][3])) { - if ($_SERVER['argv'][3][0] == "-") { - $_SERVER['argv'][3] = substr($_SERVER['argv'][3][0], 1); - $flag = true; - } else { - $flag = false; - } - if (preg_match("/{$_SERVER['argv'][3]}/", $match[2][$i]) == $flag) { - continue; - } - } - - $match[3][$i] = trim(preg_replace("/\r?\n/", "", $match[3][$i])); - $match[3][$i] = trim(preg_replace("/\t/", " ", $match[3][$i])); - - if ($_SERVER['argv'][2] == "0") { - $buffer .= "ZEND_BEGIN_ARG_INFO_EX(arginfo_{$match[2][$i]}, 0, 0, $d)\n"; - } - - $o = 0; - foreach ($list as $l) { - $b = array_map(function($l){return trim($l, " *");}, explode(" ", $l)); - $type = substr($l, 0, strrpos($l, " ")); - - $n = array_pop($b); - $b = array_pop($b); - - if ($o == 0 && (preg_match("/(\*\*|out)/", $l) || preg_match("/(write|create|new)/", $match[2][$i]))) { - $w = 1; - $tmp['retval'] = "resource"; - }else { - $w = 0; - } - - if (!$w) { - $tmp['args'][] = array( - "write" => $w, - "name" => $n, - "type" => $type, - ); - if ($_SERVER['argv'][2] == "0") { - $buffer .= "\tZEND_ARG_INFO(0, $n)\n"; - } - } - - $o++; - } - - if ($_SERVER['argv'][2] == "0") { - $buffer .= "ZEND_END_ARG_INFO()\n"; - $buffer .= "\n"; - - } - - $table[] = $tmp; - } -} - -if ($_SERVER['argv'][2] == "1") { - $buffer .= '#include "php_git2.h"' . "\n"; - $buffer .= '#include "php_git2_priv.h"' . "\n"; - $buffer .= '#include ".h"' . "\n"; -} - - -foreach ($table as $func) { - $ret = getReturnType($func['retval']); - - $t = array(); - foreach ($func['args'] as $a) { - $t[] = $a['name']; - } - $sig = join(", ", $t); - - $buffer .= "/* {{{ proto $ret {$func['name']}($sig)\n"; - $buffer .= "*/\n"; - - if ($_SERVER['argv'][2] == "0") { - $buffer .= "PHP_FUNCTION({$func['name']});\n"; - $buffer .= "\n"; - } else { - $buffer .= "PHP_FUNCTION({$func['name']})\n"; - $buffer .= "{\n"; - $buffer .= getDeclarations($func); - - $buffer .= "\t/* TODO(chobie): implement this */\n"; - $buffer .= "\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, " . '"' . "{$func['name']} not implemented yet" . '"' . ");\n"; - $buffer .= "\treturn;\n\n"; - - $buffer .= "\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,\n"; - $buffer .= "\t\t" . sprintf('"%s", %s) == FAILURE) {%s', getParseStr($func), getParseStr2($func), "\n"); - $buffer .= "\t\treturn;\n"; - $buffer .= "\t}\n"; - if (hasResource($func)) { - $t = $func['args'][0]; - $buffer .= "\tZEND_FETCH_RESOURCE(_{$t['name']}, php_git2_t*, &{$t['name']}, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);\n"; - } - $buffer .= "}\n"; - $buffer .= "\n"; - } -} - -echo $buffer; - - -function hasResource($func) -{ - $result = false; - foreach ($func['args'] as $arg) { - if (preg_match("/char/", $arg['type'])) { - } else if (preg_match("/git_oid/", $arg['type'])) { - } else if (preg_match("/git_/", $arg['type'])) { - $result = true; - } - } - return $result; -} - -function getDeclarations($func) -{ - $result = array(); - foreach ($func['args'] as $arg) { - if (preg_match("/char/", $arg['type'])) { - $result[] = "\tchar *" . $arg['name'] . " = {0};"; - $result[] = "\tint " . $arg['name'] . "_len;"; - } else if (preg_match("/int/", $arg['type'])) { - $result[] = "\tlong " . $arg['name'] . ";"; - } else if (preg_match("/git_oid/", $arg['type'])) { - $result[] = "\tchar *" . $arg['name'] . " = {0};"; - $result[] = "\tint " . $arg['name'] . "_len;"; - } else if (preg_match("/git_/", $arg['type'])) { - $result[] = "\tzval *" . $arg['name'] . ";"; - $result[] = "\tphp_git2_t *_" . $arg['name'] . ";"; - } - } - $result[] = ""; - $result[] = ""; - - return join("\n", $result); -} - -function getParseStr($func) -{ - $result = array(); - foreach ($func['args'] as $arg) { - if (preg_match("/char/", $arg['type'])) { - $result[] = "s"; - } else if (preg_match("/git_oid/", $arg['type'])) { - $result[] = "s"; - } else if (preg_match("/int/", $arg['type'])) { - $result[] = "l"; - } else if (preg_match("/git_/", $arg['type'])) { - $result[] = "r"; - } - } - - return join("", $result); -} - -function getParseStr2($func) -{ - $result = array(); - foreach ($func['args'] as $arg) { - $result[] = "&" . $arg['name']; - if (preg_match("/char/", $arg['type'])) { - $result[] = "&" . $arg['name'] . "_len"; - } else if (preg_match("/git_oid/", $arg['type'])) { - $result[] = "&" . $arg['name'] . "_len"; - } - } - - return join(", ", $result); -} - -function getReturnType($name) -{ - switch($name) { - case "int": - return "long"; - case "void": - return "void"; - default: - return "resource"; - } -} \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 0000000000..ca17f83218 --- /dev/null +++ b/genindex.html @@ -0,0 +1,669 @@ + + + + + + + + + + + + Index — php-git 0.2 documentation + + + + + + + + + + + + +
+
+ + + + + +
+
+ +
+
+
+
+ + +

Index

+ +
+ _ + | A + | C + | E + | F + | G + | H + | I + | L + | N + | O + | P + | R + | S + | T + | W + +
+

_

+ + +
+ +
__construct (Git\Backend method) +
+ +
+ +
(Git\Blob method) +
+ + +
(Git\Commit method) +
+ + +
(Git\ODB method) +
+ + +
(Git\RawObject method) +
+ + +
(Git\Reference method) +
+ + +
(Git\Reference\Manager method) +
+ + +
(Git\Repository method) +
+ + +
(Git\Revwalk method) +
+ + +
(Git\Signature method) +
+ + +
(Git\Tag method) +
+ + +
(Git\Tree method) +
+ + +
(Git\Tree\Entry method) +
+ +
+
+ +

A

+ + + +
+ +
add (Git\Index method) +
+ +
+ +
(Git\Tree method) +
+ +
+ +
addAlternate (Git\ODB method) +
+ +
+ +
(Git\Repository method) +
+ +
+
+ +
addBackend (Git\ODB method) +
+ +
+ +
(Git\Repository method) +
+ +
+
+ +

C

+ + + +
+ +
count (Git\Index method) +
+ +
+ +
(Git\Tree method) +
+ +
+
+ +
create (Git\Reference\Manager method) +
+ +
+ +

E

+ + +
+ +
exists (Git\Backend method) +
+ +
+ +

F

+ + + +
+ +
find (Git\Index method) +
+ +
+ +
free (Git\Backend method) +
+ +
+ +

G

+ + + +
+ +
getAuthor (Git\Commit method) +
+ + +
getCommit (Git\Repository method) +
+ + +
getCommitter (Git\Commit method) +
+ + +
getEntries (Git\Tree method) +
+ + +
getEntry (Git\Index method) +
+ +
+ +
(Git\Tree method) +
+ +
+ +
getId (Git\Blob method) +
+ +
+ +
(Git\Commit method) +
+ + +
(Git\Object method) +
+ + +
(Git\RawObject method) +
+ + +
(Git\Reference method) +
+ + +
(Git\Tag method) +
+ + +
(Git\Tree method) +
+ +
+ +
getIndex (Git\Repository method) +
+ + +
getIterator (Git\Index method) +
+ +
+ +
(Git\Tree method) +
+ +
+ +
getList (Git\Reference\Manager method) +
+ + +
getMessage (Git\Commit method) +
+ +
+ +
(Git\Tag method) +
+ +
+
+ +
getName (Git\Reference method) +
+ +
+ +
(Git\Tag method) +
+ +
+ +
getObject (Git\Repository method) +
+ + +
getParent (Git\Commit method) +
+ + +
getReferences (Git\Repository method) +
+ + +
getShortMessage (Git\Commit method) +
+ + +
getTarget (Git\Reference method) +
+ +
+ +
(Git\Tag method) +
+ +
+ +
getTree (Git\Commit method) +
+ +
+ +
(Git\Repository method) +
+ +
+ +
getType (Git\Blob method) +
+ +
+ +
(Git\Object method) +
+ + +
(Git\Reference method) +
+ + +
(Git\Tag method) +
+ + +
(Git\Tree method) +
+ +
+ +
getWalker (Git\Repository method) +
+ +
+ +

H

+ + +
+ +
hide (Git\Revwalk method) +
+ +
+ +

I

+ + + +
+ +
init (Git\Repository method) +
+ + +
isBlob (Git\Blob method) +
+ +
+ +
(Git\Object method) +
+ + +
(Git\Reference method) +
+ + +
(Git\Tag method) +
+ +
+
+ +
isTree (Git\Blob method) +
+ +
+ +
(Git\Object method) +
+ + +
(Git\Reference method) +
+ + +
(Git\Tag method) +
+ +
+
+ +

L

+ + + +
+ +
lookup (Git\Reference\Manager method) +
+ +
+ +
lookupRef (Git\Repository method) +
+ +
+ +

N

+ + +
+ +
next (Git\Revwalk method) +
+ +
+ +

O

+ + + +
+ +
open2 (Git\Repository method) +
+ +
+ +
open3 (Git\Repository method) +
+ +
+ +

P

+ + + +
+ +
pack (Git\Reference\Manager method) +
+ + +
path (Git\Tree method) +
+ +
+ +
push (Git\Revwalk method) +
+ +
+ +

R

+ + + +
+ +
read (Git\Backend method) +
+ + +
read_header (Git\Backend method) +
+ + +
refresh (Git\Index method) +
+ +
+ +
remove (Git\Tree method) +
+ + +
reset (Git\Revwalk method) +
+ +
+ +

S

+ + + +
+ +
setAuthor (Git\Commit method) +
+ + +
setCommitter (Git\Commit method) +
+ + +
setContent (Git\Blob method) +
+ + +
setMessage (Git\Commit method) +
+ +
+ +
(Git\Tag method) +
+ +
+ +
setName (Git\Tag method) +
+ +
+ +
setParent (Git\Commit method) +
+ + +
setTarget (Git\Tag method) +
+ + +
setTree (Git\Commit method) +
+ + +
sort (Git\Revwalk method) +
+ +
+ +

T

+ + +
+ +
toObject (Git\Tree\Entry method) +
+ +
+ +

W

+ + +
+ +
write (Git\Backend method) +
+ +
+ +
(Git\Blob method) +
+ + +
(Git\Commit method) +
+ + +
(Git\Index method) +
+ + +
(Git\Object method) +
+ + +
(Git\Reference method) +
+ + +
(Git\Tag method) +
+ + +
(Git\Tree method) +
+ +
+
+ + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/giterr.c b/giterr.c deleted file mode 100644 index 23229485a8..0000000000 --- a/giterr.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "giterr.h" - -static void php_git2_error_to_array(const git_error *error, zval **out) -{ - zval *array; - - MAKE_STD_ZVAL(array); - array_init(array); - if (error == NULL) { - add_next_index_string(array, "", 1); - add_next_index_long(array, 0); - } else { - add_next_index_string(array, error->message, 1); - add_next_index_long(array, error->klass); - } - *out = array; -} - -/* {{{ proto resource giterr_last() - */ -PHP_FUNCTION(giterr_last) -{ - const git_error *result = {0}; - zval *array; - - result = giterr_last(); - php_git2_error_to_array(result, &array); - - RETURN_ZVAL(array, 0, 1); -} -/* }}} */ - -/* {{{ proto void giterr_clear() - */ -PHP_FUNCTION(giterr_clear) -{ - giterr_clear(); -} -/* }}} */ - -/* {{{ proto array giterr_detach() - */ -PHP_FUNCTION(giterr_detach) -{ - int result = 0; - git_error cpy; - zval *array; - - result = giterr_detach(&cpy); - php_git2_error_to_array(&cpy, &array); - RETURN_ZVAL(array, 0, 1); -} -/* }}} */ - -/* {{{ proto void giterr_set_str(long $error_class, string $string) - */ -PHP_FUNCTION(giterr_set_str) -{ - long error_class = 0; - char *string = NULL; - int string_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ls", &error_class, &string, &string_len) == FAILURE) { - return; - } - - giterr_set_str(error_class, string); -} -/* }}} */ - -/* {{{ proto void giterr_set_oom() - */ -PHP_FUNCTION(giterr_set_oom) -{ - giterr_set_oom(); -} -/* }}} */ - diff --git a/giterr.h b/giterr.h deleted file mode 100644 index ff25692c15..0000000000 --- a/giterr.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_GITERR_H -#define PHP_GIT2_GITERR_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_giterr_last, 0, 0, 1) - ZEND_ARG_INFO(0, void) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_giterr_clear, 0, 0, 1) - ZEND_ARG_INFO(0, void) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_giterr_detach, 0, 0, 1) - ZEND_ARG_INFO(0, cpy) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_giterr_set_str, 0, 0, 2) - ZEND_ARG_INFO(0, error_class) - ZEND_ARG_INFO(0, string) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_giterr_set_oom, 0, 0, 1) - ZEND_ARG_INFO(0, void) -ZEND_END_ARG_INFO() - -/* {{{ proto resource giterr_last(void) -*/ -PHP_FUNCTION(giterr_last); - -/* {{{ proto void giterr_clear(void) -*/ -PHP_FUNCTION(giterr_clear); - -/* {{{ proto long giterr_detach(cpy) -*/ -PHP_FUNCTION(giterr_detach); - -/* {{{ proto void giterr_set_str(error_class, string) -*/ -PHP_FUNCTION(giterr_set_str); - -/* {{{ proto void giterr_set_oom(void) -*/ -PHP_FUNCTION(giterr_set_oom); - -#endif \ No newline at end of file diff --git a/graph.c b/graph.c deleted file mode 100644 index cd2463d619..0000000000 --- a/graph.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "graph.h" - -/* {{{ proto long git_graph_ahead_behind(resource $repo, string $local, string $upstream) - */ -PHP_FUNCTION(git_graph_ahead_behind) -{ - int result = 0, local_len = 0, upstream_len = 0; - zval *repo = NULL, *array = NULL; - php_git2_t *_repo = NULL; - char *local = NULL, *upstream = NULL; - git_oid __local = {0}, __upstream = {0}; - size_t ahead = 0, behind = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &ahead, &behind, &repo, &local, &local_len, &upstream, &upstream_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__local, local, local_len)) { - RETURN_FALSE; - } - if (git_oid_fromstrn(&__upstream, upstream, upstream_len)) { - RETURN_FALSE; - } - result = git_graph_ahead_behind(&ahead, &behind, PHP_GIT2_V(_repo, repository), &__local, &__upstream); - - MAKE_STD_ZVAL(array); - array_init(array); - add_next_index_long(array, ahead); - add_next_index_long(array, behind); - - RETURN_ZVAL(array, 0, 1); -} -/* }}} */ - diff --git a/graph.h b/graph.h deleted file mode 100644 index 3c1dbabc86..0000000000 --- a/graph.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_GRAPH_H -#define PHP_GIT2_GRAPH_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_graph_ahead_behind, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, local) - ZEND_ARG_INFO(0, upstream) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_graph_ahead_behind(long $ahead, long $behind, resource $repo, string $local, string $upstream) - */ -PHP_FUNCTION(git_graph_ahead_behind); - -#endif diff --git a/helper.c b/helper.c deleted file mode 100644 index 84c898d2f1..0000000000 --- a/helper.c +++ /dev/null @@ -1,786 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "helper.h" - -static zval* datetime_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) -{ -#if PHP_VERSION_ID <= 50304 - Z_TYPE_P(object) = IS_OBJECT; - object_init_ex(object, pce); - Z_SET_REFCOUNT_P(object, 1); - Z_UNSET_ISREF_P(object); - return object; -#else - return php_date_instantiate(pce, object TSRMLS_CC); -#endif -} - -int php_git2_check_error(int error_code, const char *action TSRMLS_DC) -{ - int result = 0; - const git_error * error; - if (!error_code) { - return result; - } - - error = giterr_last(); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "WARNING %d %s - %s", - error_code, action, (error && error->message) ? error->message : "???"); - - result = 1; - return result; -} - - -zval* php_git2_read_arrval(zval *array, char *name, size_t name_len TSRMLS_DC) -{ - zval *result = NULL, **element; - - if (zend_hash_find(Z_ARRVAL_P(array), name, name_len, (void**)&element) == SUCCESS) { - result = *element; - } - - return result; -} - -long php_git2_read_arrval_long2(zval *array, char *name, size_t name_len, long value TSRMLS_DC) -{ - zval *tmp; - long result = value; - - tmp = php_git2_read_arrval(array, name, name_len TSRMLS_CC); - if (tmp) { - result = Z_LVAL_P(tmp); - } - - return result; -} - -long php_git2_read_arrval_long(zval *array, char *name, size_t name_len TSRMLS_DC) -{ - zval *tmp; - long result = 0; - - tmp = php_git2_read_arrval(array, name, name_len TSRMLS_CC); - if (tmp) { - result = Z_LVAL_P(tmp); - } - - return result; -} - -const char* php_git2_read_arrval_string(zval *array, char *name, size_t name_len TSRMLS_DC) -{ - zval *tmp; - const char *result = NULL; - - tmp = php_git2_read_arrval(array, name, name_len TSRMLS_CC); - if (tmp) { - result = Z_STRVAL_P(tmp); - } - - return result; -} - -void php_git2_array_to_signature(git_signature *signature, zval *author TSRMLS_DC) -{ - zval *name = NULL, *email = NULL, *time = NULL; - - name = php_git2_read_arrval(author, ZEND_STRS("name") TSRMLS_CC); - email = php_git2_read_arrval(author, ZEND_STRS("email") TSRMLS_CC); - time = php_git2_read_arrval(author, ZEND_STRS("time") TSRMLS_CC); - - signature->name = Z_STRVAL_P(name); - signature->email = Z_STRVAL_P(email); - - //instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC); - if (time != NULL && - Z_TYPE_P(time) == IS_OBJECT && - instanceof_function_ex(Z_OBJCE_P(time), php_date_get_date_ce(), 0 TSRMLS_CC)) { - php_date_obj *date; - - date = (php_date_obj *)zend_object_store_get_object(time TSRMLS_CC); - signature->when.time = date->time->sse; - signature->when.offset = date->time->z; - } -} - -void php_git2_signature_to_array(const git_signature *signature, zval **out TSRMLS_DC) -{ - zval *result, *datetime, *timezone; - php_timezone_obj *tzobj; - char time_str[12] = {0}; - - MAKE_STD_ZVAL(result); - array_init(result); - - MAKE_STD_ZVAL(datetime); - MAKE_STD_ZVAL(timezone); - - datetime_instantiate(php_date_get_date_ce(), datetime TSRMLS_CC); - snprintf(time_str,12,"%c%ld",'@', signature->when.time); - - datetime_instantiate(php_date_get_timezone_ce(), timezone TSRMLS_CC); - tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone TSRMLS_CC); - tzobj->initialized = 1; - tzobj->type = TIMELIB_ZONETYPE_OFFSET; - tzobj->tzi.utc_offset = -signature->when.offset; // doesn't work - - /* TODO(chobie): how do i set offset? */ - php_date_initialize(zend_object_store_get_object(datetime TSRMLS_CC), time_str, strlen(time_str), NULL, timezone, 0 TSRMLS_CC); - - if (signature->name == NULL) { - add_assoc_null_ex(result, ZEND_STRS("name")); - } else { - add_assoc_string_ex(result, ZEND_STRS("name"), signature->name, 1); - } - if (signature->email == NULL) { - add_assoc_null_ex(result, ZEND_STRS("email")); - } else { - add_assoc_string_ex(result, ZEND_STRS("email"), signature->email, 1); - } - add_assoc_zval_ex(result, ZEND_STRS("time"), datetime); - - zval_ptr_dtor(&timezone); - - *out = result; -} - -void php_git2_strarray_to_array(git_strarray *array, zval **out TSRMLS_DC) -{ - zval *result; - int i = 0; - - MAKE_STD_ZVAL(result); - array_init(result); - - for (i = 0; i < array->count; i++) { - add_next_index_string(result, array->strings[i], 1); - } - *out = result; -} - -int php_git2_call_function_v( - zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC, zval **retval_ptr_ptr, zend_uint param_count, ...) -{ - zval **params = NULL; - va_list ap; - int i = 0; - - if (param_count > 0) { - params = emalloc(sizeof(zval*) * param_count); - va_start(ap, param_count); - for (i = 0; i < param_count; i++) { - params[i] = va_arg(ap, zval**); - } - va_end(ap); - } else { - params = NULL; - } - - if (ZEND_FCI_INITIALIZED(*fci)) { - fci->params = params; - fci->retval_ptr_ptr = retval_ptr_ptr; - fci->param_count = param_count; - fci->no_separation = 1; - - if (zend_call_function(fci, fcc TSRMLS_CC) != SUCCESS) { - if (param_count > 0) { - for (i = 0; i < param_count; i++) { - zval_ptr_dtor(params[i]); - } - efree(params); - } - return 1; - } - zend_fcall_info_args_clear(fci, 0); - } - - if (param_count > 0) { - for (i = 0; i < param_count; i++) { - zval_ptr_dtor(params[i]); - } - efree(params); - } - return 0; -} - -int php_git2_cb_init(php_git2_cb_t **out, zend_fcall_info *fci, zend_fcall_info_cache *fcc, void *payload TSRMLS_DC) -{ - php_git2_cb_t *cb; - - cb = (struct php_git2_cb_t*)emalloc(sizeof(php_git2_cb_t)); - if (cb == NULL) { - return 1; - } - - cb->payload = payload; - cb->fci = fci; - cb->fcc = fcc; - GIT2_TSRMLS_SET2(cb, TSRMLS_C); - - *out = cb; - return 0; -} - -void php_git2_cb_free(php_git2_cb_t *target) -{ - efree(target); -} - -void php_git2_array_to_strarray(git_strarray *out, zval *array TSRMLS_DC) -{ - int elements = 0, i; - HashPosition pos; - zval **value; - - if (array == NULL) { - return; - } - if (Z_TYPE_P(array) != IS_ARRAY){ - return; - } - if (zend_hash_num_elements(Z_ARRVAL_P(array)) == 0) { - return; - } - - elements = zend_hash_num_elements(Z_ARRVAL_P(array)); - out->strings = (char**)emalloc(sizeof(char*) * elements); - out->count = elements; - for (i = 0, zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); - zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&value, &pos) == SUCCESS; - zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos), i++) { - char *buffer; - - Z_STRVAL_PP(value); - buffer = emalloc(sizeof(char*) * Z_STRLEN_PP(value) + 1); - memcpy(buffer, Z_STRVAL_PP(value), Z_STRLEN_PP(value)); - buffer[Z_STRLEN_PP(value)] = '\0'; - out->strings[i] = buffer; - } -} - -void php_git2_strarray_free(git_strarray *out) -{ - int i = 0; - for (i = 0; i < out->count; i++) { - efree(out->strings[i]); - } - efree(out->strings); -} - -void php_git2_git_checkout_opts_to_array(git_checkout_opts *opts, zval **out TSRMLS_DC) -{ - zval *result; - git_checkout_opts tmp = GIT_CHECKOUT_OPTS_INIT; - opts = &tmp; - - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("version"), opts->version); - add_assoc_long_ex(result, ZEND_STRS("checkout_strategy"), opts->checkout_strategy); - add_assoc_long_ex(result, ZEND_STRS("disable_filters"), opts->disable_filters); - add_assoc_long_ex(result, ZEND_STRS("dir_mode"), opts->dir_mode); - add_assoc_long_ex(result, ZEND_STRS("file_mode"), opts->file_mode); - add_assoc_long_ex(result, ZEND_STRS("file_open_flags"), opts->file_open_flags); - add_assoc_long_ex(result, ZEND_STRS("notify_flags"), opts->notify_flags); - - if (opts->notify_payload != NULL) { - - } else { - add_assoc_null_ex(result, ZEND_STRS("notify_cb")); - } - - if (opts->notify_payload != NULL) { - - } else { - add_assoc_null_ex(result, ZEND_STRS("notify_payload")); - } - - if (opts->progress_cb != NULL) { - - } else { - add_assoc_null_ex(result, ZEND_STRS("progress_cb")); - } - - if (opts->progress_payload != NULL) { - - } else { - add_assoc_null_ex(result, ZEND_STRS("progress_payload")); - } - - if (opts->paths.count > 0) { - zval *paths; - php_git2_strarray_to_array(&opts->paths, &paths TSRMLS_CC); - add_assoc_zval_ex(result, ZEND_STRS("paths"), paths); - } else { - zval *paths; - MAKE_STD_ZVAL(paths); - array_init(paths); - add_assoc_zval_ex(result, ZEND_STRS("paths"), paths); - } - - if (opts->baseline != NULL) { - // git_tree - - } else { - add_assoc_null_ex(result, ZEND_STRS("baseline")); - } - add_assoc_string_ex(result, ZEND_STRS("target_directory"), (opts->target_directory) ? opts->target_directory : "", 1); - add_assoc_string_ex(result, ZEND_STRS("our_label"), (opts->our_label) ? opts->our_label : "", 1); - add_assoc_string_ex(result, ZEND_STRS("their_label"), (opts->their_label) ? opts->their_label : "", 1); - - *out = result; -} - -void php_git_git_checkout_opts_free(git_checkout_opts *target TSRMLS_DC) -{ - php_git2_cb_t *tmp; - - if (target->notify_payload) { - tmp = (php_git2_cb_t*)target->notify_payload; - if (tmp->fci) { - efree(tmp->fci); - } - if (tmp->fcc) { - efree(tmp->fcc); - } - efree(target->notify_payload); - } - if (target->progress_payload) { - tmp = (php_git2_cb_t*)target->progress_payload; - if (tmp->fci) { - efree(tmp->fci); - } - if (tmp->fcc) { - efree(tmp->fcc); - } - efree(target->progress_payload); - } - - php_git2_strarray_free(&target->paths); - efree(target); -} - - -static int php_git2_git_checkout_notify_cb(git_checkout_notify_t why, - const char *path, - const git_diff_file *baseline, - const git_diff_file *target, - const git_diff_file *workdir, - void *payload) -{ - /* TODO(chobie): implement callback */ -} - -void php_git2_git_checkout_progress_cb(const char *path, - size_t completed_steps, - size_t total_steps, - void *payload) -{ - zval *param_path, *param_completed_steps, *param_total_steps, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - GIT2_TSRMLS_SET(p->tsrm_ls); - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_path); - MAKE_STD_ZVAL(param_completed_steps); - MAKE_STD_ZVAL(param_total_steps); - ZVAL_NULL(param_path); - if (path != NULL) { - ZVAL_STRING(param_path, path, 1); - } - ZVAL_LONG(param_completed_steps, completed_steps); - ZVAL_LONG(param_total_steps, total_steps); - - SEPARATE_ZVAL_TO_MAKE_IS_REF(&p->payload); - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 4, ¶m_path, ¶m_completed_steps, ¶m_total_steps, &p->payload)) { - return; - } - - zval_ptr_dtor(&retval_ptr); -} - - -void php_git2_fcall_info_wrapper(zval *target, zend_fcall_info **out_fci, zend_fcall_info_cache **out_fcc TSRMLS_DC) -{ - char *is_callable_error = NULL; - zend_fcall_info *fci = NULL; - zend_fcall_info_cache *fcc = NULL; - - fci = (zend_fcall_info*)emalloc(sizeof(zend_fcall_info)); - fcc = (zend_fcall_info_cache*)emalloc(sizeof(zend_fcall_info_cache)); - memcpy(fci, &empty_fcall_info, sizeof(zend_fcall_info)); - memcpy(fcc, &empty_fcall_info_cache, sizeof(zend_fcall_info_cache)); - - if (zend_fcall_info_init(target, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) { - if (is_callable_error) { - efree(is_callable_error); - } - } else { - fprintf(stderr, "FAILED"); - efree(fci); - efree(fcc); - return; - } - - *out_fci = fci; - *out_fcc = fcc; -} - -void php_git2_fcall_info_wrapper2(zval *target, zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC) -{ - char *is_callable_error = NULL; - - memcpy(fci, &empty_fcall_info, sizeof(zend_fcall_info)); - memcpy(fcc, &empty_fcall_info_cache, sizeof(zend_fcall_info_cache)); - - if (zend_fcall_info_init(target, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) { - if (is_callable_error) { - efree(is_callable_error); - } - } else { - fprintf(stderr, "FAILED"); - efree(fci); - efree(fcc); - return; - } -} - - - -int php_git2_array_to_git_checkout_opts(git_checkout_opts **out, zval *array TSRMLS_DC) -{ - const char *target_directory, *our_label, *their_label; - git_checkout_opts *opts = NULL, def = GIT_CHECKOUT_OPTS_INIT; - php_git2_cb_t *notify_payload = NULL, *progress_payload= NULL; - zval *notify_cb = NULL, *progress_cb = NULL; - - opts = (git_checkout_opts*)emalloc(sizeof(struct git_checkout_opts)); - memcpy(opts, &def, sizeof(git_checkout_opts)); - - notify_cb = php_git2_read_arrval(array, ZEND_STRS("notify_cb") TSRMLS_CC); - progress_cb = php_git2_read_arrval(array, ZEND_STRS("progress_cb") TSRMLS_CC); - - - opts->notify_cb = php_git2_git_checkout_notify_cb; - opts->progress_cb = php_git2_git_checkout_progress_cb; - opts->version = php_git2_read_arrval_long(array, ZEND_STRS("version") TSRMLS_CC); - opts->checkout_strategy = php_git2_read_arrval_long(array, ZEND_STRS("checkout_strategy") TSRMLS_CC); - opts->disable_filters = php_git2_read_arrval_long(array, ZEND_STRS("disable_filters") TSRMLS_CC); - opts->dir_mode = php_git2_read_arrval_long(array, ZEND_STRS("dir_mode") TSRMLS_CC); - opts->file_mode = php_git2_read_arrval_long(array, ZEND_STRS("file_mode") TSRMLS_CC); - opts->file_open_flags = php_git2_read_arrval_long(array, ZEND_STRS("file_open_flags") TSRMLS_CC); - opts->notify_flags = php_git2_read_arrval_long(array, ZEND_STRS("notify_flags") TSRMLS_CC); - - //notify_cb - if (Z_TYPE_P(notify_cb) != IS_NULL) { - zend_fcall_info *fci; - zend_fcall_info_cache *fcc; - - php_git2_fcall_info_wrapper(notify_cb, &fci, &fcc TSRMLS_CC); - if (php_git2_cb_init(¬ify_payload, fci, fcc, - php_git2_read_arrval(array, ZEND_STRS("notify_payload") TSRMLS_CC) TSRMLS_CC)) { - } - opts->notify_payload = notify_payload; - } else { - opts->notify_cb = NULL; - } - - //progress_cb - if (Z_TYPE_P(progress_cb) != IS_NULL) { - zend_fcall_info *fci; - zend_fcall_info_cache *fcc; - - php_git2_fcall_info_wrapper(progress_cb, &fci, &fcc TSRMLS_CC); - if (php_git2_cb_init(&progress_payload, fci, fcc, - php_git2_read_arrval(array, ZEND_STRS("progress_payload") TSRMLS_CC) TSRMLS_CC)) { - } - opts->progress_payload = progress_payload; - } else { - opts->progress_cb = NULL; - } - - - php_git2_array_to_strarray(&opts->paths, php_git2_read_arrval(array, ZEND_STRS("paths") TSRMLS_CC) TSRMLS_CC); - - // TODO: assign baseline(git_tree) - - target_directory = php_git2_read_arrval_string(array, ZEND_STRS("target_directory") TSRMLS_CC); - our_label = php_git2_read_arrval_string(array, ZEND_STRS("our_label") TSRMLS_CC); - their_label = php_git2_read_arrval_string(array, ZEND_STRS("their_label") TSRMLS_CC); - opts->target_directory = target_directory; - opts->our_label = our_label; - opts->their_label = their_label; - - *out = opts; - return 0; -} - -int php_git2_multi_cb_init(php_git2_multi_cb_t **out, void *payload TSRMLS_DC, int num_callbacks, ...) -{ - php_git2_multi_cb_t *cb; - int i = 0; - va_list ap; - - cb = (struct php_git2_multi_cb_t*)emalloc(sizeof(php_git2_multi_cb_t)); - if (cb == NULL) { - return 1; - } - - cb->payload = payload; - cb->num_callbacks = num_callbacks; - GIT2_TSRMLS_SET2(cb, TSRMLS_C); - - cb->callbacks = emalloc(sizeof(php_git2_fcall_t) * num_callbacks); - memset(cb->callbacks, '\0', sizeof(php_git2_fcall_t) * num_callbacks); - va_start(ap, num_callbacks * 2); - for (i = 0; i < num_callbacks; i++) { - memcpy(&cb->callbacks[i].fci, va_arg(ap, zend_fcall_info*), sizeof(zend_fcall_info)); - memcpy(&cb->callbacks[i].fcc, va_arg(ap, zend_fcall_info_cache*), sizeof(zend_fcall_info_cache)); - } - va_end(ap); - - *out = cb; - return 0; -} - -void php_git2_multi_cb_free(php_git2_multi_cb_t *target) -{ - efree(target->callbacks); - efree(target); -} - -void php_git2_diff_line_to_array(git_diff_line *line, zval **out TSRMLS_DC) -{ - zval *result; - - MAKE_STD_ZVAL(result); - array_init(result); - add_assoc_stringl_ex(result, ZEND_STRS("origin"), &line->origin, 1, 1); - add_assoc_long_ex(result, ZEND_STRS("old_lineno"), line->old_lineno); - add_assoc_long_ex(result, ZEND_STRS("new_lineno"), line->new_lineno); - add_assoc_long_ex(result, ZEND_STRS("num_lines"), line->num_lines); - add_assoc_long_ex(result, ZEND_STRS("content_len"), line->content_len); - add_assoc_long_ex(result, ZEND_STRS("content_offset"), line->content_offset); - add_assoc_stringl_ex(result, ZEND_STRS("content"), line->content, line->content_len, 1); - - *out = result; -} - -void php_git2_diff_hunk_to_array(git_diff_hunk *hunk, zval **out TSRMLS_DC) -{ - zval *result; - - MAKE_STD_ZVAL(result); - if (hunk == NULL) { - ZVAL_NULL(result); - } else { - array_init(result); - add_assoc_long_ex(result, ZEND_STRS("old_start"), hunk->old_start); - add_assoc_long_ex(result, ZEND_STRS("old_lines"), hunk->old_lines); - add_assoc_long_ex(result, ZEND_STRS("new_start"), hunk->new_start); - add_assoc_long_ex(result, ZEND_STRS("new_lines"), hunk->new_lines); - add_assoc_stringl_ex(result, ZEND_STRS("header"), hunk->header, 128, 1); - } - - *out = result; -} - -void php_git2_diff_file_to_array(git_diff_file *file, zval **out TSRMLS_DC) -{ - zval *result; - char buf[41] = {0}; - - MAKE_STD_ZVAL(result); - array_init(result); - git_oid_fmt(buf, &file->oid); - - add_assoc_string_ex(result, ZEND_STRS("oid"), buf, 1); - add_assoc_string_ex(result, ZEND_STRS("path"), file->path, 1); - add_assoc_long_ex(result, ZEND_STRS("size"), file->size); - add_assoc_long_ex(result, ZEND_STRS("flags"), file->flags); - add_assoc_long_ex(result, ZEND_STRS("mode"), file->mode); - - *out = result; -} - -void php_git2_diff_delta_to_array(git_diff_delta *delta, zval **out TSRMLS_DC) -{ - zval *result, *old, *new; - - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("status"), delta->status); - add_assoc_long_ex(result, ZEND_STRS("flags"), delta->flags); - add_assoc_long_ex(result, ZEND_STRS("similarity"), delta->similarity); - add_assoc_long_ex(result, ZEND_STRS("nfiles"), delta->nfiles); - - php_git2_diff_file_to_array(&delta->old_file, &old TSRMLS_CC); - php_git2_diff_file_to_array(&delta->new_file, &new TSRMLS_CC); - - add_assoc_zval_ex(result, ZEND_STRS("old_file"), old); - add_assoc_zval_ex(result, ZEND_STRS("new_file"), new); - - *out = result; -} - -void php_git2_array_to_git_diff_options(git_diff_options *options, zval *array TSRMLS_DC) -{ - git_diff_options_init(options, GIT_DIFF_OPTIONS_VERSION); - - options->version = php_git2_read_arrval_long(array, ZEND_STRS("version") TSRMLS_CC); - options->flags = php_git2_read_arrval_long(array, ZEND_STRS("flags") TSRMLS_CC); - options->ignore_submodules = php_git2_read_arrval_long(array, ZEND_STRS("ignore_submodules") TSRMLS_CC); - - php_git2_array_to_strarray(&options->pathspec, php_git2_read_arrval(array, ZEND_STRS("pathspec") TSRMLS_CC) TSRMLS_CC); - // TODO(chobie): support notify cb - - options->context_lines = php_git2_read_arrval_long(array, ZEND_STRS("context_lines") TSRMLS_CC); - options->interhunk_lines = php_git2_read_arrval_long(array, ZEND_STRS("interhunk_lines") TSRMLS_CC); - options->oid_abbrev = php_git2_read_arrval_long(array, ZEND_STRS("oid_abbrev") TSRMLS_CC); - options->max_size = php_git2_read_arrval_long(array, ZEND_STRS("max_size") TSRMLS_CC); - options->old_prefix = php_git2_read_arrval_string(array, ZEND_STRS("old_prefix") TSRMLS_CC); - options->new_prefix = php_git2_read_arrval_string(array, ZEND_STRS("new_prefix") TSRMLS_CC); -} - -void php_git2_git_diff_options_free(git_diff_options *options) -{ - if (options->pathspec.count > 0) { - efree(options->pathspec.strings); - } -} - -void php_git2_git_diff_options_to_array(git_diff_options *options, zval **out TSRMLS_DC) -{ - zval *result, *pathspec; - - MAKE_STD_ZVAL(result); - array_init(result); - add_assoc_long_ex(result, ZEND_STRS("version"), options->version); - add_assoc_long_ex(result, ZEND_STRS("flags"), options->flags); - add_assoc_long_ex(result, ZEND_STRS("ignore_submodules"), options->ignore_submodules); - - MAKE_STD_ZVAL(pathspec); - array_init(pathspec); - if (options->pathspec.count > 0) { - } else { - add_assoc_zval_ex(result, ZEND_STRS("pathspec"), pathspec); - } - - if (options->notify_cb) { - } else { - add_assoc_null_ex(result, ZEND_STRS("notify_cb")); - } - - add_assoc_long_ex(result, ZEND_STRS("context_lines"), options->context_lines); - add_assoc_long_ex(result, ZEND_STRS("interhunk_lines"), options->interhunk_lines); - add_assoc_long_ex(result, ZEND_STRS("oid_abbrev"), options->oid_abbrev); - add_assoc_long_ex(result, ZEND_STRS("max_size"), options->max_size); - if (options->notify_payload) { - } else { - add_assoc_null_ex(result, ZEND_STRS("notify_payload")); - } - if (options->old_prefix) { - add_assoc_string_ex(result, ZEND_STRS("old_prefix"), options->old_prefix, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("old_prefix")); - } - if (options->new_prefix) { - add_assoc_string_ex(result, ZEND_STRS("new_prefix"), options->new_prefix, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("new_prefix")); - } - - *out = result; -} - -int php_git2_git_diff_file_cb( - const git_diff_delta *delta, - float progress, - void *payload) -{ - zval *param_delta = NULL, *param_progress = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = (php_git2_multi_cb_t*)payload; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_progress); - ZVAL_DOUBLE(param_progress, progress); - php_git2_diff_delta_to_array(delta, ¶m_delta TSRMLS_CC); - if (php_git2_call_function_v(&p->callbacks[0].fci, &p->callbacks[0].fcc TSRMLS_CC, &retval_ptr, 3, ¶m_delta, ¶m_progress, &p->payload)) { - return GIT_EUSER; - } - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - - return retval; -} - -int php_git2_git_diff_hunk_cb( - const git_diff_delta *delta, - const git_diff_hunk *hunk, - void *payload) -{ - zval *param_delta = NULL, *param_hunk = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = (php_git2_multi_cb_t*)payload; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - php_git2_diff_delta_to_array(delta, ¶m_delta TSRMLS_CC); - php_git2_diff_hunk_to_array(hunk, ¶m_hunk TSRMLS_CC); - - if (php_git2_call_function_v(&p->callbacks[1].fci, &p->callbacks[1].fcc TSRMLS_CC, &retval_ptr, 3, ¶m_delta, ¶m_hunk, &p->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -int php_git2_git_diff_line_cb( - const git_diff_delta *delta, - const git_diff_hunk *hunk, - const git_diff_line *line, - void *payload) { - zval *param_delta = NULL, *param_hunk = NULL, *param_line = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = (php_git2_multi_cb_t*)payload; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - php_git2_diff_delta_to_array(delta, ¶m_delta TSRMLS_CC); - php_git2_diff_hunk_to_array(hunk, ¶m_hunk TSRMLS_CC); - php_git2_diff_line_to_array(line, ¶m_line TSRMLS_CC); - - if (php_git2_call_function_v(&p->callbacks[2].fci, &p->callbacks[2].fcc TSRMLS_CC, &retval_ptr, 4, ¶m_delta, ¶m_hunk, ¶m_line, &p->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -void php_git2_git_transfer_progress_to_array(git_transfer_progress *progress, zval **out TSRMLS_DC) -{ - zval *result; - - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("total_objects"), progress->total_objects); - add_assoc_long_ex(result, ZEND_STRS("indexed_objects"), progress->indexed_objects); - add_assoc_long_ex(result, ZEND_STRS("received_objects"), progress->received_objects); - add_assoc_long_ex(result, ZEND_STRS("local_objects"), progress->local_objects); - add_assoc_long_ex(result, ZEND_STRS("total_deltas"), progress->total_deltas); - add_assoc_long_ex(result, ZEND_STRS("indexed_deltas"), progress->indexed_deltas); - add_assoc_long_ex(result, ZEND_STRS("received_bytes"), progress->received_bytes); - - *out = result; -} diff --git a/helper.h b/helper.h deleted file mode 100644 index 424f1c3f89..0000000000 --- a/helper.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_HELPER_H -#define PHP_GIT2_HELPER_H - -/* NOTE(chobie): all functions should have `php_git2_` prefix */ - -int php_git2_check_error(int error_code, const char *action TSRMLS_DC); - -zval* php_git2_read_arrval(zval *array, char *name, size_t name_len TSRMLS_DC); - -long php_git2_read_arrval_long2(zval *array, char *name, size_t name_len, long value TSRMLS_DC); - -long php_git2_read_arrval_long(zval *array, char *name, size_t name_len TSRMLS_DC); - -const char* php_git2_read_arrval_string(zval *array, char *name, size_t name_len TSRMLS_DC); - -void php_git2_array_to_signature(git_signature *signature, zval *author TSRMLS_DC); - -void php_git2_signature_to_array(const git_signature *signature, zval **out TSRMLS_DC); - -void php_git2_strarray_to_array(git_strarray *array, zval **out TSRMLS_DC); - -int php_git2_call_function_v( - zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC, zval **retval_ptr_ptr, zend_uint param_count, ...); - -int php_git2_cb_init(php_git2_cb_t **out, zend_fcall_info *fci, zend_fcall_info_cache *fcc, void *payload TSRMLS_DC); - -void php_git2_cb_free(php_git2_cb_t *target); - -void php_git2_array_to_strarray(git_strarray *out, zval *array TSRMLS_DC); - -void php_git2_strarray_free(git_strarray *out); - -void php_git2_git_checkout_opts_to_array(git_checkout_opts *opts, zval **out TSRMLS_DC); - -void php_git_git_checkout_opts_free(git_checkout_opts *target TSRMLS_DC); - -int php_git2_array_to_git_checkout_opts(git_checkout_opts **out, zval *array TSRMLS_DC); - -int php_git2_multi_cb_init(php_git2_multi_cb_t **out, void *payload TSRMLS_DC, int num_callbacks, ...); - -void php_git2_multi_cb_free(php_git2_multi_cb_t *target); - -void php_git2_diff_line_to_array(git_diff_line *line, zval **out TSRMLS_DC); - -void php_git2_diff_hunk_to_array(git_diff_hunk *hunk, zval **out TSRMLS_DC); - -void php_git2_diff_file_to_array(git_diff_file *file, zval **out TSRMLS_DC); - -void php_git2_diff_delta_to_array(git_diff_delta *delta, zval **out TSRMLS_DC); - -void php_git2_array_to_git_diff_options(git_diff_options *options, zval *array TSRMLS_DC); - -void php_git2_git_diff_options_free(git_diff_options *options); - -void php_git2_git_diff_options_to_array(git_diff_options *options, zval **out TSRMLS_DC); - -int php_git2_git_diff_file_cb( - const git_diff_delta *delta, - float progress, - void *payload); - -int php_git2_git_diff_hunk_cb( - const git_diff_delta *delta, - const git_diff_hunk *hunk, - void *payload); -int php_git2_git_diff_line_cb( - const git_diff_delta *delta, - const git_diff_hunk *hunk, - const git_diff_line *line, - void *payload); - -void php_git2_git_transfer_progress_to_array(git_transfer_progress *progress, zval **out TSRMLS_DC); - -void php_git2_fcall_info_wrapper(zval *target, zend_fcall_info **out_fci, zend_fcall_info_cache **out_fcc TSRMLS_DC); - -void php_git2_fcall_info_wrapper2(zval *target, zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC); - -#endif \ No newline at end of file diff --git a/ignore.c b/ignore.c deleted file mode 100644 index 56dab079ae..0000000000 --- a/ignore.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "ignore.h" - -/* {{{ proto long git_ignore_add_rule(resource $repo, string $rules) - */ -PHP_FUNCTION(git_ignore_add_rule) -{ - int result = 0, rules_len = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *rules = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &rules, &rules_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_ignore_add_rule(PHP_GIT2_V(_repo, repository), rules); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_ignore_clear_internal_rules(resource $repo) - */ -PHP_FUNCTION(git_ignore_clear_internal_rules) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_ignore_clear_internal_rules(PHP_GIT2_V(_repo, repository)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_ignore_path_is_ignored(long $ignored, resource $repo, string $path) - */ -PHP_FUNCTION(git_ignore_path_is_ignored) -{ - int result = 0, path_len = 0; - long ignored = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *path = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "lrs", &ignored, &repo, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_ignore_path_is_ignored(ignored, PHP_GIT2_V(_repo, repository), path); - RETURN_BOOL(result); -} -/* }}} */ - diff --git a/ignore.h b/ignore.h deleted file mode 100644 index 9fc261047a..0000000000 --- a/ignore.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_IGNORE_H -#define PHP_GIT2_IGNORE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_ignore_add_rule, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, rules) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_ignore_clear_internal_rules, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_ignore_path_is_ignored, 0, 0, 3) - ZEND_ARG_INFO(0, ignored) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_ignore_add_rule(repo, rules) -*/ -PHP_FUNCTION(git_ignore_add_rule); - -/* {{{ proto long git_ignore_clear_internal_rules(repo) -*/ -PHP_FUNCTION(git_ignore_clear_internal_rules); - -/* {{{ proto long git_ignore_path_is_ignored(ignored, repo, path) -*/ -PHP_FUNCTION(git_ignore_path_is_ignored); - -#endif \ No newline at end of file diff --git a/index.c b/index.c deleted file mode 100644 index 4e7d5be4e7..0000000000 --- a/index.c +++ /dev/null @@ -1,866 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "index.h" - -static int php_git2_index_matched_path_cb(const char *path, const char *matched_pathspec, void *payload) -{ - zval *param_path, *param_matched_pathspec, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_path); - MAKE_STD_ZVAL(param_matched_pathspec); - ZVAL_STRING(param_path, path, 1); - ZVAL_STRING(param_matched_pathspec, matched_pathspec, 1); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 3, ¶m_path, ¶m_matched_pathspec, &p->payload)) { - zval_ptr_dtor(¶m_path); - zval_ptr_dtor(¶m_matched_pathspec); - zval_ptr_dtor(&p->payload); - return 0; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - - -static int php_git2_array_to_index_entry(git_index_entry *entry, zval *array TSRMLS_DC) -{ - zval *ctime, *mtime, *oid; - memset(entry, '\0', sizeof(git_index_entry)); - - ctime = php_git2_read_arrval(array, ZEND_STRS("ctime") TSRMLS_CC); - mtime = php_git2_read_arrval(array, ZEND_STRS("mtime") TSRMLS_CC); - - oid = php_git2_read_arrval(array, ZEND_STRS("oid") TSRMLS_CC); - if (git_oid_fromstrn(&entry->oid, Z_STRVAL_P(oid), Z_STRLEN_P(oid)) != GIT_OK) { - return 0; - } - - entry->ctime.seconds = php_git2_read_arrval_long(ctime, ZEND_STRS("seconds") TSRMLS_CC); - entry->ctime.nanoseconds = php_git2_read_arrval_long(ctime, ZEND_STRS("nanoseconds") TSRMLS_CC); - entry->mtime.seconds = php_git2_read_arrval_long(mtime, ZEND_STRS("seconds") TSRMLS_CC); - entry->mtime.nanoseconds = php_git2_read_arrval_long(mtime, ZEND_STRS("nanoseconds") TSRMLS_CC); - entry->dev = php_git2_read_arrval_long(array, ZEND_STRS("dev") TSRMLS_CC); - entry->ino = php_git2_read_arrval_long(array, ZEND_STRS("ino") TSRMLS_CC); - entry->mode = php_git2_read_arrval_long(array, ZEND_STRS("mode") TSRMLS_CC); - entry->uid = php_git2_read_arrval_long(array, ZEND_STRS("uid") TSRMLS_CC); - entry->gid = php_git2_read_arrval_long(array, ZEND_STRS("gid") TSRMLS_CC); - entry->file_size = php_git2_read_arrval_long(array, ZEND_STRS("file_size") TSRMLS_CC); - entry->flags = php_git2_read_arrval_long(array, ZEND_STRS("flags") TSRMLS_CC); - entry->flags_extended = php_git2_read_arrval_long(array, ZEND_STRS("flags_extended") TSRMLS_CC); - entry->path = php_git2_read_arrval_string(array, ZEND_STRS("path") TSRMLS_CC); - - return 1; -} - -static void php_git2_index_entry_to_array(const git_index_entry *entry, zval **result TSRMLS_DC) -{ - zval *tmp, *ctime, *mtime; - char buf[GIT2_OID_HEXSIZE] = {0}; - - MAKE_STD_ZVAL(tmp); - MAKE_STD_ZVAL(ctime); - MAKE_STD_ZVAL(mtime); - array_init(tmp); - array_init(ctime); - array_init(mtime); - - git_oid_fmt(buf, &entry->oid); - - add_assoc_long_ex(ctime, ZEND_STRS("seconds"), entry->ctime.seconds); - add_assoc_long_ex(ctime, ZEND_STRS("nanoseconds"), entry->ctime.nanoseconds); - add_assoc_long_ex(mtime, ZEND_STRS("seconds"), entry->mtime.seconds); - add_assoc_long_ex(mtime, ZEND_STRS("nanoseconds"), entry->mtime.nanoseconds); - - add_assoc_zval_ex(tmp, ZEND_STRS("ctime"), ctime); - add_assoc_zval_ex(tmp, ZEND_STRS("mtime"), mtime); - - add_assoc_long_ex(tmp, ZEND_STRS("dev"), entry->dev); - add_assoc_long_ex(tmp, ZEND_STRS("ino"), entry->ino); - add_assoc_long_ex(tmp, ZEND_STRS("mode"), entry->mode); - add_assoc_long_ex(tmp, ZEND_STRS("uid"), entry->uid); - add_assoc_long_ex(tmp, ZEND_STRS("gid"), entry->gid); - add_assoc_long_ex(tmp, ZEND_STRS("file_size"), entry->file_size); - add_assoc_string_ex(tmp, ZEND_STRS("oid"), buf, 1); - add_assoc_long_ex(tmp, ZEND_STRS("flags"), entry->flags); - add_assoc_long_ex(tmp, ZEND_STRS("flags_extended"), entry->flags_extended); - add_assoc_string_ex(tmp, ZEND_STRS("path"), entry->path, 1); - - *result = tmp; -} - -/* {{{ proto resource git_index_open(index_path) -*/ -PHP_FUNCTION(git_index_open) -{ - char *index_path = {0}; - int index_path_len; - git_index *index; - php_git2_t *result; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &index_path, &index_path_len) == FAILURE) { - return; - } - error = git_index_open(&index, index_path); - if (php_git2_check_error(error, "git_index_open" TSRMLS_CC)) { - RETURN_FALSE - } - - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, index) = index; - result->type = PHP_GIT2_TYPE_INDEX; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 1; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto resource git_index_new() -*/ -PHP_FUNCTION(git_index_new) -{ - git_index *index; - php_git2_t *result; - int error = 0; - - error = git_index_new(&index); - if (php_git2_check_error(error, "git_index_new" TSRMLS_CC)) { - RETURN_FALSE - } - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, index) = index; - result->type = PHP_GIT2_TYPE_INDEX; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 1; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto void git_index_free(index) -*/ -PHP_FUNCTION(git_index_free) -{ - zval *index; - php_git2_t *_index; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (_index->should_free_v) { - git_index_free(PHP_GIT2_V(_index, index)); - _index->should_free_v = 0; - } - zval_ptr_dtor(&index); -} - -/* {{{ proto resource git_index_owner(index) -*/ -PHP_FUNCTION(git_index_owner) -{ - zval *index; - php_git2_t *_index, *result; - git_repository *repository; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - repository = git_index_owner(PHP_GIT2_V(_index, index)); - PHP_GIT2_MAKE_RESOURCE(result); - PHP_GIT2_V(result, repository) = repository; - result->type = PHP_GIT2_TYPE_REPOSITORY; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = 0; - - ZVAL_RESOURCE(return_value, result->resource_id); -} - -/* {{{ proto resource git_index_caps(index) -*/ -PHP_FUNCTION(git_index_caps) -{ - zval *index; - php_git2_t *_index; - unsigned int caps; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - caps = git_index_caps(PHP_GIT2_V(_index, index)); - RETURN_LONG(caps); -} - -/* {{{ proto long git_index_set_caps(index, caps) -*/ -PHP_FUNCTION(git_index_set_caps) -{ - zval *index; - php_git2_t *_index; - long caps; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &index, &caps) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_set_caps(PHP_GIT2_V(_index, index), caps); - RETURN_LONG(error); -} - -/* {{{ proto long git_index_read(index, force) -*/ -PHP_FUNCTION(git_index_read) -{ - zval *index; - php_git2_t *_index; - long force; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &index, &force) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_read(PHP_GIT2_V(_index, index), force); - if (php_git2_check_error(error, "git_index_read" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto resource git_index_write() -*/ -PHP_FUNCTION(git_index_write) -{ - zval *index; - php_git2_t *_index; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_write(PHP_GIT2_V(_index, index)); - if (php_git2_check_error(error, "git_index_write" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto resource git_index_path(index) -*/ -PHP_FUNCTION(git_index_path) -{ - zval *index; - php_git2_t *_index; - const char *path; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - path = git_index_path(PHP_GIT2_V(_index, index)); - RETURN_STRING(path, 1); -} - -/* {{{ proto long git_index_read_tree(index, tree) -*/ -PHP_FUNCTION(git_index_read_tree) -{ - zval *index; - php_git2_t *_index; - zval *tree; - php_git2_t *_tree; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &index, &tree) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_tree, php_git2_t*, &tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_read_tree(PHP_GIT2_V(_index, index), PHP_GIT2_V(_tree, tree)); - if (php_git2_check_error(error, "git_index_read_tree" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto resource git_index_write_tree(index) -*/ -PHP_FUNCTION(git_index_write_tree) -{ - zval *index; - php_git2_t *_index; - int error = 0; - git_oid id; - char out[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_write_tree(&id, PHP_GIT2_V(_index, index)); - if (php_git2_check_error(error, "git_index_write_tree" TSRMLS_CC)) { - RETURN_FALSE - } - git_oid_fmt(out, &id); - RETURN_STRING(out, 1); -} - -/* {{{ proto resource git_index_write_tree_to(index, repo) -*/ -PHP_FUNCTION(git_index_write_tree_to) -{ - zval *index; - php_git2_t *_index; - zval *repo; - php_git2_t *_repo; - git_oid id; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &index, &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_write_tree_to(&id, PHP_GIT2_V(_index, index), PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_index_write_tree_to" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto resource git_index_entrycount(index) -*/ -PHP_FUNCTION(git_index_entrycount) -{ - zval *index; - php_git2_t *_index; - size_t count; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - count = git_index_entrycount(PHP_GIT2_V(_index, index)); - RETURN_LONG(count); -} - -/* {{{ proto void git_index_clear(index) -*/ -PHP_FUNCTION(git_index_clear) -{ - zval *index; - php_git2_t *_index; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_index_clear(PHP_GIT2_V(_index, index)); -} - -/* {{{ proto resource git_index_get_byindex(index, n) -*/ -PHP_FUNCTION(git_index_get_byindex) -{ - zval *index; - php_git2_t *_index; - long n; - const git_index_entry *entry; - zval *result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &index, &n) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - entry = git_index_get_byindex(PHP_GIT2_V(_index, index), n); - if (entry == NULL) { - RETURN_FALSE; - } - php_git2_index_entry_to_array(entry, &result TSRMLS_CC); - RETURN_ZVAL(result, 0, 1); -} - -/* {{{ proto resource git_index_get_bypath(index, path, stage) -*/ -PHP_FUNCTION(git_index_get_bypath) -{ - zval *index; - php_git2_t *_index; - char *path = {0}; - int path_len; - long stage = 0; - const git_index_entry *entry; - zval *result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs|l", &index, &path, &path_len, &stage) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - entry = git_index_get_bypath(PHP_GIT2_V(_index, index), path, stage); - if (entry == NULL) { - RETURN_FALSE; - } - php_git2_index_entry_to_array(entry, &result TSRMLS_CC); - RETURN_ZVAL(result, 0, 1); -} - -/* {{{ proto long git_index_remove(index, path, stage) -*/ -PHP_FUNCTION(git_index_remove) -{ - zval *index; - php_git2_t *_index; - char *path = {0}; - int path_len; - long stage = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &index, &path, &path_len, &stage) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_remove(PHP_GIT2_V(_index, index), path, stage); - if (php_git2_check_error(error, "git_index_remove" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} - -/* {{{ proto long git_index_remove_directory(index, dir, stage) -*/ -PHP_FUNCTION(git_index_remove_directory) -{ - zval *index; - php_git2_t *_index; - char *dir = {0}; - int dir_len; - long stage = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &index, &dir, &dir_len, &stage) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_remove_directory(PHP_GIT2_V(_index, index), dir, stage); - if (php_git2_check_error(error, "git_index_remove_directory" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} - -/* {{{ proto long git_index_add(index, source_entry) -*/ -PHP_FUNCTION(git_index_add) -{ - zval *index; - php_git2_t *_index; - zval *source_entry; - int error = 0; - git_index_entry entry; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ra", &index, &source_entry) == FAILURE) { - return; - } - if (!php_git2_array_to_index_entry(&entry, source_entry TSRMLS_CC)) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_add(PHP_GIT2_V(_index, index), &entry); - if (php_git2_check_error(error, "git_index_add" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto long git_index_entry_stage(entry) -*/ -PHP_FUNCTION(git_index_entry_stage) -{ - zval *source; - git_index_entry entry; - int result = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "a", &source) == FAILURE) { - return; - } - if (!php_git2_array_to_index_entry(&entry, source TSRMLS_CC)) { - return; - } - result = git_index_entry_stage(&entry); - RETURN_LONG(result); -} - -/* {{{ proto long git_index_add_bypath(index, path) -*/ -PHP_FUNCTION(git_index_add_bypath) -{ - zval *index; - php_git2_t *_index; - char *path = {0}; - int path_len; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &index, &path, &path_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_add_bypath(PHP_GIT2_V(_index, index), path); - if (php_git2_check_error(error, "git_index_add_bypath" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto long git_index_remove_bypath(index, path) -*/ -PHP_FUNCTION(git_index_remove_bypath) -{ - zval *index; - php_git2_t *_index; - char *path = {0}; - int path_len; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &index, &path, &path_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_remove_bypath(PHP_GIT2_V(_index, index), path); - if (php_git2_check_error(error, "git_index_remove_bypath" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} - -/* {{{ proto long git_index_add_all(resource $index, array $pathspec, long $flags, Callable $callback, $payload) - */ -PHP_FUNCTION(git_index_add_all) -{ - int result = 0; - zval *index = NULL, *pathspec = NULL, *payload = NULL; - php_git2_t *_index = NULL; - git_strarray _pathspec = {0}; - long flags = 0; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ralfz", &index, &pathspec, &flags, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_strarray(&_pathspec, pathspec TSRMLS_CC); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_index_add_all(PHP_GIT2_V(_index, index), pathspec, flags, php_git2_index_matched_path_cb, cb); - php_git2_cb_free(cb); - php_git2_strarray_free(&_pathspec); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_index_remove_all(resource $index, array $pathspec, Callable $callback, $payload) - */ -PHP_FUNCTION(git_index_remove_all) -{ - int result = 0; - zval *index = NULL, *pathspec = NULL, *payload = NULL; - php_git2_t *_index = NULL; - git_strarray _pathspec = {0}; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rafz", &index, &pathspec, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_strarray(&_pathspec, pathspec TSRMLS_CC); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_index_remove_all(PHP_GIT2_V(_index, index), pathspec, php_git2_index_matched_path_cb, cb); - php_git2_cb_free(cb); - php_git2_strarray_free(&_pathspec); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_index_update_all(resource $index, array $pathspec, Callable $callback, $payload) - */ -PHP_FUNCTION(git_index_update_all) -{ - int result = 0; - zval *index = NULL, *pathspec = NULL, *payload = NULL; - php_git2_t *_index = NULL; - git_strarray _pathspec = {0}; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rafz", &index, &pathspec, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_strarray(&_pathspec, pathspec TSRMLS_CC); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_index_update_all(PHP_GIT2_V(_index, index), pathspec, php_git2_index_matched_path_cb, cb); - php_git2_cb_free(cb); - php_git2_strarray_free(&_pathspec); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_index_find(at_pos, index, path) -*/ -PHP_FUNCTION(git_index_find) -{ - zval *index; - php_git2_t *_index; - char *path = {0}; - int path_len; - long at_pos; - int result = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "lrs", &at_pos, &index, &path, &path_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_index_find(at_pos, PHP_GIT2_V(_index, index), path); - RETURN_LONG(result); -} - -/* {{{ proto long git_index_conflict_add(resource $index, $ancestor_entry, $our_entry, $their_entry) - */ -PHP_FUNCTION(git_index_conflict_add) -{ - int result = 0; - zval *index = NULL, *ancestor_entry = NULL, *our_entry = NULL, *their_entry = NULL; - php_git2_t *_index = NULL; - git_index_entry ancestor = {0}, our = {0}, their = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "raaa", &index, &ancestor_entry, &our_entry, &their_entry) == FAILURE) { - return; - } - - php_git2_array_to_index_entry(&ancestor, ancestor_entry TSRMLS_CC); - php_git2_array_to_index_entry(&our, our_entry TSRMLS_CC); - php_git2_array_to_index_entry(&their, their_entry TSRMLS_CC); - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_index_conflict_add(PHP_GIT2_V(_index, index), &ancestor, &our, &their); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_index_conflict_get(resource $index, string $path) - */ -PHP_FUNCTION(git_index_conflict_get) -{ - php_git2_t *_index = NULL; - git_index_entry *ancestor_out = NULL, *our_out = NULL, *their_out = NULL; - zval *index = NULL, *ancestor, *our, *their, *container; - char *path = NULL; - int path_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &index, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_conflict_get(&ancestor_out, &our_out, &their_out, PHP_GIT2_V(_index, index), path); - if (php_git2_check_error(error, "git_index_conflict_get" TSRMLS_CC)) { - RETURN_FALSE; - } - - php_git2_index_entry_to_array(ancestor_out, &ancestor TSRMLS_CC); - php_git2_index_entry_to_array(our_out, &our TSRMLS_CC); - php_git2_index_entry_to_array(their_out, &their TSRMLS_CC); - MAKE_STD_ZVAL(container); - array_init(container); - add_next_index_zval(container, ancestor); - add_next_index_zval(container, our); - add_next_index_zval(container, their); - RETURN_ZVAL(container, 0, 1); -} -/* }}} */ - -/* {{{ proto long git_index_conflict_remove(resource $index, string $path) - */ -PHP_FUNCTION(git_index_conflict_remove) -{ - int result = 0, path_len = 0; - zval *index = NULL; - php_git2_t *_index = NULL; - char *path = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &index, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_index_conflict_remove(PHP_GIT2_V(_index, index), path); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_index_conflict_cleanup(resource $index) - */ -PHP_FUNCTION(git_index_conflict_cleanup) -{ - zval *index = NULL; - php_git2_t *_index = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_index_conflict_cleanup(PHP_GIT2_V(_index, index)); -} -/* }}} */ - -/* {{{ proto long git_index_has_conflicts(index) -*/ -PHP_FUNCTION(git_index_has_conflicts) -{ - zval *index; - php_git2_t *_index; - int conflict = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - conflict = git_index_has_conflicts(PHP_GIT2_V(_index, index)); - RETURN_LONG(conflict); -} - -/* {{{ proto resource git_index_conflict_iterator_new(resource $index) - */ -PHP_FUNCTION(git_index_conflict_iterator_new) -{ - php_git2_t *result = NULL, *_index = NULL; - git_index_conflict_iterator *iterator_out = NULL; - zval *index = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &index) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_conflict_iterator_new(&iterator_out, PHP_GIT2_V(_index, index)); - if (php_git2_check_error(error, "git_index_conflict_iterator_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_INDEX_CONFLICT_ITERATOR, iterator_out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_index_conflict_next(resource $iterator) - */ -PHP_FUNCTION(git_index_conflict_next) -{ - php_git2_t *_iterator = NULL; - git_index_entry *ancestor_out = NULL, *our_out = NULL, *their_out = NULL; - zval *iterator = NULL, *ancestor, *our, *their, *container; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iterator) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iterator, php_git2_t*, &iterator, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_index_conflict_next(&ancestor_out, &our_out, &their_out, PHP_GIT2_V(_iterator, index_conflict_iterator)); - if (php_git2_check_error(error, "git_index_conflict_next" TSRMLS_CC)) { - RETURN_FALSE; - } - - php_git2_index_entry_to_array(ancestor_out, &ancestor TSRMLS_CC); - php_git2_index_entry_to_array(our_out, &our TSRMLS_CC); - php_git2_index_entry_to_array(their_out, &their TSRMLS_CC); - MAKE_STD_ZVAL(container); - array_init(container); - add_next_index_zval(container, ancestor); - add_next_index_zval(container, our); - add_next_index_zval(container, their); - RETURN_ZVAL(container, 0, 1); - -} -/* }}} */ - -/* {{{ proto void git_index_conflict_iterator_free(resource $iterator) - */ -PHP_FUNCTION(git_index_conflict_iterator_free) -{ - zval *iterator = NULL; - php_git2_t *_iterator = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iterator) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iterator, php_git2_t*, &iterator, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_iterator)) { - git_index_conflict_iterator_free(PHP_GIT2_V(_iterator, index_conflict_iterator)); - GIT2_SHOULD_FREE(_iterator) = 0; - }; - zval_ptr_dtor(&iterator); -} -/* }}} */ diff --git a/index.h b/index.h deleted file mode 100644 index 80f1ea6000..0000000000 --- a/index.h +++ /dev/null @@ -1,305 +0,0 @@ -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_open, 0, 0, 1) - ZEND_ARG_INFO(0, index_path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_new, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_free, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_owner, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_caps, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_set_caps, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, caps) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_read, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_write, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_path, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_read_tree, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, tree) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_write_tree, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_write_tree_to, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_entrycount, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_clear, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_get_byindex, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_get_bypath, 0, 0, 3) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, stage) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_remove, 0, 0, 3) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, stage) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_remove_directory, 0, 0, 3) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, dir) - ZEND_ARG_INFO(0, stage) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_add, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, source_entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_entry_stage, 0, 0, 1) - ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_add_bypath, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_remove_bypath, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_add_all, 0, 0, 5) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, pathspec) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_remove_all, 0, 0, 4) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, pathspec) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_update_all, 0, 0, 4) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, pathspec) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_find, 0, 0, 3) - ZEND_ARG_INFO(0, at_pos) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_add, 0, 0, 4) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, ancestor_entry) - ZEND_ARG_INFO(0, our_entry) - ZEND_ARG_INFO(0, their_entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_get, 0, 0, 4) - ZEND_ARG_INFO(0, our_out) - ZEND_ARG_INFO(0, their_out) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_remove, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_cleanup, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_has_conflicts, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_iterator_new, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_next, 0, 0, 3) - ZEND_ARG_INFO(0, our_out) - ZEND_ARG_INFO(0, their_out) - ZEND_ARG_INFO(0, iterator) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_index_conflict_iterator_free, 0, 0, 1) - ZEND_ARG_INFO(0, iterator) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_index_open(index_path) -*/ -PHP_FUNCTION(git_index_open); - -/* {{{ proto resource git_index_new() -*/ -PHP_FUNCTION(git_index_new); - -/* {{{ proto void git_index_free(index) -*/ -PHP_FUNCTION(git_index_free); - -/* {{{ proto resource git_index_owner(index) -*/ -PHP_FUNCTION(git_index_owner); - -/* {{{ proto resource git_index_caps(index) -*/ -PHP_FUNCTION(git_index_caps); - -/* {{{ proto long git_index_set_caps(index, caps) -*/ -PHP_FUNCTION(git_index_set_caps); - -/* {{{ proto long git_index_read(index, force) -*/ -PHP_FUNCTION(git_index_read); - -/* {{{ proto resource git_index_write() -*/ -PHP_FUNCTION(git_index_write); - -/* {{{ proto resource git_index_path(index) -*/ -PHP_FUNCTION(git_index_path); - -/* {{{ proto long git_index_read_tree(index, tree) -*/ -PHP_FUNCTION(git_index_read_tree); - -/* {{{ proto resource git_index_write_tree(index) -*/ -PHP_FUNCTION(git_index_write_tree); - -/* {{{ proto resource git_index_write_tree_to(index, repo) -*/ -PHP_FUNCTION(git_index_write_tree_to); - -/* {{{ proto resource git_index_entrycount(index) -*/ -PHP_FUNCTION(git_index_entrycount); - -/* {{{ proto void git_index_clear(index) -*/ -PHP_FUNCTION(git_index_clear); - -/* {{{ proto resource git_index_get_byindex(index, n) -*/ -PHP_FUNCTION(git_index_get_byindex); - -/* {{{ proto resource git_index_get_bypath(index, path, stage) -*/ -PHP_FUNCTION(git_index_get_bypath); - -/* {{{ proto long git_index_remove(index, path, stage) -*/ -PHP_FUNCTION(git_index_remove); - -/* {{{ proto long git_index_remove_directory(index, dir, stage) -*/ -PHP_FUNCTION(git_index_remove_directory); - -/* {{{ proto long git_index_add(index, source_entry) -*/ -PHP_FUNCTION(git_index_add); - -/* {{{ proto long git_index_entry_stage(entry) -*/ -PHP_FUNCTION(git_index_entry_stage); - -/* {{{ proto long git_index_add_bypath(index, path) -*/ -PHP_FUNCTION(git_index_add_bypath); - -/* {{{ proto long git_index_remove_bypath(index, path) -*/ -PHP_FUNCTION(git_index_remove_bypath); - -/* {{{ proto long git_index_add_all(index, pathspec, flags, callback, payload) -*/ -PHP_FUNCTION(git_index_add_all); - -/* {{{ proto long git_index_remove_all(index, pathspec, callback, payload) -*/ -PHP_FUNCTION(git_index_remove_all); - -/* {{{ proto long git_index_update_all(index, pathspec, callback, payload) -*/ -PHP_FUNCTION(git_index_update_all); - -/* {{{ proto long git_index_find(at_pos, index, path) -*/ -PHP_FUNCTION(git_index_find); - -/* {{{ proto long git_index_conflict_add(index, ancestor_entry, our_entry, their_entry) -*/ -PHP_FUNCTION(git_index_conflict_add); - -/* {{{ proto resource git_index_conflict_get(our_out, their_out, index, path) -*/ -PHP_FUNCTION(git_index_conflict_get); - -/* {{{ proto long git_index_conflict_remove(index, path) -*/ -PHP_FUNCTION(git_index_conflict_remove); - -/* {{{ proto void git_index_conflict_cleanup(index) -*/ -PHP_FUNCTION(git_index_conflict_cleanup); - -/* {{{ proto long git_index_has_conflicts(index) -*/ -PHP_FUNCTION(git_index_has_conflicts); - -/* {{{ proto resource git_index_conflict_iterator_new(index) -*/ -PHP_FUNCTION(git_index_conflict_iterator_new); - -/* {{{ proto resource git_index_conflict_next(our_out, their_out, iterator) -*/ -PHP_FUNCTION(git_index_conflict_next); - -/* {{{ proto void git_index_conflict_iterator_free(iterator) -*/ -PHP_FUNCTION(git_index_conflict_iterator_free); - diff --git a/index.html b/index.html new file mode 100644 index 0000000000..3fc6c34763 --- /dev/null +++ b/index.html @@ -0,0 +1,293 @@ + + + + + + + + + + Welcome to php-git’s documentation! — php-git 0.2 documentation + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Next topic

+

Introduction

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Welcome to php-git’s documentation!

+

php-git is a set of PHP 5.3+ bindings to the libgit2 linkable C Git library. +Important Notice this module is EXPERIMENTAL.

+

Contents:

+
+ +
+
+
+

Indices and tables

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/indexer.c b/indexer.c deleted file mode 100644 index e5184eea97..0000000000 --- a/indexer.c +++ /dev/null @@ -1,112 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "indexer.h" - -/* {{{ proto resource git_indexer_new(string $path, long $mode, resource $odb, $progress_cb, $progress_cb_payload) - */ -PHP_FUNCTION(git_indexer_new) -{ - php_git2_t *result = NULL, *_odb = NULL; - git_indexer *out = NULL; - char *path = NULL; - int path_len = 0, error = 0; - long mode = 0; - zval *odb = NULL, *progress_cb_payload = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "slrfz", &path, &path_len, &mode, &odb, &fci, &fcc, &progress_cb_payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, progress_cb_payload TSRMLS_CC)) { - RETURN_FALSE; - } - //error = git_indexer_new(&out, path, mode, PHP_GIT2_V(_odb, odb), progress_cb, cb); - if (php_git2_check_error(error, "git_indexer_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_INDEXER, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_indexer_append(resource $idx, $data, long $size, $stats) - */ -PHP_FUNCTION(git_indexer_append) -{ - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "rl", &idx, &data, &size, &stats) == FAILURE) { -// return; -// } -// -// ZEND_FETCH_RESOURCE(_idx, php_git2_t*, &idx, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -// result = git_indexer_append(PHP_GIT2_V(_idx, indexer), data, size, stats); -// RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_indexer_commit(resource $idx, $stats) - */ -PHP_FUNCTION(git_indexer_commit) -{ - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "r", &idx, &stats) == FAILURE) { -// return; -// } -// -// ZEND_FETCH_RESOURCE(_idx, php_git2_t*, &idx, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -// result = git_indexer_commit(PHP_GIT2_V(_idx, indexer), stats); -// RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_indexer_hash(resource $idx) - */ -PHP_FUNCTION(git_indexer_hash) -{ - const git_oid *result = NULL; - zval *idx = NULL; - php_git2_t *_idx = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_idx, php_git2_t*, &idx, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_indexer_hash(PHP_GIT2_V(_idx, indexer)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto void git_indexer_free(resource $idx) - */ -PHP_FUNCTION(git_indexer_free) -{ - zval *idx = NULL; - php_git2_t *_idx = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_idx, php_git2_t*, &idx, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_idx)) { - git_indexer_free(PHP_GIT2_V(_idx, indexer)); - GIT2_SHOULD_FREE(_idx) = 0; - }; - zval_ptr_dtor(&idx); -} -/* }}} */ - diff --git a/indexer.h b/indexer.h deleted file mode 100644 index f159a870dc..0000000000 --- a/indexer.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_INDEXER_H -#define PHP_GIT2_INDEXER_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_indexer_new, 0, 0, 6) - ZEND_ARG_INFO(0, out) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, mode) - ZEND_ARG_INFO(0, odb) - ZEND_ARG_INFO(0, progress_cb) - ZEND_ARG_INFO(0, progress_cb_payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_indexer_append, 0, 0, 4) - ZEND_ARG_INFO(0, idx) - ZEND_ARG_INFO(0, data) - ZEND_ARG_INFO(0, size) - ZEND_ARG_INFO(0, stats) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_indexer_commit, 0, 0, 2) - ZEND_ARG_INFO(0, idx) - ZEND_ARG_INFO(0, stats) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_indexer_hash, 0, 0, 1) - ZEND_ARG_INFO(0, idx) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_indexer_free, 0, 0, 1) - ZEND_ARG_INFO(0, idx) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_indexer_new(string $path, long $mode, resource $odb, $progress_cb, $progress_cb_payload) - */ -PHP_FUNCTION(git_indexer_new); - -/* {{{ proto long git_indexer_append(resource $idx, $data, long $size, $stats) - */ -PHP_FUNCTION(git_indexer_append); - -/* {{{ proto long git_indexer_commit(resource $idx, $stats) - */ -PHP_FUNCTION(git_indexer_commit); - -/* {{{ proto resource git_indexer_hash(resource $idx) - */ -PHP_FUNCTION(git_indexer_hash); - -/* {{{ proto void git_indexer_free(resource $idx) - */ -PHP_FUNCTION(git_indexer_free); - -#endif diff --git a/ini.html b/ini.html new file mode 100644 index 0000000000..f9a54b015f --- /dev/null +++ b/ini.html @@ -0,0 +1,116 @@ + + + + + + + + + + Runtime Configuration — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Previous topic

+

Installation

+

Next topic

+

Resources

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Runtime Configuration

+

nothing.

+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/installation.html b/installation.html new file mode 100644 index 0000000000..55a17f2500 --- /dev/null +++ b/installation.html @@ -0,0 +1,137 @@ + + + + + + + + + + Installation — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Previous topic

+

Requirements

+

Next topic

+

Runtime Configuration

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Installation

+
cd /tmp
+git clone https://github.com/libgit2/libgit2 libgit2
+git clone https://github.com/libgit2/php-git php-git
+cd libgit2
+git checkout `cat ../php-git/LIBGIT2_VERSION`
+./waf configure
+./waf build-shared
+sudo ./waf install-shared
+
+cd ../php-git/src
+phpize
+./configure && make
+sudo make install
+# add your php.ini
+# extension=git.so
+
+
+
+

Note

+

php-git still under development status. +should not use production environment.

+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/intro.html b/intro.html new file mode 100644 index 0000000000..a43f59a3eb --- /dev/null +++ b/intro.html @@ -0,0 +1,114 @@ + + + + + + + + + + Introduction — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Welcome to php-git’s documentation!

+

Next topic

+

Installing/Configuring

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Introduction

+

Git module provides handy procedural and object oriented interface to libgit2.

+

More information about libgit2 can be found at https://github.com/libgit2/libgit2

+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/libgit2 b/libgit2 deleted file mode 160000 index 43cb8b3242..0000000000 --- a/libgit2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 43cb8b32428b1b29994874349ec22eb5372e152c diff --git a/merge.c b/merge.c deleted file mode 100644 index 37c88e9f00..0000000000 --- a/merge.c +++ /dev/null @@ -1,321 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "merge.h" - -/* {{{ proto resource git_merge_base(resource $repo, string $one, string $two) - */ -PHP_FUNCTION(git_merge_base) -{ - php_git2_t *_repo = NULL; - git_oid out = {0}, __one = {0}, __two = {0}; - zval *repo = NULL; - char *one = NULL, *two = NULL, oid[41] = {0}; - int one_len = 0, two_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &repo, &one, &one_len, &two, &two_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__one, one, one_len)) { - RETURN_FALSE; - } - if (git_oid_fromstrn(&__two, two, two_len)) { - RETURN_FALSE; - } - error = git_merge_base(&out, PHP_GIT2_V(_repo, repository), &__one, &__two); - if (php_git2_check_error(error, "git_merge_base" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(oid, &out); - RETURN_STRING(oid, 1); -} -/* }}} */ - -/* {{{ proto resource git_merge_base_many(resource $repo, long $length, string $input_array[]) - */ -PHP_FUNCTION(git_merge_base_many) -{ -// php_git2_t *result = NULL, *_repo = NULL; -// git_oid out = {0}, __input_array[] = {0}; -// zval *repo = NULL; -// long length = 0; -// char *input_array[] = NULL; -// int input_array[]_len = 0, error = 0; - -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, -// "rls", &repo, &length, &input_array[], &input_array[]_len) == FAILURE) { -// return; -// } - -// ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); -// if (git_oid_fromstrn(&__input_array[], input_array[], input_array[]_len)) { -// RETURN_FALSE; -// } -// error = git_merge_base_many(&__out, PHP_GIT2_V(_repo, repository), length, __input_array[]); -// if (php_git2_check_error(error, "git_merge_base_many" TSRMLS_CC)) { -// RETURN_FALSE; -// } -// if (php_git2_make_resource(&result, PHP_GIT2_TYPE_OID, out, 1 TSRMLS_CC)) { -// RETURN_FALSE; -// } -// ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_merge_head_from_ref(resource $repo, resource $ref) - */ -PHP_FUNCTION(git_merge_head_from_ref) -{ - php_git2_t *result = NULL, *_repo = NULL, *_ref = NULL; - git_merge_head *out = NULL; - zval *repo = NULL, *ref = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &repo, &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_merge_head_from_ref(&out, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_ref, reference)); - if (php_git2_check_error(error, "git_merge_head_from_ref" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_MERGE_HEAD, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_merge_head_from_fetchhead(resource $repo, string $branch_name, string $remote_url, string $oid) - */ -PHP_FUNCTION(git_merge_head_from_fetchhead) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_merge_head *out = NULL; - zval *repo = NULL; - char *branch_name = NULL, *remote_url = NULL, *oid = NULL; - int branch_name_len = 0, remote_url_len = 0, oid_len = 0, error = 0; - git_oid __oid = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsss", &repo, &branch_name, &branch_name_len, &remote_url, &remote_url_len, &oid, &oid_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__oid, oid, oid_len)) { - RETURN_FALSE; - } - error = git_merge_head_from_fetchhead(&out, PHP_GIT2_V(_repo, repository), branch_name, remote_url, &__oid); - if (php_git2_check_error(error, "git_merge_head_from_fetchhead" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_MERGE_HEAD, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_merge_head_from_oid(resource $repo, string $oid) - */ -PHP_FUNCTION(git_merge_head_from_oid) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_merge_head *out = NULL; - zval *repo = NULL; - char *oid = NULL; - int oid_len = 0, error = 0; - git_oid __oid = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &oid, &oid_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__oid, oid, oid_len)) { - RETURN_FALSE; - } - error = git_merge_head_from_oid(&out, PHP_GIT2_V(_repo, repository), &__oid); - if (php_git2_check_error(error, "git_merge_head_from_oid" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_MERGE_HEAD, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_merge_head_free(resource $head) - */ -PHP_FUNCTION(git_merge_head_free) -{ - zval *head = NULL; - php_git2_t *_head = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &head) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_head, php_git2_t*, &head, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_head)) { - git_merge_head_free(PHP_GIT2_V(_head, merge_head)); - GIT2_SHOULD_FREE(_head) = 0; - }; - zval_ptr_dtor(&head); -} -/* }}} */ - -/* {{{ proto resource git_merge_trees(resource $repo, resource $ancestor_tree, resource $our_tree, resource $their_tree, $opts) - */ -PHP_FUNCTION(git_merge_trees) -{ - php_git2_t *result = NULL, *_repo = NULL, *_ancestor_tree = NULL, *_our_tree = NULL, *_their_tree = NULL; - git_index *out = NULL; - zval *repo = NULL, *ancestor_tree = NULL, *our_tree = NULL, *their_tree = NULL, *opts = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrrr", &repo, &ancestor_tree, &our_tree, &their_tree, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_ancestor_tree, php_git2_t*, &ancestor_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_our_tree, php_git2_t*, &our_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_their_tree, php_git2_t*, &their_tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_merge_trees(&out, PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_ancestor_tree, tree), PHP_GIT2_V(_our_tree, tree), PHP_GIT2_V(_their_tree, tree), opts); - if (php_git2_check_error(error, "git_merge_trees" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_INDEX, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_merge(resource $repo, array $their_heads, array $opts) - */ -PHP_FUNCTION(git_merge) -{ - php_git2_t *result = NULL, *_repo = NULL, *_their_head = NULL; - git_merge_result *out = NULL; - zval *repo = NULL, *opts = NULL, *theirhead = NULL; - git_merge_head *heads[1]; - int error = 0; - git_merge_opts options = GIT_MERGE_OPTS_INIT; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rza", &repo, &theirhead, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_their_head, php_git2_t*, &theirhead, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - heads[0] = PHP_GIT2_V(_their_head, merge_head); - options.merge_flags = GIT_MERGE_NO_FASTFORWARD; - - error = git_merge(&out, PHP_GIT2_V(_repo, repository), heads, 1, &options); - if (php_git2_check_error(error, "git_merge" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_MERGE_RESULT, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_merge_result_is_uptodate(resource $merge_result) - */ -PHP_FUNCTION(git_merge_result_is_uptodate) -{ - int result = 0; - zval *merge_result = NULL; - php_git2_t *_merge_result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &merge_result) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_merge_result, php_git2_t*, &merge_result, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_merge_result_is_uptodate(PHP_GIT2_V(_merge_result, merge_result)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto long git_merge_result_is_fastforward(resource $merge_result) - */ -PHP_FUNCTION(git_merge_result_is_fastforward) -{ - int result = 0; - zval *merge_result = NULL; - php_git2_t *_merge_result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &merge_result) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_merge_result, php_git2_t*, &merge_result, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_merge_result_is_fastforward(PHP_GIT2_V(_merge_result, merge_result)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto resource git_merge_result_fastforward_oid(resource $merge_result) - */ -PHP_FUNCTION(git_merge_result_fastforward_oid) -{ - php_git2_t *_merge_result = NULL; - git_oid out = {0}; - zval *merge_result = NULL; - int error = 0; - char buf[41] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &merge_result) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_merge_result, php_git2_t*, &merge_result, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_merge_result_fastforward_oid(&out, PHP_GIT2_V(_merge_result, merge_result)); - if (php_git2_check_error(error, "git_merge_result_fastforward_oid" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto void git_merge_result_free(resource $merge_result) - */ -PHP_FUNCTION(git_merge_result_free) -{ - zval *merge_result = NULL; - php_git2_t *_merge_result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &merge_result) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_merge_result, php_git2_t*, &merge_result, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_merge_result)) { - git_merge_result_free(PHP_GIT2_V(_merge_result, merge_result)); - GIT2_SHOULD_FREE(_merge_result) = 0; - }; - zval_ptr_dtor(&merge_result); -} -/* }}} */ - diff --git a/merge.h b/merge.h deleted file mode 100644 index 0367b95ae7..0000000000 --- a/merge.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_MERGE_H -#define PHP_GIT2_MERGE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_base, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, one) - ZEND_ARG_INFO(0, two) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_base_many, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, input_array[]) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_head_from_ref, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_head_from_fetchhead, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, branch_name) - ZEND_ARG_INFO(0, remote_url) - ZEND_ARG_INFO(0, oid) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_head_from_oid, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, oid) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_head_free, 0, 0, 1) - ZEND_ARG_INFO(0, head) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_trees, 0, 0, 5) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, ancestor_tree) - ZEND_ARG_INFO(0, our_tree) - ZEND_ARG_INFO(0, their_tree) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, their_heads) - ZEND_ARG_INFO(0, their_heads_len) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_result_is_uptodate, 0, 0, 1) - ZEND_ARG_INFO(0, merge_result) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_result_is_fastforward, 0, 0, 1) - ZEND_ARG_INFO(0, merge_result) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_result_fastforward_oid, 0, 0, 1) - ZEND_ARG_INFO(0, merge_result) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_merge_result_free, 0, 0, 1) - ZEND_ARG_INFO(0, merge_result) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_merge_base(repo, one, two) -*/ -PHP_FUNCTION(git_merge_base); - -/* {{{ proto resource git_merge_base_many(repo, length, input_array[]) -*/ -PHP_FUNCTION(git_merge_base_many); - -/* {{{ proto resource git_merge_head_from_ref(repo, ref) -*/ -PHP_FUNCTION(git_merge_head_from_ref); - -/* {{{ proto resource git_merge_head_from_fetchhead(repo, branch_name, remote_url, oid) -*/ -PHP_FUNCTION(git_merge_head_from_fetchhead); - -/* {{{ proto resource git_merge_head_from_oid(repo, oid) -*/ -PHP_FUNCTION(git_merge_head_from_oid); - -/* {{{ proto void git_merge_head_free(head) -*/ -PHP_FUNCTION(git_merge_head_free); - -/* {{{ proto resource git_merge_trees(repo, ancestor_tree, our_tree, their_tree, opts) -*/ -PHP_FUNCTION(git_merge_trees); - -/* {{{ proto resource git_merge(repo, their_heads, their_heads_len, opts) -*/ -PHP_FUNCTION(git_merge); - -/* {{{ proto long git_merge_result_is_uptodate(merge_result) -*/ -PHP_FUNCTION(git_merge_result_is_uptodate); - -/* {{{ proto long git_merge_result_is_fastforward(merge_result) -*/ -PHP_FUNCTION(git_merge_result_is_fastforward); - -/* {{{ proto resource git_merge_result_fastforward_oid(merge_result) -*/ -PHP_FUNCTION(git_merge_result_fastforward_oid); - -/* {{{ proto void git_merge_result_free(merge_result) -*/ -PHP_FUNCTION(git_merge_result_free); - -#endif \ No newline at end of file diff --git a/message.c b/message.c deleted file mode 100644 index f23b00cbb4..0000000000 --- a/message.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "message.h" - -/* {{{ proto resource git_message_prettify(string $message, long $strip_comments) - */ -PHP_FUNCTION(git_message_prettify) -{ - char *out = NULL, *message = NULL; - long out_size = 0, strip_comments = 0; - int message_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sl", &message, &message_len, &strip_comments) == FAILURE) { - return; - } - - out_size = git_message_prettify(NULL, NULL, message, strip_comments); - out = (char*)emalloc(sizeof(char) * out_size); - error = git_message_prettify(out, out_size, message, strip_comments); - RETURN_STRING(out, 0); -} -/* }}} */ - diff --git a/message.h b/message.h deleted file mode 100644 index 0b40007b40..0000000000 --- a/message.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_MESSAGE_H -#define PHP_GIT2_MESSAGE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_message_prettify, 0, 0, 3) - ZEND_ARG_INFO(0, out_size) - ZEND_ARG_INFO(0, message) - ZEND_ARG_INFO(0, strip_comments) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_message_prettify(out_size, message, strip_comments) -*/ -PHP_FUNCTION(git_message_prettify); - -#endif \ No newline at end of file diff --git a/ng.php b/ng.php deleted file mode 100644 index 3631c78e96..0000000000 --- a/ng.php +++ /dev/null @@ -1,1261 +0,0 @@ -name = $name; - $this->return_type = preg_replace("/\*/", "", $return_type); - - for ($i = 0; $i < count($return_type); $i++) { - if ($return_type[$i] == '*') { - $this->ptr++; - } - } - } - - public function getReturnType() - { - return $this->return_type; - } - - public function isResourceCreator() - { - if (count($this->args)) { - $first = $this->args[0]; - if (preg_match("/out/", $first->getName())) { - return true; - } - } else { - if (preg_match("/git_/", $this->getReturnType())) { - return true; - } - } - - return false; - } - - public function isStringCreator() - { - if (preg_match("/(char)/", $this->getReturnType())) { - return true; - } - } - - public function isLongCreator() - { - if (preg_match("/(size_t|int)/", $this->getReturnType())) { - return true; - } - } - - public function isArrayCreator() - { - if (preg_match("/git_/", $this->getReturnType())) { - return true; - } - } - - public function isVoidCreator() - { - if (preg_match("/void/", $this->getReturnType())) { - return true; - } - } - - public function isSavior() - { - if (preg_match('/_free$/', $this->getName())) { - return true; - } - } - - public function isCallbacker() - { - foreach($this->args as $arg) { - if (preg_match("/_cb$/", $arg->getType())) { - return true; - } - if (preg_match("/callback$/", $arg->getType())) { - return true; - } - if (preg_match("/packbuilder_progress/", $arg->getType())) { - return true; - } - } - - return false; - } - - public function getArguments() - { - return $this->args; - } - - public function addArgument(Arg $arg) - { - $this->args[] = $arg; - } - - public function getName() - { - return $this->name; - } - - public function first() - { - return $this->args[0]; - } -} - -class Arg -{ - protected $type; - protected $ptr = 0; - protected $name; - protected $const; - - public function getDefaultValue() - { - if (preg_match("/long/", $this->getZendType())) { - return "0"; - } else { - return "NULL"; - } - } - - public function getName() - { - return $this->name; - } - - public function setName($name) - { - return $this->name = $name; - } - - - public function getType() - { - return $this->type; - } - - public function isCallback() - { - if (preg_match("/_cb$/", $this->getType())) { - return true; - } - if (preg_match("/callback$/", $this->getType())) { - return true; - } - if (preg_match("/packbuilder_progress/", $this->getType())) { - return true; - } - if (preg_match("/git_push_transfer_progress/", $this->getType())) { - return true; - } - return false; - } - - public function getPtr() - { - return str_repeat("*", $this->ptr - 1); - } - - public function shouldWrite() - { - if ($this->ptr == 2) { - if (preg_match("/^git_/", $this->type)) { - return true; - } - } - - return false; - - } - - public function getZendType() - { - if (preg_match("/char/", $this->type)) { - return "char"; - } else if (preg_match("/(size_t|int)/", $this->type)) { - return "long"; - } else if (preg_match("/git_oid/", $this->type)) { - return "char"; - } else if (preg_match("/git_otype/", $this->type)) { - return "long"; - } else if (preg_match("/^git_/", $this->type)) { - return "zval"; - } else if (preg_match("/payload/", $this->name)) { - return "zval"; - } else { - error_log(sprintf("%s (zendtype)", $this->type)); - } - } - - public function __construct($type, $name) - { - $this->type = $type; - $this->name = $name; - - for ($i = 0; $i < strlen($name); $i++) { - if ($name[$i] == '*') { - $this->ptr++; - } - } - $this->name = preg_replace("/\*/", "", $this->name); - if (preg_match("/^const/", $this->type)) { - $this->const = 1; - $this->type = preg_replace("/^const\s+/", "", $this->type); - } - } -} - -class StringStream -{ - protected $buffer = ""; - - public function __construct($string = "") - { - $this->buffer = $string; - } - - public function append($string) - { - $this->buffer .= $string; - } - - public function assign($message) - { - $this->buffer = $message; - } - - public function __toString() - { - return $this->buffer; - } -} - -class ZeroCopyOutputStream -{ - protected $stream; - - public function __construct($stream) - { - $this->stream = $stream; - } - - public function write($message) - { - $this->stream->append($message); - } -} - -class Printer -{ - protected $replace; - protected $level = 0; - protected $indent_char = "\t"; - protected $stream; - - protected $next; - - public function __construct($stream, $replace) - { - $this->stream = $stream; - $this->replace = $replace; - } - - public function block(Callable $call) - { - $this->indent(); - $call($this); - $this->outdent(); - } - - public function indent() - { - $this->level++; - } - - public function outdent() - { - $this->level--; - if ($this->level < 0) { - throw new RuntimeException("too low indent level."); - } - } - - public function put($message/* $args */) - { - $args = func_get_args(); - array_shift($args); - - $key = ""; - $value = ""; - $tmp = array(); - if (count($args)) { - if (count($args) % 2 != 0) { - throw new InvalidArgumentException("parameter doesn't match"); - } - - for ($i = 0; $i < count($args); $i++) { - if ($i % 2 == 0) { - $key = $args[$i]; - } else { - $value = $args[$i]; - - $tmp[$key] = $value; - unset($key); - unset($value); - } - } - foreach ($tmp as $key => $value) { - $message = str_replace(sprintf("%s%s%s", $this->replace, $key, $this->replace), $value, $message); - } - } - - if ($this->next) { - $this->stream->write(str_repeat($this->indent_char, $this->level)); - } - - if (preg_match('/\n$/m', $message)) { - $this->next = true; - } else { - $this->next = false; - } - $this->stream->write($message); - } -} -class Fashion -{ - protected $name; - protected $flag; - - public function __construct($name, $flag = false) - { - $this->name = basename($name, ".h"); - $this->flag = $flag; - } - - public function shouldResource(Arg $arg) - { - static $types; - if (!$types) { - $types = array( - "git_repository", - "git_commit", - "git_tree", - "git_tree_entry", // really? - "git_blob", - "git_revwalk", - "git_treebuilder", - "git_reference", - "git_config", - "git_object", - "git_index", - "git_odb", - "git_refdb", - "git_status_list", - "git_branch_iterator", - "git_tag", - "git_cred", - "git_transport", - "git_remote", - "git_merge_head", - "git_merge_result", - "git_pathspec", - "git_pathspec_match_list", - "git_diff", - "git_patch", - "git_diff_hunk", - "git_filter_list", - "git_buf", - "git_filter_source", - "git_diff_line", - "git_reference_iterator", - "git_config_iterator", - "git_index_conflict_iterator", - "git_transport*", - "git_transport", - "git_note", - "git_note_iterator", - "git_odb", - "git_odb_object", - "git_odb_backend", - "git_odb_stream", - "struct git_odb", - "git_reflog", - "git_reflog_entry", - "git_blame", - "git_packbuilder", - "git_submodule", - "git_push", - "git_refspec", - "git_filter", - "git_indexer", - ); - } - - if (in_array($arg->getType(), $types)) { - return true; - } else { - return false; - } - } - - public function getReturnType(Func $f) - { - if ($f->isResourceCreator()) { - return "resource"; - } else { - if (preg_match("/(int|size_t)/", $f->getReturnType())) { - return "long"; - } else if (preg_match("/git_signature/", $f->getReturnType())) { - return "array"; - } else if (preg_match("/git/", $f->getReturnType())) { - return "resource"; - } else if (preg_match("/void/", $f->getReturnType())) { - return "void"; - } else if (preg_match("/char/", $f->getReturnType())) { - return "string"; - } else { - error_log(sprintf("%s does not support yet", $f->getReturnType())); - } - } - } - - public function generateProto(Printer $printer, Func $f) - { - $printer->put("/* {{{ proto `return_type` `function`", - "return_type", $this->getReturnType($f), - "function", $f->getName() - ); - $printer->put("("); - $cnt = count($f->getArguments()); - $i = 0; - - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($i == 0 && $f->isResourceCreator()) { - $i++; - continue; - } - if ($arg->shouldWrite()) { - $i++; - continue; - } - - if ($this->shouldResource($arg)) { - $printer->put("resource"); - } else { - if (preg_match("/char/", $arg->getType())) { - $printer->put("string"); - } else if (preg_match("/(int|size_t)/", $arg->getType())) { - $printer->put("long"); - } else if (preg_match("/(git_oid)/", $arg->getType())) { - $printer->put("string"); - } else if (preg_match("/(git_signature)/", $arg->getType())) { - $printer->put("array"); - } else if (preg_match("/(git_strarray)/", $arg->getType())) { - $printer->put("array"); - } else if (preg_match("/_cb$/", $arg->getType())) { - $printer->put("Callable"); - } else if (preg_match("/git_otype/", $arg->getType())) { - $printer->put("long"); - } else { - error_log(sprintf("# unknown type (%s)", $arg->getType())); - } - } - $printer->put(" "); - - // variable name - $printer->put("\$`arg`", "arg", $arg->getName()); - if ($i +1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(")\n"); - $printer->put(" */\n"); - } - - public function isPtr(Arg $arg) - { - if (preg_match("/zval/", $arg->getZendType())) { - return "*"; - } else { - if (preg_match("/char/", $arg->getZendType())) { - return "*"; - } else { - return ""; - } - } - } - - public function generateDeclarations(Printer $printer, Func $f) - { - $tables = array(); - if ($f->isResourceCreator()) { - $tables["php_git2_t"][] = array( - "name" => "*result", - "value" => "NULL", - ); - } else if ($f->isArrayCreator()) { - $tables[$f->getReturnType()][] = array( - "name" => "*result", - "value" => "NULL", - ); - if (preg_match("/git_signature/", $f->getReturnType())) { - $tables["zval"][] = array( - "name" => "*__result", - "value" => "NULL", - ); - } - } else if ($f->isLongCreator()) { - $tables[$f->getReturnType()][] = array( - "name" => "result", - "value" => "0", - ); - } else if ($f->isStringCreator()) { - $tables[$f->getReturnType()][] = array( - "name" => "*result", - "value" => "NULL", - ); - } - - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($i == 0 && $f->isResourceCreator()) { - $tables[$arg->getType()][] = array( - "name" => sprintf("%s%s", $arg->getPtr(), $arg->getName()), - "value" => "NULL", - ); - $i++; - continue; - } - if ($arg->shouldWrite()) { - $tables[$arg->getType()][] = array( - "name" => sprintf("%s%s", $arg->getPtr(), $arg->getName()), - "value" => "NULL", - ); - } else { - /** @var Arg $arg */ - $tables[$arg->getZendType()][] = array( - "name" => sprintf("%s%s", $this->isPtr($arg), $arg->getName()), - "value" => $arg->getDefaultValue(), - ); - if ($this->shouldResource($arg)) { - $tables["php_git2_t"][] = array( - "name" => sprintf("*_%s", $arg->getName()), - "value" => "NULL", - ); - } - if ($arg->getType() == "git_strarray") { - $tables["git_strarray"][] = array( - "name" => sprintf("_%s", $arg->getName()), - "value" => "{0}", - ); - } - - if (preg_match("/char/", $arg->getZendType())) { - $tables["int"][] = array( - "name" => sprintf("%s_len", $arg->getName()), - "value" => "0", - ); - } - } - - if ($arg->getType() == "git_oid") { - $tables["git_oid"][] = array( - "name" => sprintf("__%s", $arg->getName()), - "value" => "{0}", - ); - } - - $i++; - } - if ($f->getReturnType() == "int") { - $tables[$f->getReturnType()][] = array( - "name" => "error", - "value" => "0", - ); - } - if (preg_match("/git_oid/", $f->getReturnType())) { - $tables["char"][] = array( - "name" => "__result[GIT2_OID_HEXSIZE]", - "value" => "{0}", - ); - } - if (preg_match("/_owner$/", $f->getName())) { - $tables["php_git2_t"][] = array( - "name" => "*__result", - "value" => "NULL", - ); - } - if ($f->isCallbacker()) { - $tables["zend_fcall_info"][] = array( - "name" => "fci", - "value" => "empty_fcall_info", - ); - $tables["zend_fcall_info_cache"][] = array( - "name" => "fcc", - "value" => "empty_fcall_info_cache", - ); - $tables["php_git2_cb_t"][] = array( - "name" => "*cb", - "value" => "NULL", - ); - } - - - foreach ($tables as $type => $values) { - $printer->put("`type` ", "type", $type); - $i = 0; - $cnt = count($values); - foreach ($values as $val) { - $printer->put("`name` = `value`", "name", $val['name'], "value", $val["value"]); - if ($i+1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(";\n"); - } - } - - public function generateParse(Printer $printer, Func $f) - { - $printer->put("if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,\n"); - $printer->block(function(Printer $printer) use ($f) { - $i = 0; - $cnt = count($f->getArguments()); - $printer->put('"'); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($i == 0 && $f->isResourceCreator()) { - $i++; - continue; - } - if ($arg->shouldWrite()) { - $i++; - continue; - } - - if (preg_match("/char/", $arg->getZendType())) { - $printer->put("s"); - } else if (preg_match("/long/", $arg->getZendType())) { - $printer->put("l"); - } else if (preg_match("/git_signature/", $arg->getType())) { - $printer->put("a"); - } else if (preg_match("/git_strarray/", $arg->getType())) { - $printer->put("a"); - } else if ($this->shouldResource($arg)) { - $printer->put("r"); - } else if ($arg->isCallback()) { - $printer->put("f"); - } else if ($f->isCallbacker() && preg_match("/payload/", $arg->getName())) { - $printer->put("z"); - } else { - $printer->put("<{$arg->getType()}>"); - } - } - $printer->put('", '); - - $i = 0; - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($i == 0 && $f->isResourceCreator()) { - $i++; - continue; - } - if ($arg->shouldWrite()) { - $i++; - continue; - } - - if ($arg->isCallback()) { - $printer->put("&fci, "); - $printer->put("&fcc"); - } else { - $printer->put("&`name`", "name", $arg->getName()); - } - if (preg_match("/char/", $arg->getZendType())) { - $printer->put(", "); - $printer->put("&`name`_len", "name", $arg->getName()); - } - if ($i+1 < $cnt) { - $printer->put(", "); - } - $i++; - } - - $printer->put(") == FAILURE) {\n"); - $printer->put("return;\n"); - }); - $printer->put("}\n"); - } - - public function generateFetchResourceIfNeeded(Printer $printer, Func $f) - { - $i = 0; - foreach ($f->getArguments() as $arg) { - if ($f->isResourceCreator() && $i == 0) { - $i++; - continue; - } - - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("ZEND_FETCH_RESOURCE(_`container`, php_git2_t*, &`value`, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);\n", - "container", $arg->getName(), - "value", $arg->getName() - ); - } - $i++; - } - } - - public function generateOidTranslation(Printer $printer, Func $f) - { - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($arg->getType() == "git_oid") { - $printer->put("if (git_oid_fromstrn(&__`name`, `name`, `name`_len)) {\n", - "name", $arg->getName() - ); - $printer->block(function(Printer $printer) use($arg) { - $printer->put("RETURN_FALSE;\n"); - }); - $printer->put("}\n"); - $arg->setName("__" . $arg->getName()); - } - } - } - - public function generateCallbackInit(Printer $printer, Func $f) - { - if ($f->isCallbacker()) { - $printer->put("if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) {\n"); - $printer->block(function(Printer $printer) { - $printer->put("RETURN_FALSE;\n"); - }); - $printer->put("}\n"); - } - } - - public function generateCallbackFree(Printer $printer, Func $f) - { - if ($f->isCallbacker()) { - $printer->put("php_git2_cb_free(cb);\n"); - } - } - - public function generateFunctionCall(Printer $printer, Func $f) - { - $this->generateOidTranslation($printer, $f); - $this->generateCallbackInit($printer, $f); - if ($f->getReturnType() == "int" && $f->isResourceCreator()) { - $printer->put("error = `function`", - "function", $f->getName() - ); - $printer->put("("); - - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($i == 0 && $f->isResourceCreator()) { - $printer->put("&"); - } - - if ($i != 0) { - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - - $printer->put(");"); - $printer->put("\n"); - } else if ($f->isResourceCreator()) { - $printer->put("`retval` = `function`", - "retval", "result", - "function", $f->getName() - ); - $printer->put("("); - - - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($i == 0 && $f->isResourceCreator()) { - $printer->put("&"); - } - - if ($i != 0) { - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(");\n"); - } else if ($f->isArrayCreator()) { - $printer->put("result = `function`", - "function", $f->getName() - ); - $printer->put("("); - - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - - $printer->put(");\n"); - if (preg_match("/git_oid/", $f->getReturnType())) { - $printer->put("git_oid_fmt(__result, `name`);\n", "name", "result"); - $printer->put("RETURN_STRING(__result, 1);\n"); - } else if (preg_match("/_owner$/", $f->getName())) { - $this->generateMakeResourceIfNeeded($printer, $f, "__result", 1); - } else if (preg_match("/_type/", $f->getName())) { - $printer->put("RETURN_LONG(`name`);\n", "name", "result"); - } else if (preg_match("/git_signature/", $f->getReturnType())) { - $printer->put("php_git2_signature_to_array(result, &__result TSRMLS_CC);\n"); - $printer->put("RETURN_ZVAL(__result, 0, 1);\n"); - } else { - $printer->put("/* TODO(chobie): implement this */\n"); - } - } else if ($f->isLongCreator()) { - $printer->put("result = `function`", - "function", $f->getName() - ); - $printer->put("("); - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else if ($arg->isCallback()) { - $printer->put(""); - } else if (preg_match("/payload/", $arg->getName())) { - $printer->put("cb"); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(");\n"); - - $this->generateCallbackFree($printer, $f); - if (preg_match("/_is_/", $f->getName())) { - $printer->put("RETURN_BOOL(`name`);\n", "name", "result"); - } else { - $printer->put("RETURN_LONG(`name`);\n", "name", "result"); - } - } else if ($f->isSavior()) { - - $first = $f->first(); - $printer->put("if (GIT2_SHOULD_FREE(_`name`)) {\n", - "name", $first->getName() - ); - $printer->block(function(Printer $printer) use ($f, $first) { - $printer->put("`function`", - "function", $f->getName() - ); - $printer->put("("); - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(");\n"); - $printer->put("GIT2_SHOULD_FREE(_`name`) = 0;\n", "name", $first->getName()); - }); - $printer->put("};\n"); - - $printer->put("zval_ptr_dtor(&`name`);\n", "name", $first->getName()); - } else if ($f->isStringCreator()) { - $printer->put("result = `function`", - "function", $f->getName() - ); - $printer->put("("); - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(");\n"); - $printer->put("RETURN_STRING(`name`, 1);\n", "name", "result"); - } else if ($f->isVoidCreator()) { - $printer->put("`function`", - "function", $f->getName() - ); - $printer->put("("); - $i = 0; - $cnt = count($f->getArguments()); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - - if ($this->shouldResource($arg) && !$arg->shouldWrite()) { - $printer->put("PHP_GIT2_V(_`name`, `type`)", - "name", $arg->getName(), - "type", $this->getNormarizedTypeName($arg) - ); - } else if ($arg->shouldWrite()) { - $printer->put("&`name`", "name", $arg->getName()); - } else { - $printer->put("`name`", "name", $arg->getName()); - } - - if ($i + 1 < $cnt) { - $printer->put(", "); - } - $i++; - } - $printer->put(");\n"); - } else { - error_log(sprintf("# %s not supported (call function)", $f->getName())); - } - } - - public function generateCheckStatementIfNeeded(Printer $printer, Func $f) - { - if ($f->getReturnType() == "int" && $f->isResourceCreator()) { - $printer->put('if (php_git2_check_error(error, "`func`" TSRMLS_CC)) {', - "func", $f->getName() - ); - $printer->put("\n"); - $printer->block(function (Printer $printer) use ($f) { - $printer->put("RETURN_FALSE;\n"); - }); - $printer->put("}\n"); - } - } - - public function getNormarizedTypeName(Arg $arg) - { - $name = $arg->getType(); - return preg_replace("/^git_/", "", $name); - } - - public function generateMakeResourceIfNeeded(Printer $printer, Func $f, $name = "result", $force = 0) - { - if ($f->isResourceCreator() || $force) { - $arg = $f->first(); - $printer->put("if (php_git2_make_resource(&`name`, PHP_GIT2_TYPE_`type`, `target`, 1 TSRMLS_CC)) {\n", - "name", $name, - "type", strtoupper($this->getNormarizedTypeName($arg)), - "target", "out" - ); - $printer->block(function(Printer $printer) { - $printer->put("RETURN_FALSE;\n"); - }); - $printer->put("}\n"); - $printer->put("ZVAL_RESOURCE(return_value, GIT2_RVAL_P(`name`));\n", "name", $name); - } - } - - public function generateStrarrayConversion(Printer $printer, Func $f) - { - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - if ($arg->getType() == "git_strarray") { - $printer->put("php_git2_array_to_strarray(&_`name`, `name` TSRMLS_CC);\n", - "name", $arg->getName()); - } - } - } - - public function generateIncludes(Printer $printer, Func $f) - { - if ($this->flag) { - $printer->put("#include \"php_git2.h\"\n"); - $printer->put("#include \"php_git2_priv.h\"\n"); - $printer->put("#include \"`name`.h\"\n", "name", $this->name); - } - } - - public function out(Func $f) - { - $stream = new StringStream(); - $out = new ZeroCopyOutputStream($stream); - $printer = new Printer($out, "`"); - - $this->generateIncludes($printer, $f); - $this->generateProto($printer, $f); - $printer->put("PHP_FUNCTION(`function`)\n", - "function", $f->getName()); - $printer->put("{\n"); - $printer->block(function(Printer $printer) use ($f) { - $this->generateDeclarations($printer, $f); - $printer->put("\n"); - $this->generateParse($printer, $f); - $printer->put("\n"); - - $this->generateFetchResourceIfNeeded($printer, $f); - $this->generateStrarrayConversion($printer, $f); - $this->generateFunctionCall($printer, $f); - $this->generateCheckStatementIfNeeded($printer, $f); - $this->generateMakeResourceIfNeeded($printer, $f); - }); - $printer->put("}\n"); - $printer->put("/* }}} */\n"); - $printer->put("\n"); - - - return $stream->__toString(); - } -} - -class Header extends Fashion -{ - public function generateLicense(Printer $printer, Func $f) - { - if (!$this->flag) { - return; - } - $printer->put("/*\n"); - $printer->put(" * PHP Libgit2 Extension\n"); - $printer->put(" *\n"); - $printer->put(" * https://github.com/libgit2/php-git\n"); - $printer->put(" *\n"); - $printer->put(" * Copyright 2014 Shuhei Tanuma. All rights reserved.\n"); - $printer->put(" *\n"); - $printer->put(" * Permission is hereby granted, free of charge, to any person obtaining a copy\n"); - $printer->put(" * of this software and associated documentation files (the \"Software\"), to deal\n"); - $printer->put(" * in the Software without restriction, including without limitation the rights\n"); - $printer->put(" * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n"); - $printer->put(" * copies of the Software, and to permit persons to whom the Software is\n"); - $printer->put(" * furnished to do so, subject to the following conditions:\n"); - $printer->put(" *\n"); - $printer->put(" * The above copyright notice and this permission notice shall be included in\n"); - $printer->put(" * all copies or substantial portions of the Software.\n"); - $printer->put(" *\n"); - $printer->put(" * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n"); - $printer->put(" * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n"); - $printer->put(" * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n"); - $printer->put(" * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n"); - $printer->put(" * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n"); - $printer->put(" * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n"); - $printer->put(" * THE SOFTWARE.\n"); - $printer->put(" */\n"); - $printer->put("#ifndef PHP_GIT2_`file`_H\n", "file", strtoupper($this->name)); - $printer->put("#define PHP_GIT2_`file`_H\n", "file", strtoupper($this->name)); - $printer->put("\n"); - } - - public function generateArgInfo(Printer $printer, Func $f) - { - $printer->put("ZEND_BEGIN_ARG_INFO_EX(arginfo_`name`, `a`, `b`, `c`)\n", - "name", $f->getName(), - "a", 0, - "b", 0, - "c", count($f->getArguments()) - ); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - $printer->put("\tZEND_ARG_INFO(`is_ref`, `name`)\n", - "is_ref", 0, - "name", $arg->getName()); - } - $printer->put("ZEND_END_ARG_INFO()\n"); - $printer->put("\n"); - } - - public function out(Func $f) - { - $stream = new StringStream(); - $out = new ZeroCopyOutputStream($stream); - $printer = new Printer($out, "`"); - - $this->generateLicense($printer, $f); - $this->generateArgInfo($printer, $f); - - return $stream->__toString(); - } -} - -class Header2 extends Header -{ - public function generateArgInfo(Printer $printer, Func $f) - { - $printer->put("ZEND_BEGIN_ARG_INFO_EX(arginfo_`name`, `a`, `b`, `c`)\n", - "name", $f->getName(), - "a", 0, - "b", 0, - "c", count($f->getArguments()) - ); - foreach ($f->getArguments() as $arg) { - /** @var Arg $arg */ - $printer->put("\tZEND_ARG_INFO(`is_ref`, `name`)\n", - "is_ref", 0, - "name", $arg->getName()); - } - $printer->put("ZEND_END_ARG_INFO()\n"); - $printer->put("\n"); - } - - public function out(Func $f) - { - $stream = new StringStream(); - $out = new ZeroCopyOutputStream($stream); - $printer = new Printer($out, "`"); - - $this->generateProto($printer, $f); - $printer->put("PHP_FUNCTION(`func`);\n", "func", $f->getName()); - $printer->put("\n"); - - return $stream->__toString(); - } -} - -$data = file_get_contents($_SERVER['argv'][1]); -$table = array(); -if (preg_match_all("/GIT_EXTERN\((.+?)\)\s*([a-zA-Z0-9_-]+)\((.+?)\);/s", $data, $match)) { - $cnt = count($match[0]); - - for ($i = 0; $i < $cnt; $i++) { - $func = new Func($match[2][$i], $match[1][$i]); - $args = explode(",", $match[3][$i]); - - foreach ($args as $arg) { - $arg = trim($arg); - $pos = strrpos($arg, " "); - $key = trim(substr($arg, $pos)); - $type = trim(substr($arg, 0, $pos)); - $func->addArgument(new Arg($type, $key)); - } - $table[$func->getName()] = $func; - } -} -if (getenv("PRINT_HEADER")) { - $flag = true; - foreach ($table as $name => $func) { - $printer = new Header($_SERVER['argv'][1], $flag); - echo $printer->out($func); - $flag = false; - } - - foreach ($table as $name => $func) { - $printer = new Header2($_SERVER['argv'][1], $flag); - echo $printer->out($func); - } - echo "#endif\n"; -} else { - if (isset($_SERVER['argv'][2])) { - $printer = new Fashion($_SERVER['argv'][1]); - echo $printer->out($table[$_SERVER['argv'][2]]); - } else { - $flag = true; - foreach ($table as $name => $func) { - $printer = new Fashion($_SERVER['argv'][1], $flag); - echo $printer->out($func); - $flag = false; - } - } -} - diff --git a/note.c b/note.c deleted file mode 100644 index 595fb70ee2..0000000000 --- a/note.c +++ /dev/null @@ -1,268 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "note.h" - -/* {{{ proto resource git_note_iterator_new(resource $repo, string $notes_ref) - */ -PHP_FUNCTION(git_note_iterator_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_note_iterator *out = NULL; - zval *repo = NULL; - char *notes_ref = NULL; - int notes_ref_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, ¬es_ref, ¬es_ref_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_note_iterator_new(&out, PHP_GIT2_V(_repo, repository), notes_ref); - if (php_git2_check_error(error, "git_note_iterator_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_NOTE_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_note_iterator_free(resource $it) - */ -PHP_FUNCTION(git_note_iterator_free) -{ - zval *it = NULL; - php_git2_t *_it = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &it) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_it, php_git2_t*, &it, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_it)) { - git_note_iterator_free(PHP_GIT2_V(_it, note_iterator)); - GIT2_SHOULD_FREE(_it) = 0; - }; - zval_ptr_dtor(&it); -} -/* }}} */ - -/* {{{ proto long git_note_next(string $note_id, string $annotated_id, resource $it) - */ -PHP_FUNCTION(git_note_next) -{ - int result = 0, note_id_len = 0, annotated_id_len = 0; - char *note_id = NULL, *annotated_id = NULL; - zval *it = NULL; - php_git2_t *_it = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ssr", ¬e_id, ¬e_id_len, &annotated_id, &annotated_id_len, &it) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_it, php_git2_t*, &it, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_note_next(note_id, annotated_id, PHP_GIT2_V(_it, note_iterator)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_note_read(resource $repo, string $notes_ref, string $oid) - */ -PHP_FUNCTION(git_note_read) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_note *out = NULL; - zval *repo = NULL; - char *notes_ref = NULL, *oid = NULL; - int notes_ref_len = 0, oid_len = 0, error = 0; - git_oid __oid = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &repo, ¬es_ref, ¬es_ref_len, &oid, &oid_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__oid, oid, oid_len)) { - RETURN_FALSE; - } - error = git_note_read(&out, PHP_GIT2_V(_repo, repository), notes_ref, &__oid); - if (php_git2_check_error(error, "git_note_read" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_NOTE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto string git_note_message(resource $note) - */ -PHP_FUNCTION(git_note_message) -{ - const char *result = NULL; - zval *note = NULL; - php_git2_t *_note = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", ¬e) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_note, php_git2_t*, ¬e, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_note_message(PHP_GIT2_V(_note, note)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto resource git_note_oid(resource $note) - */ -PHP_FUNCTION(git_note_oid) -{ - const git_oid *result = NULL; - zval *note = NULL; - php_git2_t *_note = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", ¬e) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_note, php_git2_t*, ¬e, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_note_oid(PHP_GIT2_V(_note, note)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto resource git_note_create(resource $repo, array $author, array $committer, string $notes_ref, string $oid, string $note, long $force) - */ -PHP_FUNCTION(git_note_create) -{ - php_git2_t *_repo = NULL; - git_oid out = {0}, __oid = {0}; - zval *repo = NULL, *author = NULL, *committer = NULL; - char *notes_ref = NULL, *oid = NULL, *note = NULL; - int notes_ref_len = 0, oid_len = 0, note_len = 0, error = 0; - long force = 0; - char buf[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "raasssl", &repo, &author, &committer, ¬es_ref, ¬es_ref_len, &oid, &oid_len, ¬e, ¬e_len, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__oid, oid, oid_len)) { - RETURN_FALSE; - } - error = git_note_create(&out, PHP_GIT2_V(_repo, repository), author, committer, notes_ref, &__oid, note, force); - if (php_git2_check_error(error, "git_note_create" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto long git_note_remove(resource $repo, string $notes_ref, array $author, array $committer, string $oid) - */ -PHP_FUNCTION(git_note_remove) -{ - int result = 0, notes_ref_len = 0, oid_len = 0; - zval *repo = NULL, *author = NULL, *committer = NULL; - php_git2_t *_repo = NULL; - char *notes_ref = NULL, *oid = NULL; - git_oid __oid = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsaas", &repo, ¬es_ref, ¬es_ref_len, &author, &committer, &oid, &oid_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__oid, oid, oid_len)) { - RETURN_FALSE; - } - result = git_note_remove(PHP_GIT2_V(_repo, repository), notes_ref, author, committer, &__oid); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_note_free(resource $note) - */ -PHP_FUNCTION(git_note_free) -{ - zval *note = NULL; - php_git2_t *_note = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", ¬e) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_note, php_git2_t*, ¬e, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_note)) { - git_note_free(PHP_GIT2_V(_note, note)); - GIT2_SHOULD_FREE(_note) = 0; - }; - zval_ptr_dtor(¬e); -} -/* }}} */ - -/* {{{ proto resource git_note_default_ref(resource $repo) - */ -PHP_FUNCTION(git_note_default_ref) -{ - php_git2_t *_repo = NULL; - char *out = NULL; - zval *repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_note_default_ref(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_note_default_ref" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto long git_note_foreach(resource $repo, string $notes_ref, Callable $note_cb, $payload) - */ -PHP_FUNCTION(git_note_foreach) -{ - int result = 0, notes_ref_len = 0; - zval *repo = NULL, *payload = NULL; - php_git2_t *_repo = NULL; - char *notes_ref = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsfz", &repo, ¬es_ref, ¬es_ref_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - //result = git_note_foreach(PHP_GIT2_V(_repo, repository), notes_ref, , cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - diff --git a/note.h b/note.h deleted file mode 100644 index 51de3a2a82..0000000000 --- a/note.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_NOTE_H -#define PHP_GIT2_NOTE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_iterator_new, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, notes_ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_iterator_free, 0, 0, 1) - ZEND_ARG_INFO(0, it) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_next, 0, 0, 3) - ZEND_ARG_INFO(0, note_id) - ZEND_ARG_INFO(0, annotated_id) - ZEND_ARG_INFO(0, it) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_read, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, notes_ref) - ZEND_ARG_INFO(0, oid) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_message, 0, 0, 1) - ZEND_ARG_INFO(0, note) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_oid, 0, 0, 1) - ZEND_ARG_INFO(0, note) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_create, 0, 0, 7) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, author) - ZEND_ARG_INFO(0, committer) - ZEND_ARG_INFO(0, notes_ref) - ZEND_ARG_INFO(0, oid) - ZEND_ARG_INFO(0, note) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_remove, 0, 0, 5) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, notes_ref) - ZEND_ARG_INFO(0, author) - ZEND_ARG_INFO(0, committer) - ZEND_ARG_INFO(0, oid) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_free, 0, 0, 1) - ZEND_ARG_INFO(0, note) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_default_ref, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_note_foreach, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, notes_ref) - ZEND_ARG_INFO(0, note_cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_note_iterator_new(repo, notes_ref) -*/ -PHP_FUNCTION(git_note_iterator_new); - -/* {{{ proto void git_note_iterator_free(it) -*/ -PHP_FUNCTION(git_note_iterator_free); - -/* {{{ proto long git_note_next(note_id, annotated_id, it) -*/ -PHP_FUNCTION(git_note_next); - -/* {{{ proto resource git_note_read(repo, notes_ref, oid) -*/ -PHP_FUNCTION(git_note_read); - -/* {{{ proto resource git_note_message(note) -*/ -PHP_FUNCTION(git_note_message); - -/* {{{ proto resource git_note_oid(note) -*/ -PHP_FUNCTION(git_note_oid); - -/* {{{ proto resource git_note_create(repo, author, committer, notes_ref, oid, note, force) -*/ -PHP_FUNCTION(git_note_create); - -/* {{{ proto long git_note_remove(repo, notes_ref, author, committer, oid) -*/ -PHP_FUNCTION(git_note_remove); - -/* {{{ proto void git_note_free(note) -*/ -PHP_FUNCTION(git_note_free); - -/* {{{ proto resource git_note_default_ref(repo) -*/ -PHP_FUNCTION(git_note_default_ref); - -/* {{{ proto long git_note_foreach(repo, notes_ref, note_cb, payload) -*/ -PHP_FUNCTION(git_note_foreach); - -#endif \ No newline at end of file diff --git a/object.c b/object.c deleted file mode 100644 index 247d021031..0000000000 --- a/object.c +++ /dev/null @@ -1,284 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "object.h" - -/* {{{ proto long git_object_lookup(resource $repo, string $id, long $type) - */ -PHP_FUNCTION(git_object_lookup) -{ - int result = 0, id_len = 0; - git_object *object = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *id = NULL; - git_oid __id = {0}; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &repo, &id, &id_len, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_object_lookup(&object, PHP_GIT2_V(_repo, repository), &__id, type); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_object_lookup_prefix(resource $repo, string $id, long $len, long $type) - */ -PHP_FUNCTION(git_object_lookup_prefix) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_object *object_out = NULL; - zval *repo = NULL; - char *id = NULL; - int id_len = 0, error = 0; - git_oid __id = {0}; - long len = 0, type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsll", &repo, &id, &id_len, &len, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - error = git_object_lookup_prefix(&object_out, PHP_GIT2_V(_repo, repository), &__id, len, type); - if (php_git2_check_error(error, "git_object_lookup_prefix" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_OBJECT, object_out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_object_lookup_bypath(resource $treeish, string $path, long $type) - */ -PHP_FUNCTION(git_object_lookup_bypath) -{ - php_git2_t *result = NULL, *_treeish = NULL; - git_object *out = NULL; - zval *treeish = NULL; - char *path = NULL; - int path_len = 0, error = 0; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &treeish, &path, &path_len, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_treeish, php_git2_t*, &treeish, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_object_lookup_bypath(&out, PHP_GIT2_V(_treeish, object), path, type); - if (php_git2_check_error(error, "git_object_lookup_bypath" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_OBJECT, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_object_id(obj) -*/ -PHP_FUNCTION(git_object_id) -{ - zval *obj; - php_git2_t *_obj; - const git_oid *id; - char buf[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &obj) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_obj, php_git2_t*, &obj, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - id = git_object_id(PHP_GIT2_V(_obj, object)); - git_oid_fmt(buf, id); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto resource git_object_type(resource $obj) - */ -PHP_FUNCTION(git_object_type) -{ - git_otype result; - zval *obj = NULL; - php_git2_t *_obj = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &obj) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_obj, php_git2_t*, &obj, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_object_type(PHP_GIT2_V(_obj, object)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_object_owner(resource $obj) - */ -PHP_FUNCTION(git_object_owner) -{ - git_repository *result = NULL; - zval *obj = NULL; - php_git2_t *_obj = NULL, *__result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &obj) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_obj, php_git2_t*, &obj, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_object_owner(PHP_GIT2_V(_obj, object)); - if (php_git2_make_resource(&__result, PHP_GIT2_TYPE_OBJECT, result, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(__result)); -} -/* }}} */ - -/* {{{ proto void git_object_free(resource $object) - */ -PHP_FUNCTION(git_object_free) -{ - zval *object = NULL; - php_git2_t *_object = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &object) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_object)) { - git_object_free(PHP_GIT2_V(_object, object)); - GIT2_SHOULD_FREE(_object) = 0; - }; - zval_ptr_dtor(&object); -} -/* }}} */ - -/* {{{ proto string git_object_type2string(long $type) - */ -PHP_FUNCTION(git_object_type2string) -{ - const char *result = NULL; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "l", &type) == FAILURE) { - return; - } - - result = git_object_type2string(type); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto resource git_object_string2type(str) -*/ -PHP_FUNCTION(git_object_string2type) -{ - char *str = {0}; - int str_len; - git_otype type; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &str, &str_len) == FAILURE) { - return; - } - type = git_object_string2type(str); - RETURN_LONG(type); -} -/* }}} */ - -/* {{{ proto long git_object_typeisloose(long $type) - */ -PHP_FUNCTION(git_object_typeisloose) -{ - int result = 0; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "l", &type) == FAILURE) { - return; - } - - result = git_object_typeisloose(type); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_object__size(type) -*/ -PHP_FUNCTION(git_object__size) -{ - long type; - size_t size; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "l", &type) == FAILURE) { - return; - } - size = git_object__size(type); - RETURN_LONG(size); -} - -/* {{{ proto long git_object_peel(resource $object, long $target_type) - */ -PHP_FUNCTION(git_object_peel) -{ - int result = 0; - git_object *peeled = NULL; - zval *object = NULL; - php_git2_t *_object = NULL, *_result; - long target_type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &object, &target_type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_object_peel(&peeled, PHP_GIT2_V(_object, object), target_type); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_OBJECT, peeled, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto long git_object_dup(resource $source) - */ -PHP_FUNCTION(git_object_dup) -{ - int result = 0; - git_object *dest = NULL; - zval *source = NULL; - php_git2_t *_source = NULL, *_result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &source) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_source, php_git2_t*, &source, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_object_dup(&dest, PHP_GIT2_V(_source, object)); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_OBJECT, dest, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ diff --git a/object.h b/object.h deleted file mode 100644 index dc414ef3d1..0000000000 --- a/object.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_OBJECT_H -#define PHP_GIT2_OBJECT_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_lookup, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_lookup_prefix, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, len) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_lookup_bypath, 0, 0, 3) - ZEND_ARG_INFO(0, treeish) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_id, 0, 0, 1) - ZEND_ARG_INFO(0, obj) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_type, 0, 0, 1) - ZEND_ARG_INFO(0, obj) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_owner, 0, 0, 1) - ZEND_ARG_INFO(0, obj) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_free, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_type2string, 0, 0, 1) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_string2type, 0, 0, 1) - ZEND_ARG_INFO(0, str) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_typeisloose, 0, 0, 1) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object__size, 0, 0, 1) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_peel, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, target_type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_object_dup, 0, 0, 1) - ZEND_ARG_INFO(0, source) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_object_lookup(repo, id, type) -*/ -PHP_FUNCTION(git_object_lookup); - -/* {{{ proto resource git_object_lookup_prefix(repo, id, len, type) -*/ -PHP_FUNCTION(git_object_lookup_prefix); - -/* {{{ proto resource git_object_lookup_bypath(treeish, path, type) -*/ -PHP_FUNCTION(git_object_lookup_bypath); - -/* {{{ proto resource git_object_id(obj) -*/ -PHP_FUNCTION(git_object_id); - -/* {{{ proto resource git_object_type(obj) -*/ -PHP_FUNCTION(git_object_type); - -/* {{{ proto resource git_object_owner(obj) -*/ -PHP_FUNCTION(git_object_owner); - -/* {{{ proto void git_object_free(object) -*/ -PHP_FUNCTION(git_object_free); - -/* {{{ proto resource git_object_type2string(type) -*/ -PHP_FUNCTION(git_object_type2string); - -/* {{{ proto resource git_object_string2type(str) -*/ -PHP_FUNCTION(git_object_string2type); - -/* {{{ proto long git_object_typeisloose(type) -*/ -PHP_FUNCTION(git_object_typeisloose); - -/* {{{ proto resource git_object__size(type) -*/ -PHP_FUNCTION(git_object__size); - -/* {{{ proto resource git_object_peel(object, target_type) -*/ -PHP_FUNCTION(git_object_peel); - -/* {{{ proto resource git_object_dup(source) -*/ -PHP_FUNCTION(git_object_dup); - -#endif \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 0000000000..bc2ee513d4 Binary files /dev/null and b/objects.inv differ diff --git a/odb.c b/odb.c deleted file mode 100644 index 75be76cf12..0000000000 --- a/odb.c +++ /dev/null @@ -1,1109 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "odb.h" - -static int php_git2_git_odb_foreach_cb(const git_oid *id, void *payload) -{ - zval *param_oid, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - char buf[41] = {0}; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_oid); - - git_oid_fmt(buf, id); - ZVAL_STRING(param_oid, buf, 1); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 2, ¶m_oid, &p->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -/* {{{ proto resource git_odb_new() - */ -PHP_FUNCTION(git_odb_new) -{ - php_git2_t *result = NULL; - git_odb *out = NULL; - int error = 0; - - error = git_odb_new(&out); - if (php_git2_check_error(error, "git_odb_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_odb_open(string $objects_dir) - */ -PHP_FUNCTION(git_odb_open) -{ - php_git2_t *result = NULL; - git_odb *out = NULL; - char *objects_dir = NULL; - int objects_dir_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &objects_dir, &objects_dir_len) == FAILURE) { - return; - } - - error = git_odb_open(&out, objects_dir); - if (php_git2_check_error(error, "git_odb_open" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_odb_add_disk_alternate(resource $odb, string $path) - */ -PHP_FUNCTION(git_odb_add_disk_alternate) -{ - int result = 0, path_len = 0; - zval *odb = NULL; - php_git2_t *_odb = NULL; - char *path = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &odb, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_add_disk_alternate(PHP_GIT2_V(_odb, odb), path); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_odb_free(resource $db) - */ -PHP_FUNCTION(git_odb_free) -{ - zval *db = NULL; - php_git2_t *_db = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &db) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_db)) { - git_odb_free(PHP_GIT2_V(_db, odb)); - GIT2_SHOULD_FREE(_db) = 0; - }; - zval_ptr_dtor(&db); -} -/* }}} */ - -/* {{{ proto resource git_odb_read(resource $db, string $id) - */ -PHP_FUNCTION(git_odb_read) -{ - php_git2_t *result = NULL, *_db = NULL; - git_odb_object *out = NULL; - zval *db = NULL; - char *id = NULL; - int id_len = 0, error = 0; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &db, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - error = git_odb_read(&out, PHP_GIT2_V(_db, odb),&__id); - if (php_git2_check_error(error, "git_odb_read" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_OBJECT, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_odb_read_prefix(resource $db, string $short_id) - */ -PHP_FUNCTION(git_odb_read_prefix) -{ - php_git2_t *result = NULL, *_db = NULL; - git_odb_object *out = NULL; - zval *db = NULL; - char *short_id = NULL; - int short_id_len = 0, error = 0; - git_oid __short_id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &db, &short_id, &short_id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__short_id, short_id, short_id_len)) { - RETURN_FALSE; - } - error = git_odb_read_prefix(&out, PHP_GIT2_V(_db, odb), &__short_id, short_id_len); - if (php_git2_check_error(error, "git_odb_read_prefix" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_OBJECT, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_odb_read_header( $type_out, resource $db, string $id) - */ -PHP_FUNCTION(git_odb_read_header) -{ - php_git2_t *_db = NULL; - size_t len_out = NULL; - zval *db = NULL, *_result = NULL; - git_otype type_out; - char *id = NULL; - int id_len = 0, error = 0; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &db, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - error = git_odb_read_header(&len_out, &type_out, PHP_GIT2_V(_db, odb), &__id); - if (php_git2_check_error(error, "git_odb_read_header" TSRMLS_CC)) { - RETURN_FALSE; - } - MAKE_STD_ZVAL(_result); - array_init(_result); - add_next_index_long(_result, len_out); - add_next_index_long(_result, type_out); - RETURN_ZVAL(_result, 0, 1); -} -/* }}} */ - -/* {{{ proto long git_odb_exists(resource $db, string $id) - */ -PHP_FUNCTION(git_odb_exists) -{ - int result = 0, id_len = 0; - zval *db = NULL; - php_git2_t *_db = NULL; - char *id = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &db, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_odb_exists(PHP_GIT2_V(_db, odb), &__id); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_odb_refresh(resource $db) - */ -PHP_FUNCTION(git_odb_refresh) -{ - int result = 0; - zval *db = NULL; - php_git2_t *_db = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &db) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_refresh(PHP_GIT2_V(_db, odb)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_odb_foreach(resource $db, Callable $cb, $payload) - */ -PHP_FUNCTION(git_odb_foreach) -{ - int result = 0; - zval *db = NULL, *payload = NULL; - php_git2_t *_db = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &db, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_odb_foreach(PHP_GIT2_V(_db, odb), php_git2_git_odb_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_odb_write(resource $odb, $data, $type) - */ -PHP_FUNCTION(git_odb_write) -{ - php_git2_t *_odb = NULL; - git_oid out = {0}; - zval *odb = NULL; - zval *data = NULL; - long type = 0; - int error = 0, data_len = 0; - char buf[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &odb, &data, &data_len, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_odb_write(&out, PHP_GIT2_V(_odb, odb), data, data_len, type); - if (php_git2_check_error(error, "git_odb_write" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto resource git_odb_open_wstream(resource $db, long $size, $type) - */ -PHP_FUNCTION(git_odb_open_wstream) -{ - php_git2_t *result = NULL, *_db = NULL; - git_odb_stream *out = NULL; - zval *db = NULL; - long size = 0, type = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rll", &db, &size, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_odb_open_wstream(&out, PHP_GIT2_V(_db, odb), size, type); - if (php_git2_check_error(error, "git_odb_open_wstream" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_STREAM, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_odb_stream_write(resource $stream, string $buffer) - */ -PHP_FUNCTION(git_odb_stream_write) -{ - int result = 0, buffer_len = 0; - zval *stream = NULL; - php_git2_t *_stream = NULL; - char *buffer = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &stream, &buffer, &buffer_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_stream, php_git2_t*, &stream, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_stream_write(PHP_GIT2_V(_stream, odb_stream), buffer, buffer_len); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_odb_stream_finalize_write(resource $stream) - */ -PHP_FUNCTION(git_odb_stream_finalize_write) -{ - php_git2_t *_stream = NULL; - git_oid out = {0}; - zval *stream = NULL; - int error = 0; - char buf[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &stream) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_stream, php_git2_t*, &stream, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_odb_stream_finalize_write(&out, PHP_GIT2_V(_stream, odb_stream)); - if (php_git2_check_error(error, "git_odb_stream_finalize_write" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto long git_odb_stream_read(resource $stream, string $buffer, long $len) - */ -PHP_FUNCTION(git_odb_stream_read) -{ - int result = 0, buffer_len = 0; - zval *stream = NULL; - php_git2_t *_stream = NULL; - char *buffer = NULL; - long len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &stream, &buffer, &buffer_len, &len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_stream, php_git2_t*, &stream, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_stream_read(PHP_GIT2_V(_stream, odb_stream), buffer, len); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_odb_stream_free(resource $stream) - */ -PHP_FUNCTION(git_odb_stream_free) -{ - zval *stream = NULL; - php_git2_t *_stream = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &stream) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_stream, php_git2_t*, &stream, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_stream)) { - git_odb_stream_free(PHP_GIT2_V(_stream, odb_stream)); - GIT2_SHOULD_FREE(_stream) = 0; - }; - zval_ptr_dtor(&stream); -} -/* }}} */ - -/* {{{ proto resource git_odb_open_rstream(resource $db, string $oid) - */ -PHP_FUNCTION(git_odb_open_rstream) -{ - php_git2_t *result = NULL, *_db = NULL; - git_odb_stream *out = NULL; - zval *db = NULL; - char *oid = NULL; - int oid_len = 0, error = 0; - git_oid __oid = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &db, &oid, &oid_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__oid, oid, oid_len)) { - RETURN_FALSE; - } - error = git_odb_open_rstream(&out, PHP_GIT2_V(_db, odb), &__oid); - if (php_git2_check_error(error, "git_odb_open_rstream" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_STREAM, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_odb_write_pack(resource $db, $progress_cb, $progress_payload) - */ -PHP_FUNCTION(git_odb_write_pack) -{ - php_git2_t *result = NULL, *_db = NULL; - git_odb_writepack *out = NULL; - zval *db = NULL, *progress_cb = NULL, *progress_payload = NULL; - int error = 0; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rz", &db, &progress_cb, &progress_payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_db, php_git2_t*, &db, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, progress_payload TSRMLS_CC)) { - RETURN_FALSE; - } - error = git_odb_write_pack(&out, PHP_GIT2_V(_db, odb), progress_cb, cb); - if (php_git2_check_error(error, "git_odb_write_pack" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_WRITEPACK, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_odb_hash(string $data, long $type) - */ -PHP_FUNCTION(git_odb_hash) -{ - git_oid out = {0}; - zval *data = NULL; - int error = 0, data_len = 0; - long type = 0; - char buf[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sl", &data, &data_len, &type) == FAILURE) { - return; - } - error = git_odb_hash(&out, data, data_len, type); - if (php_git2_check_error(error, "git_odb_hash" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto resource git_odb_hashfile(string $path, $type) - */ -PHP_FUNCTION(git_odb_hashfile) -{ - git_oid out = {0}; - char *path = NULL; - int path_len = 0, error = 0; - char buf[GIT2_OID_HEXSIZE] = {0}; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sl", &path, &path_len, &type) == FAILURE) { - return; - } - error = git_odb_hashfile(&out, path, type); - if (php_git2_check_error(error, "git_odb_hashfile" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto long git_odb_object_dup(resource $source) - */ -PHP_FUNCTION(git_odb_object_dup) -{ - int result = 0; - git_odb_object *dest = NULL; - zval *source = NULL; - php_git2_t *_source = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &source) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_source, php_git2_t*, &source, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_object_dup(&dest, PHP_GIT2_V(_source, odb_object)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_odb_object_free(resource $object) - */ -PHP_FUNCTION(git_odb_object_free) -{ - zval *object = NULL; - php_git2_t *_object = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &object) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_object)) { - git_odb_object_free(PHP_GIT2_V(_object, odb_object)); - GIT2_SHOULD_FREE(_object) = 0; - }; - zval_ptr_dtor(&object); -} -/* }}} */ - -/* {{{ proto resource git_odb_object_id(resource $object) - */ -PHP_FUNCTION(git_odb_object_id) -{ - const git_oid *result = NULL; - zval *object = NULL; - php_git2_t *_object = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &object) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_object_id(PHP_GIT2_V(_object, odb_object)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto void git_odb_object_data(resource $object) - */ -PHP_FUNCTION(git_odb_object_data) -{ - zval *object = NULL; - php_git2_t *_object = NULL; - const char *buffer; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &object) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - buffer = git_odb_object_data(PHP_GIT2_V(_object, odb_object)); - RETURN_STRINGL(buffer, git_odb_object_size(PHP_GIT2_V(_object, odb_object)), 1); -} -/* }}} */ - -/* {{{ proto long git_odb_object_size(resource $object) - */ -PHP_FUNCTION(git_odb_object_size) -{ - size_t result = 0; - zval *object = NULL; - php_git2_t *_object = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &object) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_object_size(PHP_GIT2_V(_object, odb_object)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_odb_object_type(resource $object) - */ -PHP_FUNCTION(git_odb_object_type) -{ - git_otype result; - zval *object = NULL; - php_git2_t *_object = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &object) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_object, php_git2_t*, &object, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_object_type(PHP_GIT2_V(_object, odb_object)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_odb_add_backend(resource $odb, resource $backend, long $priority) - */ -PHP_FUNCTION(git_odb_add_backend) -{ - int result = 0; - zval *odb = NULL, *backend = NULL; - php_git2_t *_odb = NULL, *_backend = NULL; - long priority = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrl", &odb, &backend, &priority) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_backend, php_git2_t*, &backend, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_add_backend(PHP_GIT2_V(_odb, odb), PHP_GIT2_V(_backend, odb_backend), priority); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_odb_add_alternate(resource $odb, resource $backend, long $priority) - */ -PHP_FUNCTION(git_odb_add_alternate) -{ - int result = 0; - zval *odb = NULL, *backend = NULL; - php_git2_t *_odb = NULL, *_backend = NULL; - long priority = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrl", &odb, &backend, &priority) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_backend, php_git2_t*, &backend, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_add_alternate(PHP_GIT2_V(_odb, odb), PHP_GIT2_V(_backend, odb_backend), priority); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_odb_num_backends(resource $odb) - */ -PHP_FUNCTION(git_odb_num_backends) -{ - size_t result = 0; - zval *odb = NULL; - php_git2_t *_odb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &odb) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_odb_num_backends(PHP_GIT2_V(_odb, odb)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_odb_get_backend(resource $odb, long $pos) - */ -PHP_FUNCTION(git_odb_get_backend) -{ - php_git2_t *result = NULL, *_odb = NULL; - git_odb_backend *out = NULL; - zval *odb = NULL; - long pos = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &odb, &pos) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_odb_get_backend(&out, PHP_GIT2_V(_odb, odb), pos); - if (php_git2_check_error(error, "git_odb_get_backend" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_BACKEND, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -static int php_git2_odb_backend_read(void **buffer, size_t *size, git_otype *type, git_odb_backend *backend, const git_oid *oid) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)backend; - zval *param_oid = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls); - char buf[41] = {0}; - - git_oid_fmt(buf, oid); - MAKE_STD_ZVAL(param_oid); - ZVAL_STRING(param_oid, buf, 1); - - if (php_git2_call_function_v(&p->callbacks[0].fci, &p->callbacks[0].fcc TSRMLS_CC, &retval_ptr, 1, ¶m_oid)) { - return GIT_EUSER; - } - if (Z_TYPE_P(retval_ptr) == IS_ARRAY) { - zval **value, **otype; - char *pp; - - if (zend_hash_num_elements(Z_ARRVAL_P(retval_ptr)) != 2) { - return GIT_ENOTFOUND; - } - - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&value); - pp = git_odb_backend_malloc(backend, Z_STRLEN_PP(value)); - memset(pp, '\0', Z_STRLEN_PP(value)); - memcpy(pp, Z_STRVAL_PP(value), Z_STRLEN_PP(value)); - - *buffer = pp; - *size = Z_STRLEN_PP(value); - - zend_hash_move_forward(Z_ARRVAL_P(retval_ptr)); - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&otype); - *type = Z_LVAL_PP(otype); - } else { - retval = GIT_ENOTFOUND; - } - - zval_ptr_dtor(&retval_ptr); - return retval; -} -static int php_git2_odb_backend_write(git_odb_backend *backend, const git_oid *oid, const void *buffer, size_t size, git_otype type) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)backend; - zval *param_oid = NULL, *param_buffer = NULL, *param_otype = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls); - char buf[41] = {0}; - - git_oid_fmt(buf, oid); - MAKE_STD_ZVAL(param_oid); - MAKE_STD_ZVAL(param_buffer); - MAKE_STD_ZVAL(param_otype); - - ZVAL_STRING(param_oid, buf, 1); - ZVAL_STRINGL(param_buffer, buffer, size, 1); - ZVAL_LONG(param_otype, type); - - if (php_git2_call_function_v(&p->callbacks[1].fci, &p->callbacks[1].fcc TSRMLS_CC, &retval_ptr, 3, - ¶m_oid, ¶m_buffer, ¶m_otype)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} -static int php_git2_odb_backend_read_prefix(git_oid *out_oid, - void **buffer_p, - size_t *len_p, - git_otype *type_p, - git_odb_backend *backend, - const git_oid *short_oid, - size_t len) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)backend; - zval *param_short_oid = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls); - char buf[41] = {0}; - - git_oid_nfmt(buf, len, short_oid); - MAKE_STD_ZVAL(param_short_oid); - ZVAL_STRING(param_short_oid, buf, 1); - - if (php_git2_call_function_v(&p->callbacks[2].fci, &p->callbacks[2].fcc TSRMLS_CC, &retval_ptr, 1, ¶m_short_oid)) { - return GIT_EUSER; - } - - if (Z_TYPE_P(retval_ptr) == IS_ARRAY) { - zval **value, **otype, **_oid; - char *pp; - - if (zend_hash_num_elements(Z_ARRVAL_P(retval_ptr)) != 3) { - return GIT_ENOTFOUND; - } - - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&value); - pp = git_odb_backend_malloc(backend, Z_STRLEN_PP(value)); - memset(pp, '\0', Z_STRLEN_PP(value)); - memcpy(pp, Z_STRVAL_PP(value), Z_STRLEN_PP(value)); - - *buffer_p = pp; - *len_p = Z_STRLEN_PP(value); - - zend_hash_move_forward(Z_ARRVAL_P(retval_ptr)); - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&otype); - *type_p = Z_LVAL_PP(otype); - - zend_hash_move_forward(Z_ARRVAL_P(retval_ptr)); - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&_oid); - if (git_oid_fromstrn(out_oid, Z_STRVAL_PP(_oid), Z_STRLEN_PP(_oid)) != GIT_OK) { - return GIT_EUSER; - } - } else { - retval = GIT_ENOTFOUND; - } - - zval_ptr_dtor(&retval_ptr); - return retval; -} - -static int php_git2_odb_backend_read_header(size_t *len_p, git_otype *type_p, git_odb_backend *backend, const git_oid *oid) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)backend; - zval *param_oid = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls); - char buf[41] = {0}; - - git_oid_fmt(buf, oid); - MAKE_STD_ZVAL(param_oid); - ZVAL_STRING(param_oid, buf, 1); - - if (php_git2_call_function_v(&p->callbacks[3].fci, &p->callbacks[3].fcc TSRMLS_CC, &retval_ptr, 1, ¶m_oid)) { - return GIT_EUSER; - } - if (Z_TYPE_P(retval_ptr) == IS_ARRAY) { - zval **value, **otype; - - if (zend_hash_num_elements(Z_ARRVAL_P(retval_ptr)) != 2) { - return GIT_ENOTFOUND; - } - - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&value); - *len_p = Z_LVAL_PP(value); - zend_hash_move_forward(Z_ARRVAL_P(retval_ptr)); - zend_hash_get_current_data(Z_ARRVAL_P(retval_ptr), (void **)&otype); - *type_p = Z_LVAL_PP(otype); - } else { - retval = GIT_ENOTFOUND; - } - - zval_ptr_dtor(&retval_ptr); - return retval; -} -static int php_git2_odb_backend_writestream(git_odb_stream **stream_out, git_odb_backend *_backend, size_t length, git_otype type) -{ - fprintf(stderr, "WRITES"); -} -static int php_git2_odb_backend_exists(git_odb_backend *backend, const git_oid *oid) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)backend; - zval *param_oid = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls); - char buf[41] = {0}; - - git_oid_fmt(buf, oid); - MAKE_STD_ZVAL(param_oid); - ZVAL_STRING(param_oid, buf, 1); - - if (php_git2_call_function_v(&p->callbacks[5].fci, &p->callbacks[5].fcc TSRMLS_CC, &retval_ptr, 1, - ¶m_oid)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - if (retval == 1) { - retval = 0; - } else { - retval = GIT_ENOTFOUND; - } - zval_ptr_dtor(&retval_ptr); - return !retval; -} - -static const zend_arg_info arginfo_git_odb_backend_foreach_callback[] = { - ZEND_ARG_INFO(0, oid) - ZEND_ARG_INFO(1, payload) -}; - -static void git_ex_cb(INTERNAL_FUNCTION_PARAMETERS) -{ - zval *payload, *this = getThis(); - php_git2_odb_backend_foreach_callback *_callback; - char *oid; - int oid_len, retval = 0; - git_oid _oid; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sz", &oid, &oid_len, &payload) == FAILURE) { - return; - } - - if (git_oid_fromstrn(&_oid, oid, oid_len) != GIT_OK) { - return; - } - - _callback = (php_git2_odb_backend_foreach_callback*)zend_object_store_get_object(this TSRMLS_CC); - _callback->payload->payload = payload; - retval = _callback->callback(&_oid, _callback->payload); - RETURN_LONG(retval); -} - -static int php_git2_odb_backend_foreach(git_odb_backend *backend, git_odb_foreach_cb cb, void *data) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)backend; - zval *param_callback = NULL, *callback = NULL, *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - zend_function function = {0}; - php_git2_odb_backend_foreach_callback *_callback; - php_git2_cb_t *__cb = (php_git2_cb_t*)data; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls); - - MAKE_STD_ZVAL(callback); - object_init_ex(callback, php_git2_odb_backend_foreach_callback_class_entry); - _callback = (php_git2_odb_backend_foreach_callback*)zend_object_store_get_object(callback TSRMLS_CC); - _callback->callback = cb; - _callback->payload = __cb; - Z_ADDREF_P(callback); - - function.type = ZEND_INTERNAL_FUNCTION; - function.common.function_name = "callback"; - function.common.fn_flags = ZEND_ACC_CLOSURE; - function.common.num_args = 2; - function.common.required_num_args = 2; - function.common.arg_info = &arginfo_git_odb_backend_foreach_callback; - function.common.scope = php_git2_odb_backend_foreach_callback_class_entry; - function.internal_function.type = ZEND_INTERNAL_FUNCTION; - function.internal_function.scope = php_git2_odb_backend_foreach_callback_class_entry; - function.internal_function.fn_flags = ZEND_ACC_CLOSURE; - function.internal_function.handler = git_ex_cb; - function.internal_function.module = &git2_module_entry; - function.internal_function.num_args = 2; - function.internal_function.required_num_args = 2; - function.internal_function.arg_info = &arginfo_git_odb_backend_foreach_callback; - - MAKE_STD_ZVAL(param_callback); - zend_create_closure(param_callback, &function, php_git2_odb_backend_foreach_callback_class_entry, callback TSRMLS_CC); - Z_ADDREF_P(__cb->payload); - - if (php_git2_call_function_v(&p->callbacks[6].fci, &p->callbacks[6].fcc TSRMLS_CC, &retval_ptr, 2, - ¶m_callback, &__cb->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -static void php_git2_odb_backend_free(git_odb_backend *_backend) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)_backend; - zval *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - GIT2_TSRMLS_SET(p->tsrm_ls); - if (php_git2_call_function_v(&p->callbacks[7].fci, &p->callbacks[7].fcc TSRMLS_CC, &retval_ptr, 0)) { - return; - } - - zval_ptr_dtor(&retval_ptr); - return; -} - -static void php_git2_odb_refresh(git_odb_backend *_backend) -{ - php_git2_odb_backend *php_backend = (php_git2_odb_backend*)_backend; - zval *retval_ptr = NULL; - php_git2_multi_cb_t *p = php_backend->multi; - GIT2_TSRMLS_SET(p->tsrm_ls); - if (php_git2_call_function_v(&p->callbacks[8].fci, &p->callbacks[8].fcc TSRMLS_CC, &retval_ptr, 0)) { - return; - } - - zval_ptr_dtor(&retval_ptr); - return; -} -PHP_FUNCTION(git_odb_backend_new) -{ - php_git2_odb_backend *backend; - php_git2_t *result; - zval *callbacks, *tmp; - zend_fcall_info read_fci, write_fci, read_prefix_fci, read_header_fci, writestream_fci, - exists_fci, foreach_fci, free_fci, refresh_fci; - zend_fcall_info_cache read_fcc, write_fcc, read_prefix_fcc, read_header_fcc, writestream_fcc, - exists_fcc, foreach_fcc, free_fcc, refresh_fcc; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "a", &callbacks) == FAILURE) { - return; - } - - backend = ecalloc(1, sizeof(php_git2_odb_backend)); - - backend->parent.version = GIT_ODB_BACKEND_VERSION; - backend->parent.read = &php_git2_odb_backend_read; - backend->parent.write = &php_git2_odb_backend_write; - backend->parent.read_prefix = &php_git2_odb_backend_read_prefix; - backend->parent.read_header = &php_git2_odb_backend_read_header; - //backend->parent.writestream = &php_git2_odb_backend_writestream; - backend->parent.exists = &php_git2_odb_backend_exists; - backend->parent.foreach = &php_git2_odb_backend_foreach; - backend->parent.free = &php_git2_odb_backend_free; - backend->parent.refresh = &php_git2_odb_refresh; - - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("read") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &read_fci, &read_fcc TSRMLS_CC); - } - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("write") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &write_fci, &write_fcc TSRMLS_CC); - } - - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("read_header") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &read_header_fci, &read_header_fcc TSRMLS_CC); - } - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("read_prefix") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &read_prefix_fci, &read_prefix_fcc TSRMLS_CC); - } - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("exists") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &exists_fci, &exists_fcc TSRMLS_CC); - } - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("foreach") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &foreach_fci, &foreach_fcc TSRMLS_CC); - } - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("free") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &free_fci, &free_fcc TSRMLS_CC); - } - tmp = php_git2_read_arrval(callbacks, ZEND_STRS("refresh") TSRMLS_CC); - if (tmp) { - php_git2_fcall_info_wrapper2(tmp, &refresh_fci, &refresh_fcc TSRMLS_CC); - } - - Z_ADDREF_P(callbacks); - php_git2_multi_cb_init(&backend->multi, callbacks TSRMLS_CC, 9, - &read_fci, &read_fcc, - &write_fci, &write_fcc, - &read_prefix_fci, &read_prefix_fcc, - &read_header_fci, &read_header_fcc, - &writestream_fci, &writestream_fcc, - &exists_fci, &exists_fcc, - &foreach_fci, &foreach_fcc, - &free_fci, &free_fcc, - &refresh_fci, &refresh_fcc - ); - - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB_BACKEND, backend, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} diff --git a/odb.h b/odb.h deleted file mode 100644 index 0adbe34029..0000000000 --- a/odb.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_ODB_H -#define PHP_GIT2_ODB_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_new, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_open, 0, 0, 1) - ZEND_ARG_INFO(0, objects_dir) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_add_disk_alternate, 0, 0, 2) - ZEND_ARG_INFO(0, odb) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_free, 0, 0, 1) - ZEND_ARG_INFO(0, db) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_read, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_read_prefix, 0, 0, 3) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, short_id) - ZEND_ARG_INFO(0, len) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_read_header, 0, 0, 3) - ZEND_ARG_INFO(0, type_out) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_exists, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_refresh, 0, 0, 1) - ZEND_ARG_INFO(0, db) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_write, 0, 0, 4) - ZEND_ARG_INFO(0, odb) - ZEND_ARG_INFO(0, data) - ZEND_ARG_INFO(0, len) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_open_wstream, 0, 0, 3) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, size) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_stream_write, 0, 0, 2) - ZEND_ARG_INFO(0, buffer) - ZEND_ARG_INFO(0, len) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_stream_finalize_write, 0, 0, 1) - ZEND_ARG_INFO(0, stream) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_stream_read, 0, 0, 3) - ZEND_ARG_INFO(0, stream) - ZEND_ARG_INFO(0, buffer) - ZEND_ARG_INFO(0, len) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_stream_free, 0, 0, 1) - ZEND_ARG_INFO(0, stream) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_open_rstream, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, oid) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_write_pack, 0, 0, 3) - ZEND_ARG_INFO(0, db) - ZEND_ARG_INFO(0, progress_cb) - ZEND_ARG_INFO(0, progress_payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_hash, 0, 0, 3) - ZEND_ARG_INFO(0, data) - ZEND_ARG_INFO(0, len) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_hashfile, 0, 0, 2) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_object_dup, 0, 0, 1) - ZEND_ARG_INFO(0, source) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_object_free, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_object_id, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_object_data, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_object_size, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_object_type, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_add_backend, 0, 0, 3) - ZEND_ARG_INFO(0, odb) - ZEND_ARG_INFO(0, backend) - ZEND_ARG_INFO(0, priority) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_add_alternate, 0, 0, 3) - ZEND_ARG_INFO(0, odb) - ZEND_ARG_INFO(0, backend) - ZEND_ARG_INFO(0, priority) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_num_backends, 0, 0, 1) - ZEND_ARG_INFO(0, odb) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_get_backend, 0, 0, 2) - ZEND_ARG_INFO(0, odb) - ZEND_ARG_INFO(0, pos) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_odb_backend_new, 0, 0, 1) - ZEND_ARG_INFO(0, callbacks) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_odb_new() -*/ -PHP_FUNCTION(git_odb_new); - -/* {{{ proto resource git_odb_open(objects_dir) -*/ -PHP_FUNCTION(git_odb_open); - -/* {{{ proto long git_odb_add_disk_alternate(odb, path) -*/ -PHP_FUNCTION(git_odb_add_disk_alternate); - -/* {{{ proto void git_odb_free(db) -*/ -PHP_FUNCTION(git_odb_free); - -/* {{{ proto resource git_odb_read(db, id) -*/ -PHP_FUNCTION(git_odb_read); - -/* {{{ proto resource git_odb_read_prefix(db, short_id, len) -*/ -PHP_FUNCTION(git_odb_read_prefix); - -/* {{{ proto resource git_odb_read_header(type_out, db, id) -*/ -PHP_FUNCTION(git_odb_read_header); - -/* {{{ proto long git_odb_exists(db, id) -*/ -PHP_FUNCTION(git_odb_exists); - -/* {{{ proto long git_odb_refresh(db) -*/ -PHP_FUNCTION(git_odb_refresh); - -/* {{{ proto long git_odb_foreach(db, cb, payload) -*/ -PHP_FUNCTION(git_odb_foreach); - -/* {{{ proto resource git_odb_write(odb, data, len, type) -*/ -PHP_FUNCTION(git_odb_write); - -/* {{{ proto resource git_odb_open_wstream(db, size, type) -*/ -PHP_FUNCTION(git_odb_open_wstream); - -/* {{{ proto resource git_odb_stream_write(buffer, len) -*/ -PHP_FUNCTION(git_odb_stream_write); - -/* {{{ proto resource git_odb_stream_finalize_write(stream) -*/ -PHP_FUNCTION(git_odb_stream_finalize_write); - -/* {{{ proto long git_odb_stream_read(stream, buffer, len) -*/ -PHP_FUNCTION(git_odb_stream_read); - -/* {{{ proto void git_odb_stream_free(stream) -*/ -PHP_FUNCTION(git_odb_stream_free); - -/* {{{ proto resource git_odb_open_rstream(db, oid) -*/ -PHP_FUNCTION(git_odb_open_rstream); - -/* {{{ proto resource git_odb_write_pack(db, progress_cb, progress_payload) -*/ -PHP_FUNCTION(git_odb_write_pack); - -/* {{{ proto resource git_odb_hash(data, len, type) -*/ -PHP_FUNCTION(git_odb_hash); - -/* {{{ proto resource git_odb_hashfile(path, type) -*/ -PHP_FUNCTION(git_odb_hashfile); - -/* {{{ proto resource git_odb_object_dup(source) -*/ -PHP_FUNCTION(git_odb_object_dup); - -/* {{{ proto void git_odb_object_free(object) -*/ -PHP_FUNCTION(git_odb_object_free); - -/* {{{ proto resource git_odb_object_id(object) -*/ -PHP_FUNCTION(git_odb_object_id); - -/* {{{ proto resource git_odb_object_data(object) -*/ -PHP_FUNCTION(git_odb_object_data); - -/* {{{ proto resource git_odb_object_size(object) -*/ -PHP_FUNCTION(git_odb_object_size); - -/* {{{ proto resource git_odb_object_type(object) -*/ -PHP_FUNCTION(git_odb_object_type); - -/* {{{ proto long git_odb_add_backend(odb, backend, priority) -*/ -PHP_FUNCTION(git_odb_add_backend); - -/* {{{ proto long git_odb_add_alternate(odb, backend, priority) -*/ -PHP_FUNCTION(git_odb_add_alternate); - -/* {{{ proto resource git_odb_num_backends(odb) -*/ -PHP_FUNCTION(git_odb_num_backends); - -/* {{{ proto resource git_odb_get_backend(odb, pos) -*/ -PHP_FUNCTION(git_odb_get_backend); - -PHP_FUNCTION(git_odb_backend_new); - -#endif \ No newline at end of file diff --git a/packbuilder.c b/packbuilder.c deleted file mode 100644 index 4fafa08cb3..0000000000 --- a/packbuilder.c +++ /dev/null @@ -1,368 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "packbuilder.h" - -static int php_git2_git_packbuilder_progress( - int stage, - unsigned int current, - unsigned int total, - void *payload) -{ - zval *param_stage = NULL, *param_current = NULL, *param_total = NULL, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_stage); - MAKE_STD_ZVAL(param_current); - MAKE_STD_ZVAL(param_total); - ZVAL_LONG(param_stage, stage); - ZVAL_LONG(param_current, current); - ZVAL_LONG(param_total, total); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 4, - ¶m_stage, ¶m_current, ¶m_total, &p->payload)) { - return GIT_EUSER; - } - - if (retval_ptr) { - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - } - return retval; -} - -static int php_git2_git_packbuilder_foreach_cb(void *buf, size_t size, void *payload) -{ - zval *param_buf= NULL, *param_size = NULL, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_buf); - MAKE_STD_ZVAL(param_size); - ZVAL_STRINGL(param_buf, buf, size, 1); - ZVAL_LONG(param_size, size); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 3, - ¶m_buf, ¶m_size, &p->payload)) { - return GIT_EUSER; - } - - if (retval_ptr) { - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - } - return retval; -} - - -static int php_git2_git_transfer_progress_callback(const git_transfer_progress *stats, void *payload) -{ - zval *param_stats = NULL, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - php_git2_git_transfer_progress_to_array(stats, ¶m_stats TSRMLS_CC); - - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 2, - ¶m_stats, &p->payload)) { - return GIT_EUSER; - } - - if (retval_ptr) { - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - } - return retval; -} - -/* {{{ proto resource git_packbuilder_new(resource $repo) - */ -PHP_FUNCTION(git_packbuilder_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_packbuilder *out = NULL; - zval *repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_packbuilder_new(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_packbuilder_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PACKBUILDER, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_set_threads(resource $pb, long $n) - */ -PHP_FUNCTION(git_packbuilder_set_threads) -{ - unsigned int result = 0; - zval *pb = NULL; - php_git2_t *_pb = NULL; - long n = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &pb, &n) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_packbuilder_set_threads(PHP_GIT2_V(_pb, packbuilder), n); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_insert(resource $pb, string $id, string $name) - */ -PHP_FUNCTION(git_packbuilder_insert) -{ - int result = 0, id_len = 0, name_len = 0; - zval *pb = NULL; - php_git2_t *_pb = NULL; - char *id = NULL, *name = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &pb, &id, &id_len, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_packbuilder_insert(PHP_GIT2_V(_pb, packbuilder), &__id, name); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_insert_tree(resource $pb, string $id) - */ -PHP_FUNCTION(git_packbuilder_insert_tree) -{ - int result = 0, id_len = 0; - zval *pb = NULL; - php_git2_t *_pb = NULL; - char *id = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &pb, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_packbuilder_insert_tree(PHP_GIT2_V(_pb, packbuilder), &__id); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_insert_commit(resource $pb, string $id) - */ -PHP_FUNCTION(git_packbuilder_insert_commit) -{ - int result = 0, id_len = 0; - zval *pb = NULL; - php_git2_t *_pb = NULL; - char *id = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &pb, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_packbuilder_insert_commit(PHP_GIT2_V(_pb, packbuilder), &__id); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_write(resource $pb, string $path, long $mode, $progress_cb, $progress_cb_payload) - */ -PHP_FUNCTION(git_packbuilder_write) -{ - int result = 0, path_len = 0; - zval *pb = NULL, *progress_cb_payload = NULL; - php_git2_t *_pb = NULL; - char *path = NULL; - long mode = 0; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rslfz", &pb, &path, &path_len, &mode, &fci, &fcc, &progress_cb_payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, progress_cb_payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_packbuilder_write(PHP_GIT2_V(_pb, packbuilder), path, mode, php_git2_git_transfer_progress_callback, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_packbuilder_hash(resource $pb) - */ -PHP_FUNCTION(git_packbuilder_hash) -{ - const git_oid *result = NULL; - zval *pb = NULL; - php_git2_t *_pb = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &pb) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_packbuilder_hash(PHP_GIT2_V(_pb, packbuilder)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - - -/* {{{ proto long git_packbuilder_foreach(resource $pb, Callable $cb, $payload) - */ -PHP_FUNCTION(git_packbuilder_foreach) -{ - int result = 0; - zval *pb = NULL, *payload = NULL; - php_git2_t *_pb = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &pb, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_packbuilder_foreach(PHP_GIT2_V(_pb, packbuilder), php_git2_git_packbuilder_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_object_count(resource $pb) - */ -PHP_FUNCTION(git_packbuilder_object_count) -{ - uint32_t result = 0; - zval *pb = NULL; - php_git2_t *_pb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &pb) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_packbuilder_object_count(PHP_GIT2_V(_pb, packbuilder)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_written(resource $pb) - */ -PHP_FUNCTION(git_packbuilder_written) -{ - uint32_t result = 0; - zval *pb = NULL; - php_git2_t *_pb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &pb) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_packbuilder_written(PHP_GIT2_V(_pb, packbuilder)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_packbuilder_set_callbacks(resource $pb, $progress_cb, $progress_cb_payload) - */ -PHP_FUNCTION(git_packbuilder_set_callbacks) -{ - int result = 0; - zval *pb = NULL, *progress_cb_payload = NULL; - php_git2_t *_pb = NULL; - zend_fcall_info fci = empty_fcall_info, *_fci; - zend_fcall_info_cache fcc = empty_fcall_info_cache, *_fcc; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &pb, &fci, &fcc, &progress_cb_payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - _fci = emalloc(sizeof(zend_fcall_info)); - _fcc = emalloc(sizeof(zend_fcall_info_cache)); - memcpy(_fci, &fci, sizeof(zend_fcall_info)); - memcpy(_fcc, &fcc, sizeof(zend_fcall_info_cache)); - - /* TODO(chobie): free memory when the resource removed */ - if (php_git2_cb_init(&cb, &_fci, &_fcc, progress_cb_payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_packbuilder_set_callbacks(PHP_GIT2_V(_pb, packbuilder), php_git2_git_packbuilder_progress, cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_packbuilder_free(resource $pb) - */ -PHP_FUNCTION(git_packbuilder_free) -{ - zval *pb = NULL; - php_git2_t *_pb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &pb) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_pb, php_git2_t*, &pb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_pb)) { - git_packbuilder_free(PHP_GIT2_V(_pb, packbuilder)); - GIT2_SHOULD_FREE(_pb) = 0; - }; - zval_ptr_dtor(&pb); -} -/* }}} */ - diff --git a/packbuilder.h b/packbuilder.h deleted file mode 100644 index 5e8123f0de..0000000000 --- a/packbuilder.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_PACKBUILDER_H -#define PHP_GIT2_PACKBUILDER_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_new, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_set_threads, 0, 0, 2) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_insert, 0, 0, 3) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_insert_tree, 0, 0, 2) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_insert_commit, 0, 0, 2) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_write, 0, 0, 5) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, mode) - ZEND_ARG_INFO(0, progress_cb) - ZEND_ARG_INFO(1, progress_cb_payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_hash, 0, 0, 1) - ZEND_ARG_INFO(0, pb) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_object_count, 0, 0, 1) - ZEND_ARG_INFO(0, pb) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_written, 0, 0, 1) - ZEND_ARG_INFO(0, pb) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_set_callbacks, 0, 0, 3) - ZEND_ARG_INFO(0, pb) - ZEND_ARG_INFO(0, progress_cb) - ZEND_ARG_INFO(1, progress_cb_payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_packbuilder_free, 0, 0, 1) - ZEND_ARG_INFO(0, pb) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_packbuilder_new(repo) -*/ -PHP_FUNCTION(git_packbuilder_new); - -/* {{{ proto resource git_packbuilder_set_threads(pb, n) -*/ -PHP_FUNCTION(git_packbuilder_set_threads); - -/* {{{ proto long git_packbuilder_insert(pb, id, name) -*/ -PHP_FUNCTION(git_packbuilder_insert); - -/* {{{ proto long git_packbuilder_insert_tree(pb, id) -*/ -PHP_FUNCTION(git_packbuilder_insert_tree); - -/* {{{ proto long git_packbuilder_insert_commit(pb, id) -*/ -PHP_FUNCTION(git_packbuilder_insert_commit); - -/* {{{ proto resource git_packbuilder_write(path, mode, progress_cb, progress_cb_payload) -*/ -PHP_FUNCTION(git_packbuilder_write); - -/* {{{ proto resource git_packbuilder_hash(pb) -*/ -PHP_FUNCTION(git_packbuilder_hash); - -/* {{{ proto long git_packbuilder_foreach(pb, cb, payload) -*/ -PHP_FUNCTION(git_packbuilder_foreach); - -/* {{{ proto resource git_packbuilder_object_count(pb) -*/ -PHP_FUNCTION(git_packbuilder_object_count); - -/* {{{ proto resource git_packbuilder_written(pb) -*/ -PHP_FUNCTION(git_packbuilder_written); - -/* {{{ proto long git_packbuilder_set_callbacks(pb, progress_cb, progress_cb_payload) -*/ -PHP_FUNCTION(git_packbuilder_set_callbacks); - -/* {{{ proto void git_packbuilder_free(pb) -*/ -PHP_FUNCTION(git_packbuilder_free); - -#endif diff --git a/patch.c b/patch.c deleted file mode 100644 index 267025424c..0000000000 --- a/patch.c +++ /dev/null @@ -1,327 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "patch.h" - -/* {{{ proto resource git_patch_from_diff(resource $diff, long $idx) - */ -PHP_FUNCTION(git_patch_from_diff) -{ - php_git2_t *result = NULL, *_diff = NULL; - git_patch *out = NULL; - zval *diff = NULL; - long idx = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &diff, &idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_patch_from_diff(&out, PHP_GIT2_V(_diff, diff), idx); - if (php_git2_check_error(error, "git_patch_from_diff" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATCH, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_patch_from_blobs(resource $old_blob, string $old_as_path, resource $new_blob, string $new_as_path, $opts) - */ -PHP_FUNCTION(git_patch_from_blobs) -{ - php_git2_t *result = NULL, *_old_blob = NULL, *_new_blob = NULL; - git_patch *out = NULL; - git_diff_options options = GIT_DIFF_OPTIONS_INIT; - zval *old_blob = NULL, *new_blob = NULL, *opts = NULL; - char *old_as_path = NULL, *new_as_path = NULL; - int old_as_path_len = 0, new_as_path_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsrsa", &old_blob, &old_as_path, &old_as_path_len, &new_blob, &new_as_path, &new_as_path_len, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_old_blob, php_git2_t*, &old_blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_new_blob, php_git2_t*, &new_blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - error = git_patch_from_blobs(&out, PHP_GIT2_V(_old_blob, blob), old_as_path, PHP_GIT2_V(_new_blob, blob), new_as_path, &options); - php_git2_git_diff_options_free(&options); - if (php_git2_check_error(error, "git_patch_from_blobs" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATCH, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_patch_from_blob_and_buffer(resource $old_blob, string $old_as_path, string $buffer, string $buffer_as_path, $opts) - */ -PHP_FUNCTION(git_patch_from_blob_and_buffer) -{ - php_git2_t *result = NULL, *_old_blob = NULL; - git_patch *out = NULL; - zval *old_blob = NULL, *opts = NULL; - char *old_as_path = NULL, *buffer = NULL, *buffer_as_path = NULL; - int old_as_path_len = 0, buffer_len = 0, buffer_as_path_len = 0, error = 0; - git_diff_options options = GIT_DIFF_OPTIONS_INIT; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsslsa", &old_blob, &old_as_path, &old_as_path_len, &buffer, &buffer_len, &buffer_len, &buffer_as_path, &buffer_as_path_len, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_old_blob, php_git2_t*, &old_blob, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_array_to_git_diff_options(&options, opts TSRMLS_CC); - error = git_patch_from_blob_and_buffer(&out, PHP_GIT2_V(_old_blob, blob), old_as_path, buffer, buffer_len, buffer_as_path, &options); - php_git2_git_diff_options_free(&options); - if (php_git2_check_error(error, "git_patch_from_blob_and_buffer" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATCH, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto void git_patch_free(resource $patch) - */ -PHP_FUNCTION(git_patch_free) -{ - zval *patch = NULL; - php_git2_t *_patch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &patch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_patch)) { - git_patch_free(PHP_GIT2_V(_patch, patch)); - GIT2_SHOULD_FREE(_patch) = 0; - }; - zval_ptr_dtor(&patch); -} -/* }}} */ - - -/* {{{ proto resource git_patch_get_delta(resource $patch) - */ -PHP_FUNCTION(git_patch_get_delta) -{ - const git_diff_delta *result = NULL; - zval *patch = NULL, *out = NULL; - php_git2_t *_patch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &patch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_patch_get_delta(PHP_GIT2_V(_patch, patch)); - php_git2_diff_delta_to_array(result, &out TSRMLS_CC); - RETURN_ZVAL(out, 0, 1); -} -/* }}} */ - -/* {{{ proto long git_patch_num_hunks(resource $patch) - */ -PHP_FUNCTION(git_patch_num_hunks) -{ - size_t result = 0; - zval *patch = NULL; - php_git2_t *_patch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &patch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_patch_num_hunks(PHP_GIT2_V(_patch, patch)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_patch_line_stats(resource $patch) - */ -PHP_FUNCTION(git_patch_line_stats) -{ - int result = 0; - size_t total_context = 0, total_additions = 0, total_deletions = 0; - zval *patch = NULL, *out = NULL; - php_git2_t *_patch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &patch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_patch_line_stats(&total_context, &total_additions, &total_deletions, PHP_GIT2_V(_patch, patch)); - MAKE_STD_ZVAL(out); - array_init(out); - add_assoc_long_ex(out, ZEND_STRS("total_context"), total_context); - add_assoc_long_ex(out, ZEND_STRS("total_additions"), total_additions); - add_assoc_long_ex(out, ZEND_STRS("total_deletions"), total_deletions); - RETURN_ZVAL(out, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_patch_get_hunk(long $lines_in_hunk, resource $patch, long $hunk_idx) - */ -PHP_FUNCTION(git_patch_get_hunk) -{ - php_git2_t *result = NULL, *_patch = NULL; - git_diff_hunk *out = NULL; - long lines_in_hunk = 0, hunk_idx = 0; - zval *patch = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "lrl", &lines_in_hunk, &patch, &hunk_idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_patch_get_hunk(&out, lines_in_hunk, PHP_GIT2_V(_patch, patch), hunk_idx); - if (php_git2_check_error(error, "git_patch_get_hunk" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_DIFF_HUNK, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_patch_num_lines_in_hunk(resource $patch, long $hunk_idx) - */ -PHP_FUNCTION(git_patch_num_lines_in_hunk) -{ - int result = 0; - zval *patch = NULL; - php_git2_t *_patch = NULL; - long hunk_idx = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &patch, &hunk_idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_patch_num_lines_in_hunk(PHP_GIT2_V(_patch, patch), hunk_idx); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_patch_get_line_in_hunk(resource $patch, long $hunk_idx, long $line_of_hunk) - */ -PHP_FUNCTION(git_patch_get_line_in_hunk) -{ - php_git2_t *result = NULL, *_patch = NULL; - git_diff_line *out = NULL; - zval *patch = NULL; - long hunk_idx = 0, line_of_hunk = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rll", &patch, &hunk_idx, &line_of_hunk) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_patch_get_line_in_hunk(&out, PHP_GIT2_V(_patch, patch), hunk_idx, line_of_hunk); - if (php_git2_check_error(error, "git_patch_get_line_in_hunk" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_DIFF_LINE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_patch_size(resource $patch, long $include_context, long $include_hunk_headers, long $include_file_headers) - */ -PHP_FUNCTION(git_patch_size) -{ - size_t result = 0; - zval *patch = NULL; - php_git2_t *_patch = NULL; - long include_context = 0, include_hunk_headers = 0, include_file_headers = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlll", &patch, &include_context, &include_hunk_headers, &include_file_headers) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_patch_size(PHP_GIT2_V(_patch, patch), include_context, include_hunk_headers, include_file_headers); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_patch_print(resource $patch, Callable $print_cb, $payload) - */ -PHP_FUNCTION(git_patch_print) -{ - int result = 0; - zval *patch = NULL, *payload = NULL; - php_git2_t *_patch = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_multi_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &patch, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - php_git2_multi_cb_init(&cb, payload TSRMLS_CC, 3, - &empty_fcall_info, &empty_fcall_info_cache, - &empty_fcall_info, &empty_fcall_info_cache, - &fci, &fcc - ); - result = git_patch_print(PHP_GIT2_V(_patch, patch), php_git2_git_diff_line_cb, cb); - php_git2_multi_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_patch_to_str(resource $patch) - */ -PHP_FUNCTION(git_patch_to_str) -{ - int result = 0; - char *string = NULL; - zval *patch = NULL; - php_git2_t *_patch = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &patch) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_patch, php_git2_t*, &patch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_patch_to_str(&string, PHP_GIT2_V(_patch, patch)); - if (result != 0) { - RETURN_FALSE; - } - - RETVAL_STRING(string, 1); - free(string); -} -/* }}} */ diff --git a/patch.h b/patch.h deleted file mode 100644 index 2e666d9d22..0000000000 --- a/patch.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_PATCH_H -#define PHP_GIT2_PATCH_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_from_diff, 0, 0, 2) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, idx) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_from_blobs, 0, 0, 5) - ZEND_ARG_INFO(0, old_blob) - ZEND_ARG_INFO(0, old_as_path) - ZEND_ARG_INFO(0, new_blob) - ZEND_ARG_INFO(0, new_as_path) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_from_blob_and_buffer, 0, 0, 6) - ZEND_ARG_INFO(0, old_blob) - ZEND_ARG_INFO(0, old_as_path) - ZEND_ARG_INFO(0, buffer) - ZEND_ARG_INFO(0, buffer_len) - ZEND_ARG_INFO(0, buffer_as_path) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_free, 0, 0, 1) - ZEND_ARG_INFO(0, patch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_get_delta, 0, 0, 1) - ZEND_ARG_INFO(0, patch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_num_hunks, 0, 0, 1) - ZEND_ARG_INFO(0, patch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_line_stats, 0, 0, 4) - ZEND_ARG_INFO(0, total_context) - ZEND_ARG_INFO(0, total_additions) - ZEND_ARG_INFO(0, total_deletions) - ZEND_ARG_INFO(0, patch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_get_hunk, 0, 0, 3) - ZEND_ARG_INFO(0, lines_in_hunk) - ZEND_ARG_INFO(0, patch) - ZEND_ARG_INFO(0, hunk_idx) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_num_lines_in_hunk, 0, 0, 2) - ZEND_ARG_INFO(0, patch) - ZEND_ARG_INFO(0, hunk_idx) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_get_line_in_hunk, 0, 0, 3) - ZEND_ARG_INFO(0, patch) - ZEND_ARG_INFO(0, hunk_idx) - ZEND_ARG_INFO(0, line_of_hunk) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_size, 0, 0, 4) - ZEND_ARG_INFO(0, patch) - ZEND_ARG_INFO(0, include_context) - ZEND_ARG_INFO(0, include_hunk_headers) - ZEND_ARG_INFO(0, include_file_headers) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_print, 0, 0, 3) - ZEND_ARG_INFO(0, patch) - ZEND_ARG_INFO(0, print_cb) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_patch_to_str, 0, 0, 1) - ZEND_ARG_INFO(0, patch) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_patch_from_diff(diff, idx) -*/ -PHP_FUNCTION(git_patch_from_diff); - -/* {{{ proto resource git_patch_from_blobs(old_blob, old_as_path, new_blob, new_as_path, opts) -*/ -PHP_FUNCTION(git_patch_from_blobs); - -/* {{{ proto resource git_patch_from_blob_and_buffer(old_blob, old_as_path, buffer, buffer_len, buffer_as_path, opts) -*/ -PHP_FUNCTION(git_patch_from_blob_and_buffer); - -/* {{{ proto void git_patch_free(patch) -*/ -PHP_FUNCTION(git_patch_free); - -/* {{{ proto resource git_patch_get_delta(patch) -*/ -PHP_FUNCTION(git_patch_get_delta); - -/* {{{ proto resource git_patch_num_hunks(patch) -*/ -PHP_FUNCTION(git_patch_num_hunks); - -/* {{{ proto long git_patch_line_stats(total_context, total_additions, total_deletions, patch) -*/ -PHP_FUNCTION(git_patch_line_stats); - -/* {{{ proto resource git_patch_get_hunk(lines_in_hunk, patch, hunk_idx) -*/ -PHP_FUNCTION(git_patch_get_hunk); - -/* {{{ proto long git_patch_num_lines_in_hunk(patch, hunk_idx) -*/ -PHP_FUNCTION(git_patch_num_lines_in_hunk); - -/* {{{ proto resource git_patch_get_line_in_hunk(patch, hunk_idx, line_of_hunk) -*/ -PHP_FUNCTION(git_patch_get_line_in_hunk); - -/* {{{ proto resource git_patch_size(patch, include_context, include_hunk_headers, include_file_headers) -*/ -PHP_FUNCTION(git_patch_size); - -/* {{{ proto long git_patch_print(patch, print_cb, payload) -*/ -PHP_FUNCTION(git_patch_print); - -/* {{{ proto resource git_patch_to_str(patch) -*/ -PHP_FUNCTION(git_patch_to_str); - -#endif \ No newline at end of file diff --git a/pathspec.c b/pathspec.c deleted file mode 100644 index 05bc5b0470..0000000000 --- a/pathspec.c +++ /dev/null @@ -1,316 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "pathspec.h" - -/* {{{ proto resource git_pathspec_new(array $pathspec) - */ -PHP_FUNCTION(git_pathspec_new) -{ - php_git2_t *result = NULL; - git_pathspec *out = NULL; - zval *pathspec = NULL; - git_strarray _pathspec = {0}; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "a", &pathspec) == FAILURE) { - return; - } - - php_git2_array_to_strarray(&_pathspec, pathspec TSRMLS_CC); - error = git_pathspec_new(&out, &_pathspec); - php_git2_strarray_free(&_pathspec); - if (php_git2_check_error(error, "git_pathspec_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATHSPEC, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_pathspec_free(resource $ps) - */ -PHP_FUNCTION(git_pathspec_free) -{ - zval *ps = NULL; - php_git2_t *_ps = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ps) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ps, php_git2_t*, &ps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_ps)) { - git_pathspec_free(PHP_GIT2_V(_ps, pathspec)); - GIT2_SHOULD_FREE(_ps) = 0; - }; - zval_ptr_dtor(&ps); -} -/* }}} */ - - -/* {{{ proto long git_pathspec_matches_path(resource $ps, long $flags, string $path) - */ -PHP_FUNCTION(git_pathspec_matches_path) -{ - int result = 0, path_len = 0; - zval *ps = NULL; - php_git2_t *_ps = NULL; - long flags = 0; - char *path = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rls", &ps, &flags, &path, &path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ps, php_git2_t*, &ps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_pathspec_matches_path(PHP_GIT2_V(_ps, pathspec), flags, path); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_pathspec_match_workdir(resource $repo, long $flags, resource $ps) - */ -PHP_FUNCTION(git_pathspec_match_workdir) -{ - php_git2_t *result = NULL, *_repo = NULL, *_ps = NULL; - git_pathspec_match_list *out; - zval *repo = NULL, *ps = NULL; - long flags = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlr", &repo, &flags, &ps) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_ps, php_git2_t*, &ps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_pathspec_match_workdir(&out, PHP_GIT2_V(_repo, repository), flags, PHP_GIT2_V(_ps, pathspec)); - if (php_git2_check_error(error, "git_pathspec_match_workdir" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_pathspec_match_index(resource $index, long $flags, resource $ps) - */ -PHP_FUNCTION(git_pathspec_match_index) -{ - php_git2_t *result = NULL, *_index = NULL, *_ps = NULL; - git_pathspec_match_list *out = NULL; - zval *index = NULL, *ps = NULL; - long flags = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlr", &index, &flags, &ps) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_index, php_git2_t*, &index, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_ps, php_git2_t*, &ps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_pathspec_match_index(&out, PHP_GIT2_V(_index, index), flags, PHP_GIT2_V(_ps, pathspec)); - if (php_git2_check_error(error, "git_pathspec_match_index" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_pathspec_match_tree(resource $tree, long $flags, resource $ps) - */ -PHP_FUNCTION(git_pathspec_match_tree) -{ - php_git2_t *result = NULL, *_tree = NULL, *_ps = NULL; - git_pathspec_match_list *out = NULL; - zval *tree = NULL, *ps = NULL; - long flags = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlr", &tree, &flags, &ps) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_tree, php_git2_t*, &tree, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_ps, php_git2_t*, &ps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_pathspec_match_tree(&out, PHP_GIT2_V(_tree, tree), flags, PHP_GIT2_V(_ps, pathspec)); - if (php_git2_check_error(error, "git_pathspec_match_tree" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_pathspec_match_diff(resource $diff, long $flags, resource $ps) - */ -PHP_FUNCTION(git_pathspec_match_diff) -{ - php_git2_t *result = NULL, *_diff = NULL, *_ps = NULL; - git_pathspec_match_list *out = NULL; - zval *diff = NULL, *ps = NULL; - long flags = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rlr", &diff, &flags, &ps) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_diff, php_git2_t*, &diff, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_ps, php_git2_t*, &ps, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_pathspec_match_diff(&out, PHP_GIT2_V(_diff, diff), flags, PHP_GIT2_V(_ps, pathspec)); - if (php_git2_check_error(error, "git_pathspec_match_diff" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto void git_pathspec_match_list_free(resource $m) - */ -PHP_FUNCTION(git_pathspec_match_list_free) -{ - zval *m = NULL; - php_git2_t *_m = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_m, php_git2_t*, &m, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_m)) { - git_pathspec_match_list_free(PHP_GIT2_V(_m, pathspec_match_list)); - GIT2_SHOULD_FREE(_m) = 0; - }; - zval_ptr_dtor(&m); -} -/* }}} */ - - -/* {{{ proto long git_pathspec_match_list_entrycount(resource $m) - */ -PHP_FUNCTION(git_pathspec_match_list_entrycount) -{ - size_t result = 0; - zval *m = NULL; - php_git2_t *_m = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_m, php_git2_t*, &m, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_pathspec_match_list_entrycount(PHP_GIT2_V(_m, pathspec_match_list)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto string git_pathspec_match_list_entry(resource $m, long $pos) - */ -PHP_FUNCTION(git_pathspec_match_list_entry) -{ - const char *result = NULL; - zval *m = NULL; - php_git2_t *_m = NULL; - long pos = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &m, &pos) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_m, php_git2_t*, &m, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_pathspec_match_list_entry(PHP_GIT2_V(_m, pathspec_match_list), pos); - RETURN_STRING(result, 1); -} -/* }}} */ - - -/* {{{ proto resource git_pathspec_match_list_diff_entry(resource $m, long $pos) - */ -PHP_FUNCTION(git_pathspec_match_list_diff_entry) -{ - const git_diff_delta *result = NULL; - zval *m = NULL, *_result = NULL; - php_git2_t *_m = NULL; - long pos = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &m, &pos) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_m, php_git2_t*, &m, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_pathspec_match_list_diff_entry(PHP_GIT2_V(_m, pathspec_match_list), pos); - if (result == NULL) { - RETURN_FALSE; - } - php_git2_diff_delta_to_array(result, &_result TSRMLS_CC); - RETURN_ZVAL(_result, 0, 1); -} -/* }}} */ - - -/* {{{ proto long git_pathspec_match_list_failed_entrycount(resource $m) - */ -PHP_FUNCTION(git_pathspec_match_list_failed_entrycount) -{ - size_t result = 0; - zval *m = NULL; - php_git2_t *_m = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_m, php_git2_t*, &m, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_pathspec_match_list_failed_entrycount(PHP_GIT2_V(_m, pathspec_match_list)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto string git_pathspec_match_list_failed_entry(resource $m, long $pos) - */ -PHP_FUNCTION(git_pathspec_match_list_failed_entry) -{ - const char *result = NULL; - zval *m = NULL; - php_git2_t *_m = NULL; - long pos = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &m, &pos) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_m, php_git2_t*, &m, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_pathspec_match_list_failed_entry(PHP_GIT2_V(_m, pathspec_match_list), pos); - RETURN_STRING(result, 1); -} -/* }}} */ - diff --git a/pathspec.h b/pathspec.h deleted file mode 100644 index bc57b43009..0000000000 --- a/pathspec.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_PATHSPEC_H -#define PHP_GIT2_PATHSPEC_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_new, 0, 0, 1) - ZEND_ARG_INFO(0, pathspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_free, 0, 0, 1) - ZEND_ARG_INFO(0, ps) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_matches_path, 0, 0, 3) - ZEND_ARG_INFO(0, ps) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_workdir, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, ps) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_index, 0, 0, 3) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, ps) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_tree, 0, 0, 3) - ZEND_ARG_INFO(0, tree) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, ps) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_diff, 0, 0, 3) - ZEND_ARG_INFO(0, diff) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, ps) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_list_free, 0, 0, 1) - ZEND_ARG_INFO(0, m) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_list_entrycount, 0, 0, 1) - ZEND_ARG_INFO(0, m) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_list_entry, 0, 0, 2) - ZEND_ARG_INFO(0, m) - ZEND_ARG_INFO(0, pos) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_list_diff_entry, 0, 0, 2) - ZEND_ARG_INFO(0, m) - ZEND_ARG_INFO(0, pos) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_list_failed_entrycount, 0, 0, 1) - ZEND_ARG_INFO(0, m) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_pathspec_match_list_failed_entry, 0, 0, 2) - ZEND_ARG_INFO(0, m) - ZEND_ARG_INFO(0, pos) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_pathspec_new(pathspec) -*/ -PHP_FUNCTION(git_pathspec_new); - -/* {{{ proto void git_pathspec_free(ps) -*/ -PHP_FUNCTION(git_pathspec_free); - -/* {{{ proto long git_pathspec_matches_path(ps, flags, path) -*/ -PHP_FUNCTION(git_pathspec_matches_path); - -/* {{{ proto resource git_pathspec_match_workdir(repo, flags, ps) -*/ -PHP_FUNCTION(git_pathspec_match_workdir); - -/* {{{ proto resource git_pathspec_match_index(index, flags, ps) -*/ -PHP_FUNCTION(git_pathspec_match_index); - -/* {{{ proto resource git_pathspec_match_tree(tree, flags, ps) -*/ -PHP_FUNCTION(git_pathspec_match_tree); - -/* {{{ proto resource git_pathspec_match_diff(diff, flags, ps) -*/ -PHP_FUNCTION(git_pathspec_match_diff); - -/* {{{ proto void git_pathspec_match_list_free(m) -*/ -PHP_FUNCTION(git_pathspec_match_list_free); - -/* {{{ proto resource git_pathspec_match_list_entrycount(m) -*/ -PHP_FUNCTION(git_pathspec_match_list_entrycount); - -/* {{{ proto resource git_pathspec_match_list_entry(m, pos) -*/ -PHP_FUNCTION(git_pathspec_match_list_entry); - -/* {{{ proto resource git_pathspec_match_list_diff_entry(m, pos) -*/ -PHP_FUNCTION(git_pathspec_match_list_diff_entry); - -/* {{{ proto resource git_pathspec_match_list_failed_entrycount(m) -*/ -PHP_FUNCTION(git_pathspec_match_list_failed_entrycount); - -/* {{{ proto resource git_pathspec_match_list_failed_entry(m, pos) -*/ -PHP_FUNCTION(git_pathspec_match_list_failed_entry); - -#endif \ No newline at end of file diff --git a/php_git2.c b/php_git2.c deleted file mode 100644 index 033a987a8e..0000000000 --- a/php_git2.c +++ /dev/null @@ -1,1534 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "repository.h" -#include "commit.h" -#include "tree.h" -#include "clone.h" -#include "blob.h" -#include "revwalk.h" -#include "treebuilder.h" -#include "reference.h" -#include "g_config.h" -#include "object.h" -#include "index.h" -#include "revparse.h" -#include "branch.h" -#include "tag.h" -#include "status.h" -#include "cred.h" -#include "remote.h" -#include "transport.h" -#include "diff.h" -#include "checkout.h" -#include "filter.h" -#include "ignore.h" -#include "indexer.h" -#include "pathspec.h" -#include "patch.h" -#include "merge.h" -#include "note.h" -#include "odb.h" -#include "reflog.h" -#include "blame.h" -#include "packbuilder.h" -#include "stash.h" -#include "signature.h" -#include "reset.h" -#include "message.h" -#include "submodule.h" -#include "attr.h" -#include "giterr.h" -#include "push.h" -#include "refspec.h" -#include "graph.h" -#include "blame.h" - -int git2_resource_handle; - -zend_class_entry *php_git2_odb_backend_foreach_callback_class_entry; - -void static destruct_git2(zend_rsrc_list_entry *rsrc TSRMLS_DC) -{ - php_git2_t *resource = (php_git2_t *)rsrc->ptr; - if (resource->should_free_v) { - switch (resource->type) { - case PHP_GIT2_TYPE_REPOSITORY: - git_repository_free(PHP_GIT2_V(resource, repository)); - break; - case PHP_GIT2_TYPE_COMMIT: - git_commit_free(PHP_GIT2_V(resource, commit)); - break; - case PHP_GIT2_TYPE_TREE: - git_tree_free(PHP_GIT2_V(resource, tree)); - break; - case PHP_GIT2_TYPE_TREE_ENTRY: - git_tree_entry_free(PHP_GIT2_V(resource, tree_entry)); - break; - case PHP_GIT2_TYPE_BLOB: - git_blob_free(PHP_GIT2_V(resource, blob)); - break; - case PHP_GIT2_TYPE_REVWALK: - git_revwalk_free(PHP_GIT2_V(resource, revwalk)); - break; - case PHP_GIT2_TYPE_TREEBUILDER: - git_treebuilder_free(PHP_GIT2_V(resource, treebuilder)); - break; - case PHP_GIT2_TYPE_REFERENCE: - git_reference_free(PHP_GIT2_V(resource, reference)); - break; - case PHP_GIT2_TYPE_CONFIG: - git_config_free(PHP_GIT2_V(resource, config)); - break; - case PHP_GIT2_TYPE_OBJECT: - git_object_free(PHP_GIT2_V(resource, object)); - break; - case PHP_GIT2_TYPE_FILTER: - { - php_git2_filter *filter = (php_git2_filter*)PHP_GIT2_V(resource, filter); - zval_ptr_dtor(&filter->multi->payload); - php_git2_multi_cb_free(filter->multi); - efree(filter); - break; - } - case PHP_GIT2_TYPE_FILTER_LIST: - git_filter_list_free(PHP_GIT2_V(resource, filter_list)); - break; - case PHP_GIT2_TYPE_ODB_BACKEND: - { - php_git2_odb_backend *backend = (php_git2_odb_backend*)PHP_GIT2_V(resource, odb_backend); - zval_ptr_dtor(&backend->multi->payload); - php_git2_multi_cb_free(backend->multi); - efree(PHP_GIT2_V(resource, odb_backend)); - break; - } - } - } - - efree(resource); -} - -ZEND_DECLARE_MODULE_GLOBALS(git2); - -static zend_class_entry *php_git2_get_exception_base(TSRMLS_D) -{ -#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 2) - return zend_exception_get_default(); -#else - return zend_exception_get_default(TSRMLS_C); -#endif -} - -int php_git2_make_resource(php_git2_t **out, enum php_git2_resource_type type, void *resource, int should_free TSRMLS_DC) -{ - php_git2_t *result = NULL; - - PHP_GIT2_MAKE_RESOURCE_NOCHECK(result); - if (result == NULL) { - return 1; - } - - switch (type) { - case PHP_GIT2_TYPE_REPOSITORY: - PHP_GIT2_V(result, repository) = (git_repository*)resource; - break; - case PHP_GIT2_TYPE_COMMIT: - PHP_GIT2_V(result, commit) = (git_commit*)resource; - break; - case PHP_GIT2_TYPE_TREE: - PHP_GIT2_V(result, tree) = (git_tree*)resource; - break; - case PHP_GIT2_TYPE_TREE_ENTRY: - PHP_GIT2_V(result, tree_entry) = (git_tree_entry*)resource; - break; - case PHP_GIT2_TYPE_BLOB: - PHP_GIT2_V(result, blob) = (git_blob*)resource; - break; - case PHP_GIT2_TYPE_REVWALK: - PHP_GIT2_V(result, revwalk) = (git_revwalk*)resource; - break; - case PHP_GIT2_TYPE_TREEBUILDER: - PHP_GIT2_V(result, treebuilder) = (git_treebuilder*)resource; - break; - case PHP_GIT2_TYPE_REFERENCE: - PHP_GIT2_V(result, reference) = (git_reference*)resource; - break; - case PHP_GIT2_TYPE_REFERENCE_ITERATOR: - PHP_GIT2_V(result, reference_iterator) = (git_reference_iterator*)resource; - break; - case PHP_GIT2_TYPE_CONFIG: - PHP_GIT2_V(result, config) = (git_config*)resource; - break; - case PHP_GIT2_TYPE_CONFIG_ITERATOR: - PHP_GIT2_V(result, config_iterator) = (git_config_iterator*)resource; - break; - case PHP_GIT2_TYPE_OBJECT: - PHP_GIT2_V(result, object) = (git_object*)resource; - break; - case PHP_GIT2_TYPE_INDEX: - PHP_GIT2_V(result, index) = (git_index*)resource; - break; - case PHP_GIT2_TYPE_ODB: - PHP_GIT2_V(result, odb) = (git_odb*)resource; - break; - case PHP_GIT2_TYPE_REFDB: - PHP_GIT2_V(result, refdb) = (git_refdb*)resource; - break; - case PHP_GIT2_TYPE_STATUS_LIST: - PHP_GIT2_V(result, status_list) = (git_status_list*)resource; - break; - case PHP_GIT2_TYPE_BRANCH_ITERATOR: - PHP_GIT2_V(result, branch_iterator) = (git_branch_iterator*)resource; - break; - case PHP_GIT2_TYPE_TAG: - PHP_GIT2_V(result, tag) = (git_tag*)resource; - break; - case PHP_GIT2_TYPE_CRED: - PHP_GIT2_V(result, cred) = (git_cred*)resource; - break; - case PHP_GIT2_TYPE_TRANSPORT: - PHP_GIT2_V(result, transport) = (git_transport*)resource; - break; - case PHP_GIT2_TYPE_REMOTE: - PHP_GIT2_V(result, remote) = (git_remote*)resource; - break; - case PHP_GIT2_TYPE_DIFF: - PHP_GIT2_V(result, diff) = (git_diff*)resource; - break; - case PHP_GIT2_TYPE_MERGE_RESULT: - PHP_GIT2_V(result, merge_result) = (git_merge_result*)resource; - break; - case PHP_GIT2_TYPE_MERGE_HEAD: - PHP_GIT2_V(result, merge_head) = (git_merge_head*)resource; - break; - case PHP_GIT2_TYPE_PATHSPEC: - PHP_GIT2_V(result, pathspec) = (git_pathspec*)resource; - break; - case PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST: - PHP_GIT2_V(result, pathspec_match_list) = (git_pathspec_match_list*)resource; - break; - case PHP_GIT2_TYPE_PATCH: - PHP_GIT2_V(result, patch) = (git_patch*)resource; - break; - case PHP_GIT2_TYPE_DIFF_HUNK: - PHP_GIT2_V(result, diff_hunk) = (git_diff_hunk*)resource; - break; - case PHP_GIT2_TYPE_BUF: - PHP_GIT2_V(result, buf) = (git_buf*)resource; - break; - case PHP_GIT2_TYPE_FILTER_LIST: - PHP_GIT2_V(result, filter_list) = (git_filter_list*)resource; - break; - case PHP_GIT2_TYPE_FILTER_SOURCE: - PHP_GIT2_V(result, filter_source) = (git_filter_source*)resource; - break; - case PHP_GIT2_TYPE_DIFF_LINE: - PHP_GIT2_V(result, diff_line) = (git_diff_line*)resource; - break; - case PHP_GIT2_TYPE_INDEX_CONFLICT_ITERATOR: - PHP_GIT2_V(result, index_conflict_iterator) = (git_index_conflict_iterator*)resource; - break; - case PHP_GIT2_TYPE_SMART_SUBTRANSPORT: - PHP_GIT2_V(result, smart_subtransport) = (git_smart_subtransport*)resource; - break; - case PHP_GIT2_TYPE_NOTE: - PHP_GIT2_V(result, note) = (git_note*)resource; - break; - case PHP_GIT2_TYPE_NOTE_ITERATOR: - PHP_GIT2_V(result, note_iterator) = (git_note_iterator*)resource; - break; - case PHP_GIT2_TYPE_ODB_STREAM: - PHP_GIT2_V(result, odb_stream) = (git_odb_stream*)resource; - break; - case PHP_GIT2_TYPE_ODB_OBJECT: - PHP_GIT2_V(result, odb_object) = (git_odb_object*)resource; - break; - case PHP_GIT2_TYPE_ODB_WRITEPACK: - PHP_GIT2_V(result, odb_writepack) = (git_odb_writepack*)resource; - break; - case PHP_GIT2_TYPE_ODB_BACKEND: - PHP_GIT2_V(result, odb_backend) = (git_odb_backend*)resource; - break; - case PHP_GIT2_TYPE_REFLOG: - PHP_GIT2_V(result, reflog) = (git_reflog*)resource; - break; - case PHP_GIT2_TYPE_REFLOG_ENTRY: - PHP_GIT2_V(result, reflog_entry) = (git_reflog_entry*)resource; - break; - case PHP_GIT2_TYPE_BLAME: - PHP_GIT2_V(result, blame) = (git_blame*)resource; - break; - case PHP_GIT2_TYPE_PACKBUILDER: - PHP_GIT2_V(result, packbuilder) = (git_packbuilder*)resource; - break; - case PHP_GIT2_TYPE_SUBMODULE: - PHP_GIT2_V(result, submodule) = (git_submodule*)resource; - break; - case PHP_GIT2_TYPE_PUSH: - PHP_GIT2_V(result, push) = (git_push*)resource; - break; - case PHP_GIT2_TYPE_FILTER: - PHP_GIT2_V(result, filter) = (git_filter*)resource; - break; - default: - php_error_docref(NULL TSRMLS_CC, E_ERROR, "passed resource type does not support. probably bug."); - } - - result->type = type; - result->resource_id = PHP_GIT2_LIST_INSERT(result, git2_resource_handle); - result->should_free_v = should_free; - - *out = result; - return 0; -} - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_resource_type, 0, 0, 1) - ZEND_ARG_INFO(0, resource) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_resource_type(resource $git) - */ -PHP_FUNCTION(git_resource_type) -{ - zval *resource = NULL; - php_git2_t *_resource= NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &resource) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_resource, php_git2_t*, &resource, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - RETURN_LONG(_resource->type); -} -/* }}} */ - -PHP_FUNCTION(git_checkout_opts_new) -{ - zval *tmp; - git_checkout_opts opt = GIT_CHECKOUT_OPTS_INIT; - - php_git2_git_checkout_opts_to_array(&opt, &tmp TSRMLS_CC); - RETURN_ZVAL(tmp, 0, 1); -} - -PHP_FUNCTION(git_libgit2_capabilities) -{ - RETURN_LONG(git_libgit2_capabilities()); -} - - -PHP_FUNCTION(git_libgit2_version) -{ - char buf[32] = {0}; - int major, minor, rev; - - git_libgit2_version(&major, &minor, &rev); - snprintf(buf, 32, "%d.%d.%d", major, minor, rev); - - RETURN_STRING(buf, 1); -} - -static zend_function_entry php_git2_functions[] = { - /* repository */ - PHP_FE(git_repository_new, arginfo_git_repository_new) - PHP_FE(git_repository_init, arginfo_git_repository_init) - PHP_FE(git_repository_open_bare, arginfo_git_repository_open_bare) - PHP_FE(git_repository_open, arginfo_git_repository_open) - PHP_FE(git_repository_get_namespace, arginfo_git_repository_get_namespace) - PHP_FE(git_repository_workdir, arginfo_git_repository_workdir) - PHP_FE(git_repository_wrap_odb, arginfo_git_repository_wrap_odb) - PHP_FE(git_repository_discover, arginfo_git_repository_discover) - PHP_FE(git_repository_open_ext, arginfo_git_repository_open_ext) - PHP_FE(git_repository_free, arginfo_git_repository_free) - PHP_FE(git_repository_init_ext, arginfo_git_repository_init_ext) - PHP_FE(git_repository_head, arginfo_git_repository_head) - PHP_FE(git_repository_head_detached, arginfo_git_repository_head_detached) - PHP_FE(git_repository_head_unborn, arginfo_git_repository_head_unborn) - PHP_FE(git_repository_is_empty, arginfo_git_repository_is_empty) - PHP_FE(git_repository_path, arginfo_git_repository_path) - PHP_FE(git_repository_set_workdir, arginfo_git_repository_set_workdir) - PHP_FE(git_repository_is_bare, arginfo_git_repository_is_bare) - PHP_FE(git_repository_config, arginfo_git_repository_config) - PHP_FE(git_repository_odb, arginfo_git_repository_odb) - PHP_FE(git_repository_refdb, arginfo_git_repository_refdb) - PHP_FE(git_repository_index, arginfo_git_repository_index) - PHP_FE(git_repository_message, arginfo_git_repository_message) - PHP_FE(git_repository_message_remove, arginfo_git_repository_message_remove) - PHP_FE(git_repository_merge_cleanup, arginfo_git_repository_merge_cleanup) - PHP_FE(git_repository_fetchhead_foreach, arginfo_git_repository_fetchhead_foreach) - PHP_FE(git_repository_mergehead_foreach, arginfo_git_repository_mergehead_foreach) - PHP_FE(git_repository_hashfile, arginfo_git_repository_hashfile) - PHP_FE(git_repository_set_head, arginfo_git_repository_set_head) - PHP_FE(git_repository_set_head_detached, arginfo_git_repository_set_head_detached) - PHP_FE(git_repository_detach_head, arginfo_git_repository_detach_head) - PHP_FE(git_repository_state, arginfo_git_repository_state) - PHP_FE(git_repository_set_namespace, arginfo_git_repository_set_namespace) - PHP_FE(git_repository_is_shallow, arginfo_git_repository_is_shallow) - PHP_FE(git_repository_init_options_new, NULL) - - /* index */ - PHP_FE(git_index_open, arginfo_git_index_open) - PHP_FE(git_index_new, arginfo_git_index_new) - PHP_FE(git_index_free, arginfo_git_index_free) - PHP_FE(git_index_owner, arginfo_git_index_owner) - PHP_FE(git_index_caps, arginfo_git_index_caps) - PHP_FE(git_index_set_caps, arginfo_git_index_set_caps) - PHP_FE(git_index_read, arginfo_git_index_read) - PHP_FE(git_index_write, arginfo_git_index_write) - PHP_FE(git_index_path, arginfo_git_index_path) - PHP_FE(git_index_read_tree, arginfo_git_index_read_tree) - PHP_FE(git_index_write_tree, arginfo_git_index_write_tree) - PHP_FE(git_index_write_tree_to, arginfo_git_index_write_tree_to) - PHP_FE(git_index_entrycount, arginfo_git_index_entrycount) - PHP_FE(git_index_clear, arginfo_git_index_clear) - PHP_FE(git_index_get_byindex, arginfo_git_index_get_byindex) - PHP_FE(git_index_get_bypath, arginfo_git_index_get_bypath) - PHP_FE(git_index_remove, arginfo_git_index_remove) - PHP_FE(git_index_remove_directory, arginfo_git_index_remove_directory) - PHP_FE(git_index_add, arginfo_git_index_add) - PHP_FE(git_index_entry_stage, arginfo_git_index_entry_stage) - PHP_FE(git_index_add_bypath, arginfo_git_index_add_bypath) - PHP_FE(git_index_remove_bypath, arginfo_git_index_remove_bypath) - PHP_FE(git_index_add_all, arginfo_git_index_add_all) - PHP_FE(git_index_remove_all, arginfo_git_index_remove_all) - PHP_FE(git_index_update_all, arginfo_git_index_update_all) - PHP_FE(git_index_find, arginfo_git_index_find) - PHP_FE(git_index_conflict_add, arginfo_git_index_conflict_add) - PHP_FE(git_index_conflict_get, arginfo_git_index_conflict_get) - PHP_FE(git_index_conflict_remove, arginfo_git_index_conflict_remove) - PHP_FE(git_index_conflict_cleanup, arginfo_git_index_conflict_cleanup) - PHP_FE(git_index_has_conflicts, arginfo_git_index_has_conflicts) - PHP_FE(git_index_conflict_iterator_new, arginfo_git_index_conflict_iterator_new) - PHP_FE(git_index_conflict_next, arginfo_git_index_conflict_next) - PHP_FE(git_index_conflict_iterator_free, arginfo_git_index_conflict_iterator_free) - - /* object */ - PHP_FE(git_object_lookup, arginfo_git_object_lookup) - PHP_FE(git_object_lookup_prefix, arginfo_git_object_lookup_prefix) - PHP_FE(git_object_lookup_bypath, arginfo_git_object_lookup_bypath) - PHP_FE(git_object_id, arginfo_git_object_id) - PHP_FE(git_object_type, arginfo_git_object_type) - PHP_FE(git_object_owner, arginfo_git_object_owner) - PHP_FE(git_object_free, arginfo_git_object_free) - PHP_FE(git_object_type2string, arginfo_git_object_type2string) - PHP_FE(git_object_string2type, arginfo_git_object_string2type) - PHP_FE(git_object_typeisloose, arginfo_git_object_typeisloose) - PHP_FE(git_object__size, arginfo_git_object__size) - PHP_FE(git_object_peel, arginfo_git_object_peel) - PHP_FE(git_object_dup, arginfo_git_object_dup) - - /* clone */ - PHP_FE(git_clone, arginfo_git_clone) - - /* reference */ - PHP_FE(git_reference_lookup, arginfo_git_reference_lookup) - PHP_FE(git_reference_name_to_id, arginfo_git_reference_name_to_id) - PHP_FE(git_reference_dwim, arginfo_git_reference_dwim) - PHP_FE(git_reference_symbolic_create, arginfo_git_reference_symbolic_create) - PHP_FE(git_reference_create, arginfo_git_reference_create) - PHP_FE(git_reference_target, arginfo_git_reference_target) - PHP_FE(git_reference_target_peel, arginfo_git_reference_target_peel) - PHP_FE(git_reference_symbolic_target, arginfo_git_reference_symbolic_target) - PHP_FE(git_reference_type, arginfo_git_reference_type) - PHP_FE(git_reference_name, arginfo_git_reference_name) - PHP_FE(git_reference_resolve, arginfo_git_reference_resolve) - PHP_FE(git_reference_owner, arginfo_git_reference_owner) - PHP_FE(git_reference_symbolic_set_target, arginfo_git_reference_symbolic_set_target) - PHP_FE(git_reference_set_target, arginfo_git_reference_set_target) - PHP_FE(git_reference_rename, arginfo_git_reference_rename) - PHP_FE(git_reference_delete, arginfo_git_reference_delete) - PHP_FE(git_reference_list, arginfo_git_reference_list) - PHP_FE(git_reference_foreach, arginfo_git_reference_foreach) - PHP_FE(git_reference_foreach_name, arginfo_git_reference_foreach_name) - PHP_FE(git_reference_free, arginfo_git_reference_free) - PHP_FE(git_reference_cmp, arginfo_git_reference_cmp) - PHP_FE(git_reference_iterator_new, arginfo_git_reference_iterator_new) - PHP_FE(git_reference_iterator_glob_new, arginfo_git_reference_iterator_glob_new) - PHP_FE(git_reference_next, arginfo_git_reference_next) - PHP_FE(git_reference_next_name, arginfo_git_reference_next_name) - PHP_FE(git_reference_iterator_free, arginfo_git_reference_iterator_free) - PHP_FE(git_reference_foreach_glob, arginfo_git_reference_foreach_glob) - PHP_FE(git_reference_has_log, arginfo_git_reference_has_log) - PHP_FE(git_reference_is_branch, arginfo_git_reference_is_branch) - PHP_FE(git_reference_is_remote, arginfo_git_reference_is_remote) - PHP_FE(git_reference_is_tag, arginfo_git_reference_is_tag) - PHP_FE(git_reference_normalize_name, arginfo_git_reference_normalize_name) - PHP_FE(git_reference_peel, arginfo_git_reference_peel) - PHP_FE(git_reference_is_valid_name, arginfo_git_reference_is_valid_name) - PHP_FE(git_reference_shorthand, arginfo_git_reference_shorthand) - - /* commit */ - PHP_FE(git_commit_lookup, arginfo_git_commit_lookup) - PHP_FE(git_commit_author, arginfo_git_commit_author) - PHP_FE(git_commit_tree, arginfo_git_commit_tree) - PHP_FE(git_commit_lookup_prefix, arginfo_git_commit_lookup_prefix) - PHP_FE(git_commit_id, arginfo_git_commit_id) - PHP_FE(git_commit_owner, arginfo_git_commit_owner) - PHP_FE(git_commit_message_encoding, arginfo_git_commit_message_encoding) - PHP_FE(git_commit_message, arginfo_git_commit_message) - PHP_FE(git_commit_message_raw, arginfo_git_commit_message_raw) - PHP_FE(git_commit_time, arginfo_git_commit_time) - PHP_FE(git_commit_time_offset, arginfo_git_commit_time_offset) - PHP_FE(git_commit_committer, arginfo_git_commit_committer) - PHP_FE(git_commit_raw_header, arginfo_git_commit_raw_header) - PHP_FE(git_commit_tree_id, arginfo_git_commit_tree_id) - PHP_FE(git_commit_parentcount, arginfo_git_commit_parentcount) - PHP_FE(git_commit_parent, arginfo_git_commit_parent) - PHP_FE(git_commit_parent_id, arginfo_git_commit_parent_id) - PHP_FE(git_commit_nth_gen_ancestor, arginfo_git_commit_nth_gen_ancestor) - PHP_FE(git_commit_create, arginfo_git_commit_create) - - /* tree */ - PHP_FE(git_tree_free, arginfo_git_tree_free) - PHP_FE(git_tree_id, arginfo_git_tree_id) - PHP_FE(git_tree_lookup, arginfo_git_tree_lookup) - PHP_FE(git_tree_owner, arginfo_git_tree_owner) - PHP_FE(git_tree_walk, arginfo_git_tree_walk) - - PHP_FE(git_tree_entry_byoid, arginfo_git_tree_entry_byoid) - PHP_FE(git_tree_entry_byindex, arginfo_git_tree_entry_byindex) - PHP_FE(git_tree_entry_byname, arginfo_git_tree_entry_byname) - PHP_FE(git_tree_entry_bypath, arginfo_git_tree_entry_bypath) - PHP_FE(git_tree_entry_id, arginfo_git_tree_entry_id) - PHP_FE(git_tree_entry_name, arginfo_git_tree_entry_name) - PHP_FE(git_tree_entry_type, arginfo_git_tree_entry_type) - PHP_FE(git_tree_entrycount, arginfo_git_tree_entrycount) - PHP_FE(git_tree_entry_filemode, arginfo_git_tree_entry_filemode) - PHP_FE(git_tree_entry_filemode_raw, arginfo_git_tree_entry_filemode_raw) - PHP_FE(git_tree_entry_cmp, arginfo_git_tree_entry_cmp) - PHP_FE(git_tree_entry_free, arginfo_git_tree_entry_free) - PHP_FE(git_tree_entry_dup, arginfo_git_tree_entry_dup) - - /* treebuilder */ - PHP_FE(git_treebuilder_create, arginfo_git_treebuilder_create) - PHP_FE(git_treebuilder_clear, arginfo_git_treebuilder_clear) - PHP_FE(git_treebuilder_entrycount, arginfo_git_treebuilder_entrycount) - PHP_FE(git_treebuilder_free, arginfo_git_treebuilder_free) - PHP_FE(git_treebuilder_get, arginfo_git_treebuilder_get) - PHP_FE(git_treebuilder_insert, arginfo_git_treebuilder_insert) - PHP_FE(git_treebuilder_remove, arginfo_git_treebuilder_remove) - PHP_FE(git_treebuilder_filter, arginfo_git_treebuilder_filter) - PHP_FE(git_treebuilder_write, arginfo_git_treebuilder_write) - - /* blob */ - PHP_FE(git_blob_create_frombuffer, arginfo_git_blob_create_frombuffer) - PHP_FE(git_blob_create_fromchunks, arginfo_git_blob_create_fromchunks) - PHP_FE(git_blob_create_fromdisk, arginfo_git_blob_create_fromdisk) - PHP_FE(git_blob_create_fromworkdir, arginfo_git_blob_create_fromworkdir) - PHP_FE(git_blob_filtered_content, arginfo_git_blob_filtered_content) - PHP_FE(git_blob_free, arginfo_git_blob_free) - PHP_FE(git_blob_id, arginfo_git_blob_id) - PHP_FE(git_blob_is_binary, arginfo_git_blob_is_binary) - PHP_FE(git_blob_lookup, arginfo_git_blob_lookup) - PHP_FE(git_blob_lookup_prefix, arginfo_git_blob_lookup_prefix) - PHP_FE(git_blob_owner, arginfo_git_blob_owner) - PHP_FE(git_blob_rawcontent, arginfo_git_blob_rawcontent) - PHP_FE(git_blob_rawsize, arginfo_git_blob_rawsize) - - /* revwalk */ - PHP_FE(git_revwalk_new, arginfo_git_revwalk_new) - PHP_FE(git_revwalk_reset, arginfo_git_revwalk_reset) - PHP_FE(git_revwalk_push, arginfo_git_revwalk_push) - PHP_FE(git_revwalk_push_glob, arginfo_git_revwalk_push_glob) - PHP_FE(git_revwalk_push_head, arginfo_git_revwalk_push_head) - PHP_FE(git_revwalk_hide, arginfo_git_revwalk_hide) - PHP_FE(git_revwalk_hide_glob, arginfo_git_revwalk_hide_glob) - PHP_FE(git_revwalk_hide_head, arginfo_git_revwalk_hide_head) - PHP_FE(git_revwalk_push_ref, arginfo_git_revwalk_push_ref) - PHP_FE(git_revwalk_hide_ref, arginfo_git_revwalk_hide_ref) - PHP_FE(git_revwalk_next, arginfo_git_revwalk_next) - PHP_FE(git_revwalk_sorting, arginfo_git_revwalk_sorting) - PHP_FE(git_revwalk_push_range, arginfo_git_revwalk_push_range) - PHP_FE(git_revwalk_simplify_first_parent, arginfo_git_revwalk_simplify_first_parent) - PHP_FE(git_revwalk_free, arginfo_git_revwalk_free) - PHP_FE(git_revwalk_repository, arginfo_git_revwalk_repository) - - /* config */ - PHP_FE(git_config_find_global, arginfo_git_config_find_global) - PHP_FE(git_config_find_xdg, arginfo_git_config_find_xdg) - PHP_FE(git_config_find_system, arginfo_git_config_find_system) - PHP_FE(git_config_open_default, arginfo_git_config_open_default) - PHP_FE(git_config_new, arginfo_git_config_new) - PHP_FE(git_config_add_file_ondisk, arginfo_git_config_add_file_ondisk) - PHP_FE(git_config_open_ondisk, arginfo_git_config_open_ondisk) - PHP_FE(git_config_open_level, arginfo_git_config_open_level) - PHP_FE(git_config_open_global, arginfo_git_config_open_global) - PHP_FE(git_config_refresh, arginfo_git_config_refresh) - PHP_FE(git_config_free, arginfo_git_config_free) - PHP_FE(git_config_get_entry, arginfo_git_config_get_entry) - PHP_FE(git_config_get_int32, arginfo_git_config_get_int32) - PHP_FE(git_config_get_int64, arginfo_git_config_get_int64) - PHP_FE(git_config_get_bool, arginfo_git_config_get_bool) - PHP_FE(git_config_get_string, arginfo_git_config_get_string) - PHP_FE(git_config_get_multivar_foreach, arginfo_git_config_get_multivar_foreach) - PHP_FE(git_config_multivar_iterator_new, arginfo_git_config_multivar_iterator_new) - PHP_FE(git_config_next, arginfo_git_config_next) - PHP_FE(git_config_iterator_free, arginfo_git_config_iterator_free) - PHP_FE(git_config_set_int32, arginfo_git_config_set_int32) - PHP_FE(git_config_set_int64, arginfo_git_config_set_int64) - PHP_FE(git_config_set_bool, arginfo_git_config_set_bool) - PHP_FE(git_config_set_string, arginfo_git_config_set_string) - PHP_FE(git_config_set_multivar, arginfo_git_config_set_multivar) - PHP_FE(git_config_delete_entry, arginfo_git_config_delete_entry) - PHP_FE(git_config_delete_multivar, arginfo_git_config_delete_multivar) - PHP_FE(git_config_foreach, arginfo_git_config_foreach) - PHP_FE(git_config_iterator_new, arginfo_git_config_iterator_new) - PHP_FE(git_config_iterator_glob_new, arginfo_git_config_iterator_glob_new) - PHP_FE(git_config_foreach_match, arginfo_git_config_foreach_match) - PHP_FE(git_config_get_mapped, arginfo_git_config_get_mapped) - PHP_FE(git_config_lookup_map_value, arginfo_git_config_lookup_map_value) - PHP_FE(git_config_parse_bool, arginfo_git_config_parse_bool) - PHP_FE(git_config_parse_int32, arginfo_git_config_parse_int32) - PHP_FE(git_config_parse_int64, arginfo_git_config_parse_int64) - PHP_FE(git_config_backend_foreach_match, arginfo_git_config_backend_foreach_match) - - /* revparse */ - PHP_FE(git_revparse_single, arginfo_git_revparse_single) - PHP_FE(git_revparse_ext, arginfo_git_revparse_ext) - PHP_FE(git_revparse, arginfo_git_revparse) - - /* remote */ - PHP_FE(git_remote_create, arginfo_git_remote_create) - PHP_FE(git_remote_create_with_fetchspec, arginfo_git_remote_create_with_fetchspec) - PHP_FE(git_remote_create_inmemory, arginfo_git_remote_create_inmemory) - PHP_FE(git_remote_load, arginfo_git_remote_load) - PHP_FE(git_remote_save, arginfo_git_remote_save) - PHP_FE(git_remote_owner, arginfo_git_remote_owner) - PHP_FE(git_remote_name, arginfo_git_remote_name) - PHP_FE(git_remote_url, arginfo_git_remote_url) - PHP_FE(git_remote_pushurl, arginfo_git_remote_pushurl) - PHP_FE(git_remote_set_url, arginfo_git_remote_set_url) - PHP_FE(git_remote_set_pushurl, arginfo_git_remote_set_pushurl) - PHP_FE(git_remote_add_fetch, arginfo_git_remote_add_fetch) - PHP_FE(git_remote_get_fetch_refspecs, arginfo_git_remote_get_fetch_refspecs) - PHP_FE(git_remote_set_fetch_refspecs, arginfo_git_remote_set_fetch_refspecs) - PHP_FE(git_remote_add_push, arginfo_git_remote_add_push) - PHP_FE(git_remote_get_push_refspecs, arginfo_git_remote_get_push_refspecs) - PHP_FE(git_remote_set_push_refspecs, arginfo_git_remote_set_push_refspecs) - PHP_FE(git_remote_clear_refspecs, arginfo_git_remote_clear_refspecs) - PHP_FE(git_remote_refspec_count, arginfo_git_remote_refspec_count) - PHP_FE(git_remote_get_refspec, arginfo_git_remote_get_refspec) - PHP_FE(git_remote_connect, arginfo_git_remote_connect) - PHP_FE(git_remote_ls, arginfo_git_remote_ls) - PHP_FE(git_remote_download, arginfo_git_remote_download) - PHP_FE(git_remote_connected, arginfo_git_remote_connected) - PHP_FE(git_remote_stop, arginfo_git_remote_stop) - PHP_FE(git_remote_disconnect, arginfo_git_remote_disconnect) - PHP_FE(git_remote_free, arginfo_git_remote_free) - PHP_FE(git_remote_update_tips, arginfo_git_remote_update_tips) - PHP_FE(git_remote_fetch, arginfo_git_remote_fetch) - PHP_FE(git_remote_valid_url, arginfo_git_remote_valid_url) - PHP_FE(git_remote_supported_url, arginfo_git_remote_supported_url) - PHP_FE(git_remote_list, arginfo_git_remote_list) - PHP_FE(git_remote_check_cert, arginfo_git_remote_check_cert) - PHP_FE(git_remote_set_transport, arginfo_git_remote_set_transport) - PHP_FE(git_remote_set_callbacks, arginfo_git_remote_set_callbacks) - PHP_FE(git_remote_stats, arginfo_git_remote_stats) - PHP_FE(git_remote_autotag, arginfo_git_remote_autotag) - PHP_FE(git_remote_set_autotag, arginfo_git_remote_set_autotag) - PHP_FE(git_remote_rename, arginfo_git_remote_rename) - PHP_FE(git_remote_update_fetchhead, arginfo_git_remote_update_fetchhead) - PHP_FE(git_remote_set_update_fetchhead, arginfo_git_remote_set_update_fetchhead) - PHP_FE(git_remote_is_valid_name, arginfo_git_remote_is_valid_name) - - /* cred */ - PHP_FE(git_cred_has_username, arginfo_git_cred_has_username) - PHP_FE(git_cred_userpass_plaintext_new, arginfo_git_cred_userpass_plaintext_new) - PHP_FE(git_cred_ssh_key_new, arginfo_git_cred_ssh_key_new) - PHP_FE(git_cred_ssh_custom_new, arginfo_git_cred_ssh_custom_new) - PHP_FE(git_cred_default_new, arginfo_git_cred_default_new) - PHP_FE(git_cred_userpass, arginfo_git_cred_userpass) - - /* status */ - PHP_FE(git_status_foreach, arginfo_git_status_foreach) - PHP_FE(git_status_foreach_ext, arginfo_git_status_foreach_ext) - PHP_FE(git_status_file, arginfo_git_status_file) - PHP_FE(git_status_list_new, arginfo_git_status_list_new) - PHP_FE(git_status_list_entrycount, arginfo_git_status_list_entrycount) - PHP_FE(git_status_byindex, arginfo_git_status_byindex) - PHP_FE(git_status_list_free, arginfo_git_status_list_free) - PHP_FE(git_status_should_ignore, arginfo_git_status_should_ignore) - PHP_FE(git_status_options_new, NULL) - - /* transport */ - PHP_FE(git_transport_new, arginfo_git_transport_new) - PHP_FE(git_transport_register, arginfo_git_transport_register) - PHP_FE(git_transport_unregister, arginfo_git_transport_unregister) - PHP_FE(git_transport_dummy, arginfo_git_transport_dummy) - PHP_FE(git_transport_local, arginfo_git_transport_local) - PHP_FE(git_transport_smart, arginfo_git_transport_smart) - PHP_FE(git_smart_subtransport_http, arginfo_git_smart_subtransport_http) - PHP_FE(git_smart_subtransport_git, arginfo_git_smart_subtransport_git) - PHP_FE(git_smart_subtransport_ssh, arginfo_git_smart_subtransport_ssh) - - /* diff */ - PHP_FE(git_diff_free, arginfo_git_diff_free) - PHP_FE(git_diff_tree_to_tree, arginfo_git_diff_tree_to_tree) - PHP_FE(git_diff_tree_to_index, arginfo_git_diff_tree_to_index) - PHP_FE(git_diff_index_to_workdir, arginfo_git_diff_index_to_workdir) - PHP_FE(git_diff_tree_to_workdir, arginfo_git_diff_tree_to_workdir) - PHP_FE(git_diff_tree_to_workdir_with_index, arginfo_git_diff_tree_to_workdir_with_index) - PHP_FE(git_diff_merge, arginfo_git_diff_merge) - PHP_FE(git_diff_find_similar, arginfo_git_diff_find_similar) - PHP_FE(git_diff_options_init, arginfo_git_diff_options_init) - PHP_FE(git_diff_num_deltas, arginfo_git_diff_num_deltas) - PHP_FE(git_diff_num_deltas_of_type, arginfo_git_diff_num_deltas_of_type) - PHP_FE(git_diff_get_delta, arginfo_git_diff_get_delta) - PHP_FE(git_diff_is_sorted_icase, arginfo_git_diff_is_sorted_icase) - PHP_FE(git_diff_foreach, arginfo_git_diff_foreach) - PHP_FE(git_diff_status_char, arginfo_git_diff_status_char) - PHP_FE(git_diff_print, arginfo_git_diff_print) - PHP_FE(git_diff_blobs, arginfo_git_diff_blobs) - PHP_FE(git_diff_blob_to_buffer, arginfo_git_diff_blob_to_buffer) - - /* checkout */ - PHP_FE(git_checkout_head, arginfo_git_checkout_head) - PHP_FE(git_checkout_index, arginfo_git_checkout_index) - PHP_FE(git_checkout_tree, arginfo_git_checkout_tree) - - PHP_FE(git_checkout_opts_new, NULL) /* convention function */ - - /* filter */ - PHP_FE(git_filter_list_load, arginfo_git_filter_list_load) - PHP_FE(git_filter_list_apply_to_data, arginfo_git_filter_list_apply_to_data) - PHP_FE(git_filter_list_apply_to_file, arginfo_git_filter_list_apply_to_file) - PHP_FE(git_filter_list_apply_to_blob, arginfo_git_filter_list_apply_to_blob) - PHP_FE(git_filter_list_free, arginfo_git_filter_list_free) - PHP_FE(git_filter_lookup, arginfo_git_filter_lookup) - PHP_FE(git_filter_list_new, arginfo_git_filter_list_new) - PHP_FE(git_filter_list_push, arginfo_git_filter_list_push) - PHP_FE(git_filter_list_length, arginfo_git_filter_list_length) - PHP_FE(git_filter_source_repo, arginfo_git_filter_source_repo) - PHP_FE(git_filter_source_path, arginfo_git_filter_source_path) - PHP_FE(git_filter_source_filemode, arginfo_git_filter_source_filemode) - PHP_FE(git_filter_source_id, arginfo_git_filter_source_id) - PHP_FE(git_filter_source_mode, arginfo_git_filter_source_mode) - PHP_FE(git_filter_register, arginfo_git_filter_register) - PHP_FE(git_filter_unregister, arginfo_git_filter_unregister) - PHP_FE(git_filter_new, arginfo_git_filter_new) - - /* ignore */ - PHP_FE(git_ignore_add_rule, arginfo_git_ignore_add_rule) - PHP_FE(git_ignore_clear_internal_rules, arginfo_git_ignore_clear_internal_rules) - PHP_FE(git_ignore_path_is_ignored, arginfo_git_ignore_path_is_ignored) - - /* indexer */ - PHP_FE(git_indexer_new, arginfo_git_indexer_new) - PHP_FE(git_indexer_append, arginfo_git_indexer_append) - PHP_FE(git_indexer_commit, arginfo_git_indexer_commit) - PHP_FE(git_indexer_hash, arginfo_git_indexer_hash) - PHP_FE(git_indexer_free, arginfo_git_indexer_free) - - /* pathspec */ - PHP_FE(git_pathspec_new, arginfo_git_pathspec_new) - PHP_FE(git_pathspec_free, arginfo_git_pathspec_free) - PHP_FE(git_pathspec_matches_path, arginfo_git_pathspec_matches_path) - PHP_FE(git_pathspec_match_workdir, arginfo_git_pathspec_match_workdir) - PHP_FE(git_pathspec_match_index, arginfo_git_pathspec_match_index) - PHP_FE(git_pathspec_match_tree, arginfo_git_pathspec_match_tree) - PHP_FE(git_pathspec_match_diff, arginfo_git_pathspec_match_diff) - PHP_FE(git_pathspec_match_list_free, arginfo_git_pathspec_match_list_free) - PHP_FE(git_pathspec_match_list_entrycount, arginfo_git_pathspec_match_list_entrycount) - PHP_FE(git_pathspec_match_list_entry, arginfo_git_pathspec_match_list_entry) - PHP_FE(git_pathspec_match_list_diff_entry, arginfo_git_pathspec_match_list_diff_entry) - PHP_FE(git_pathspec_match_list_failed_entrycount, arginfo_git_pathspec_match_list_failed_entrycount) - PHP_FE(git_pathspec_match_list_failed_entry, arginfo_git_pathspec_match_list_failed_entry) - - /* patch */ - PHP_FE(git_patch_from_diff, arginfo_git_patch_from_diff) - PHP_FE(git_patch_from_blobs, arginfo_git_patch_from_blobs) - PHP_FE(git_patch_from_blob_and_buffer, arginfo_git_patch_from_blob_and_buffer) - PHP_FE(git_patch_free, arginfo_git_patch_free) - PHP_FE(git_patch_get_delta, arginfo_git_patch_get_delta) - PHP_FE(git_patch_num_hunks, arginfo_git_patch_num_hunks) - PHP_FE(git_patch_line_stats, arginfo_git_patch_line_stats) - PHP_FE(git_patch_get_hunk, arginfo_git_patch_get_hunk) - PHP_FE(git_patch_num_lines_in_hunk, arginfo_git_patch_num_lines_in_hunk) - PHP_FE(git_patch_get_line_in_hunk, arginfo_git_patch_get_line_in_hunk) - PHP_FE(git_patch_size, arginfo_git_patch_size) - PHP_FE(git_patch_print, arginfo_git_patch_print) - PHP_FE(git_patch_to_str, arginfo_git_patch_to_str) - - /* merge */ - PHP_FE(git_merge_base, arginfo_git_merge_base) - PHP_FE(git_merge_base_many, arginfo_git_merge_base_many) - PHP_FE(git_merge_head_from_ref, arginfo_git_merge_head_from_ref) - PHP_FE(git_merge_head_from_fetchhead, arginfo_git_merge_head_from_fetchhead) - PHP_FE(git_merge_head_from_oid, arginfo_git_merge_head_from_oid) - PHP_FE(git_merge_head_free, arginfo_git_merge_head_free) - PHP_FE(git_merge_trees, arginfo_git_merge_trees) - PHP_FE(git_merge, arginfo_git_merge) - PHP_FE(git_merge_result_is_uptodate, arginfo_git_merge_result_is_uptodate) - PHP_FE(git_merge_result_is_fastforward, arginfo_git_merge_result_is_fastforward) - PHP_FE(git_merge_result_fastforward_oid, arginfo_git_merge_result_fastforward_oid) - PHP_FE(git_merge_result_free, arginfo_git_merge_result_free) - - /* tag */ - PHP_FE(git_tag_lookup, arginfo_git_tag_lookup) - PHP_FE(git_tag_lookup_prefix, arginfo_git_tag_lookup_prefix) - PHP_FE(git_tag_free, arginfo_git_tag_free) - PHP_FE(git_tag_id, arginfo_git_tag_id) - PHP_FE(git_tag_owner, arginfo_git_tag_owner) - PHP_FE(git_tag_target, arginfo_git_tag_target) - PHP_FE(git_tag_target_id, arginfo_git_tag_target_id) - PHP_FE(git_tag_target_type, arginfo_git_tag_target_type) - PHP_FE(git_tag_name, arginfo_git_tag_name) - PHP_FE(git_tag_tagger, arginfo_git_tag_tagger) - PHP_FE(git_tag_message, arginfo_git_tag_message) - PHP_FE(git_tag_create, arginfo_git_tag_create) - PHP_FE(git_tag_annotation_create, arginfo_git_tag_annotation_create) - PHP_FE(git_tag_create_frombuffer, arginfo_git_tag_create_frombuffer) - PHP_FE(git_tag_create_lightweight, arginfo_git_tag_create_lightweight) - PHP_FE(git_tag_delete, arginfo_git_tag_delete) - PHP_FE(git_tag_list, arginfo_git_tag_list) - PHP_FE(git_tag_list_match, arginfo_git_tag_list_match) - PHP_FE(git_tag_foreach, arginfo_git_tag_foreach) - PHP_FE(git_tag_peel, arginfo_git_tag_peel) - - /* note */ - PHP_FE(git_note_iterator_new, arginfo_git_note_iterator_new) - PHP_FE(git_note_iterator_free, arginfo_git_note_iterator_free) - PHP_FE(git_note_next, arginfo_git_note_next) - PHP_FE(git_note_read, arginfo_git_note_read) - PHP_FE(git_note_message, arginfo_git_note_message) - PHP_FE(git_note_oid, arginfo_git_note_oid) - PHP_FE(git_note_create, arginfo_git_note_create) - PHP_FE(git_note_remove, arginfo_git_note_remove) - PHP_FE(git_note_free, arginfo_git_note_free) - PHP_FE(git_note_default_ref, arginfo_git_note_default_ref) - PHP_FE(git_note_foreach, arginfo_git_note_foreach) - - /* odb */ - PHP_FE(git_odb_new, arginfo_git_odb_new) - PHP_FE(git_odb_open, arginfo_git_odb_open) - PHP_FE(git_odb_add_disk_alternate, arginfo_git_odb_add_disk_alternate) - PHP_FE(git_odb_free, arginfo_git_odb_free) - PHP_FE(git_odb_read, arginfo_git_odb_read) - PHP_FE(git_odb_read_prefix, arginfo_git_odb_read_prefix) - PHP_FE(git_odb_read_header, arginfo_git_odb_read_header) - PHP_FE(git_odb_exists, arginfo_git_odb_exists) - PHP_FE(git_odb_refresh, arginfo_git_odb_refresh) - PHP_FE(git_odb_foreach, arginfo_git_odb_foreach) - PHP_FE(git_odb_write, arginfo_git_odb_write) - PHP_FE(git_odb_open_wstream, arginfo_git_odb_open_wstream) - PHP_FE(git_odb_stream_write, arginfo_git_odb_stream_write) - PHP_FE(git_odb_stream_finalize_write, arginfo_git_odb_stream_finalize_write) - PHP_FE(git_odb_stream_read, arginfo_git_odb_stream_read) - PHP_FE(git_odb_stream_free, arginfo_git_odb_stream_free) - PHP_FE(git_odb_open_rstream, arginfo_git_odb_open_rstream) - PHP_FE(git_odb_write_pack, arginfo_git_odb_write_pack) - PHP_FE(git_odb_hash, arginfo_git_odb_hash) - PHP_FE(git_odb_hashfile, arginfo_git_odb_hashfile) - PHP_FE(git_odb_object_dup, arginfo_git_odb_object_dup) - PHP_FE(git_odb_object_free, arginfo_git_odb_object_free) - PHP_FE(git_odb_object_id, arginfo_git_odb_object_id) - PHP_FE(git_odb_object_data, arginfo_git_odb_object_data) - PHP_FE(git_odb_object_size, arginfo_git_odb_object_size) - PHP_FE(git_odb_object_type, arginfo_git_odb_object_type) - PHP_FE(git_odb_add_backend, arginfo_git_odb_add_backend) - PHP_FE(git_odb_add_alternate, arginfo_git_odb_add_alternate) - PHP_FE(git_odb_num_backends, arginfo_git_odb_num_backends) - PHP_FE(git_odb_get_backend, arginfo_git_odb_get_backend) - - PHP_FE(git_odb_backend_new, arginfo_git_odb_backend_new) - - /* reflog */ - PHP_FE(git_reflog_read, arginfo_git_reflog_read) - PHP_FE(git_reflog_write, arginfo_git_reflog_write) - PHP_FE(git_reflog_append, arginfo_git_reflog_append) - PHP_FE(git_reflog_append_to, arginfo_git_reflog_append_to) - PHP_FE(git_reflog_rename, arginfo_git_reflog_rename) - PHP_FE(git_reflog_delete, arginfo_git_reflog_delete) - PHP_FE(git_reflog_entrycount, arginfo_git_reflog_entrycount) - PHP_FE(git_reflog_entry_byindex, arginfo_git_reflog_entry_byindex) - PHP_FE(git_reflog_drop, arginfo_git_reflog_drop) - PHP_FE(git_reflog_entry_id_old, arginfo_git_reflog_entry_id_old) - PHP_FE(git_reflog_entry_id_new, arginfo_git_reflog_entry_id_new) - PHP_FE(git_reflog_entry_committer, arginfo_git_reflog_entry_committer) - PHP_FE(git_reflog_entry_message, arginfo_git_reflog_entry_message) - PHP_FE(git_reflog_free, arginfo_git_reflog_free) - - /* packbuilder */ - PHP_FE(git_packbuilder_new, arginfo_git_packbuilder_new) - PHP_FE(git_packbuilder_set_threads, arginfo_git_packbuilder_set_threads) - PHP_FE(git_packbuilder_insert, arginfo_git_packbuilder_insert) - PHP_FE(git_packbuilder_insert_tree, arginfo_git_packbuilder_insert_tree) - PHP_FE(git_packbuilder_insert_commit, arginfo_git_packbuilder_insert_commit) - PHP_FE(git_packbuilder_write, arginfo_git_packbuilder_write) - PHP_FE(git_packbuilder_hash, arginfo_git_packbuilder_hash) - PHP_FE(git_packbuilder_foreach, arginfo_git_packbuilder_foreach) - PHP_FE(git_packbuilder_object_count, arginfo_git_packbuilder_object_count) - PHP_FE(git_packbuilder_written, arginfo_git_packbuilder_written) - PHP_FE(git_packbuilder_set_callbacks, arginfo_git_packbuilder_set_callbacks) - PHP_FE(git_packbuilder_free, arginfo_git_packbuilder_free) - - /* stash */ - PHP_FE(git_stash_save, arginfo_git_stash_save) - PHP_FE(git_stash_foreach, arginfo_git_stash_foreach) - PHP_FE(git_stash_drop, arginfo_git_stash_drop) - - /* signature */ - PHP_FE(git_signature_new, arginfo_git_signature_new) - PHP_FE(git_signature_now, arginfo_git_signature_now) - PHP_FE(git_signature_default, arginfo_git_signature_default) - - /* reset */ - PHP_FE(git_reset, arginfo_git_reset) - PHP_FE(git_reset_default, arginfo_git_reset_default) - - /* message */ - PHP_FE(git_message_prettify, arginfo_git_message_prettify) - - /* submodule */ - PHP_FE(git_submodule_lookup, arginfo_git_submodule_lookup) - PHP_FE(git_submodule_foreach, arginfo_git_submodule_foreach) - PHP_FE(git_submodule_add_setup, arginfo_git_submodule_add_setup) - PHP_FE(git_submodule_add_finalize, arginfo_git_submodule_add_finalize) - PHP_FE(git_submodule_add_to_index, arginfo_git_submodule_add_to_index) - PHP_FE(git_submodule_save, arginfo_git_submodule_save) - PHP_FE(git_submodule_owner, arginfo_git_submodule_owner) - PHP_FE(git_submodule_name, arginfo_git_submodule_name) - PHP_FE(git_submodule_path, arginfo_git_submodule_path) - PHP_FE(git_submodule_url, arginfo_git_submodule_url) - PHP_FE(git_submodule_set_url, arginfo_git_submodule_set_url) - PHP_FE(git_submodule_index_id, arginfo_git_submodule_index_id) - PHP_FE(git_submodule_head_id, arginfo_git_submodule_head_id) - PHP_FE(git_submodule_wd_id, arginfo_git_submodule_wd_id) - PHP_FE(git_submodule_ignore, arginfo_git_submodule_ignore) - PHP_FE(git_submodule_set_ignore, arginfo_git_submodule_set_ignore) - PHP_FE(git_submodule_update, arginfo_git_submodule_update) - PHP_FE(git_submodule_set_update, arginfo_git_submodule_set_update) - PHP_FE(git_submodule_fetch_recurse_submodules, arginfo_git_submodule_fetch_recurse_submodules) - PHP_FE(git_submodule_set_fetch_recurse_submodules, arginfo_git_submodule_set_fetch_recurse_submodules) - PHP_FE(git_submodule_init, arginfo_git_submodule_init) - PHP_FE(git_submodule_sync, arginfo_git_submodule_sync) - PHP_FE(git_submodule_open, arginfo_git_submodule_open) - PHP_FE(git_submodule_reload, arginfo_git_submodule_reload) - PHP_FE(git_submodule_reload_all, arginfo_git_submodule_reload_all) - PHP_FE(git_submodule_status, arginfo_git_submodule_status) - PHP_FE(git_submodule_location, arginfo_git_submodule_location) - - /* attr */ - PHP_FE(git_attr_value, arginfo_git_attr_value) - PHP_FE(git_attr_get, arginfo_git_attr_get) - PHP_FE(git_attr_get_many, arginfo_git_attr_get_many) - PHP_FE(git_attr_foreach, arginfo_git_attr_foreach) - PHP_FE(git_attr_cache_flush, arginfo_git_attr_cache_flush) - PHP_FE(git_attr_add_macro, arginfo_git_attr_add_macro) - - /* giterr */ - PHP_FE(giterr_last, arginfo_giterr_last) - PHP_FE(giterr_clear, arginfo_giterr_clear) - PHP_FE(giterr_detach, arginfo_giterr_detach) - PHP_FE(giterr_set_str, arginfo_giterr_set_str) - PHP_FE(giterr_set_oom, arginfo_giterr_set_oom) - - /* push */ - PHP_FE(git_push_new, arginfo_git_push_new) - PHP_FE(git_push_set_options, arginfo_git_push_set_options) - PHP_FE(git_push_set_callbacks, arginfo_git_push_set_callbacks) - PHP_FE(git_push_add_refspec, arginfo_git_push_add_refspec) - PHP_FE(git_push_update_tips, arginfo_git_push_update_tips) - PHP_FE(git_push_finish, arginfo_git_push_finish) - PHP_FE(git_push_unpack_ok, arginfo_git_push_unpack_ok) - PHP_FE(git_push_status_foreach, arginfo_git_push_status_foreach) - PHP_FE(git_push_free, arginfo_git_push_free) - - /* refspec */ - PHP_FE(git_refspec_src, arginfo_git_refspec_src) - PHP_FE(git_refspec_dst, arginfo_git_refspec_dst) - PHP_FE(git_refspec_string, arginfo_git_refspec_string) - PHP_FE(git_refspec_force, arginfo_git_refspec_force) - PHP_FE(git_refspec_direction, arginfo_git_refspec_direction) - PHP_FE(git_refspec_src_matches, arginfo_git_refspec_src_matches) - PHP_FE(git_refspec_dst_matches, arginfo_git_refspec_dst_matches) - PHP_FE(git_refspec_transform, arginfo_git_refspec_transform) - PHP_FE(git_refspec_rtransform, arginfo_git_refspec_rtransform) - - /* graph */ - PHP_FE(git_graph_ahead_behind, arginfo_git_graph_ahead_behind) - - /* blame */ - PHP_FE(git_blame_get_hunk_count, arginfo_git_blame_get_hunk_count) - PHP_FE(git_blame_get_hunk_byindex, arginfo_git_blame_get_hunk_byindex) - PHP_FE(git_blame_get_hunk_byline, arginfo_git_blame_get_hunk_byline) - PHP_FE(git_blame_file, arginfo_git_blame_file) - PHP_FE(git_blame_buffer, arginfo_git_blame_buffer) - PHP_FE(git_blame_free, arginfo_git_blame_free) - PHP_FE(git_blame_options_new, arginfo_git_blame_options_new) - - /* misc */ - PHP_FE(git_resource_type, arginfo_git_resource_type) - PHP_FE(git_libgit2_capabilities, NULL) - PHP_FE(git_libgit2_version, NULL) - PHP_FE_END -}; - -PHP_MINFO_FUNCTION(git2) -{ - char buf[32] = {0}; - int major, minor, rev; - - php_printf("PHP Git2 Extension\n"); - - git_libgit2_version(&major, &minor, &rev); - snprintf(buf, 32, "%d.%d.%d", major, minor, rev); - - php_info_print_table_start(); - php_info_print_table_header(2, "Git2 Support", "enabled"); - php_info_print_table_header(2, "libgit2 version", buf); - php_info_print_table_end(); -} - -PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("git2.dummy", "1", PHP_INI_ALL, OnUpdateLong, dummy, zend_git2_globals, git2_globals) -PHP_INI_END() - -static PHP_GINIT_FUNCTION(git2) -{ -} - -static PHP_GSHUTDOWN_FUNCTION(git2) -{ -} - - -static void php_git2_odb_backend_foreach_callback_free_storage(php_git2_odb_backend_foreach_callback *object TSRMLS_DC) -{ - zend_object_std_dtor(&object->zo TSRMLS_CC); - efree(object); -} - -zend_object_value php_git2_odb_backend_foreach_callback_new(zend_class_entry *ce TSRMLS_DC) -{ - zend_object_value retval; - PHP_GIT2_STD_CREATE_OBJECT(php_git2_odb_backend_foreach_callback); - return retval; -} - -PHP_MINIT_FUNCTION(git2) -{ - zend_class_entry ce; - REGISTER_INI_ENTRIES(); - - - INIT_CLASS_ENTRY(ce, "Git2ODBBackendForeachCallback", 0); - php_git2_odb_backend_foreach_callback_class_entry = zend_register_internal_class(&ce TSRMLS_CC); - zend_register_class_alias_ex(ZEND_NS_NAME("Git2\\ODB\\Backend", "ForeachCallback"), sizeof(ZEND_NS_NAME("Git2\\ODB\\Backend", "ForeachCallback"))-1, php_git2_odb_backend_foreach_callback_class_entry TSRMLS_CC); - php_git2_odb_backend_foreach_callback_class_entry->create_object = php_git2_odb_backend_foreach_callback_new; - - git2_resource_handle = zend_register_list_destructors_ex(destruct_git2, NULL, PHP_GIT2_RESOURCE_NAME, module_number); - - REGISTER_LONG_CONSTANT("GIT_TYPE_REPOSITORY", PHP_GIT2_TYPE_REPOSITORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_COMMIT", PHP_GIT2_TYPE_COMMIT,CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_TREE", PHP_GIT2_TYPE_TREE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_TREE_ENTRY", PHP_GIT2_TYPE_TREE_ENTRY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_BLOB", PHP_GIT2_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_REVWALK", PHP_GIT2_TYPE_REVWALK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_TREEBUILDER", PHP_GIT2_TYPE_TREEBUILDER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_REFERENCE", PHP_GIT2_TYPE_REFERENCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_CONFIG", PHP_GIT2_TYPE_CONFIG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_OBJECT", PHP_GIT2_TYPE_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_INDEX", PHP_GIT2_TYPE_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_ODB", PHP_GIT2_TYPE_ODB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_REFDB", PHP_GIT2_TYPE_REFDB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_BRANCH_ITERATOR", PHP_GIT2_TYPE_BRANCH_ITERATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_TAG", PHP_GIT2_TYPE_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_CRED", PHP_GIT2_TYPE_CRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_TRANSPORT", PHP_GIT2_TYPE_TRANSPORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_REMOTE", PHP_GIT2_TYPE_REMOTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_DIFF", PHP_GIT2_TYPE_DIFF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_MERGE_RESULT", PHP_GIT2_TYPE_MERGE_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_MERGE_HEAD", PHP_GIT2_TYPE_MERGE_HEAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_PATHSPEC", PHP_GIT2_TYPE_PATHSPEC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_PATHSPEC_MATCH_LIST", PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_PATCH", PHP_GIT2_TYPE_PATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_DIFF_HUNK", PHP_GIT2_TYPE_DIFF_HUNK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_STATUS_LIST", PHP_GIT2_TYPE_STATUS_LIST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_BUF", PHP_GIT2_TYPE_BUF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_FILTER_LIST", PHP_GIT2_TYPE_FILTER_LIST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_FILTER_SOURCE", PHP_GIT2_TYPE_FILTER_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TYPE_DIFF_LINE", PHP_GIT2_TYPE_DIFF_LINE, CONST_CS | CONST_PERSISTENT); - - /* git_ref_t */ - REGISTER_LONG_CONSTANT("GIT_REF_INVALID", GIT_REF_INVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REF_OID", GIT_REF_OID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REF_SYMBOLIC", GIT_REF_SYMBOLIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REF_LISTALL", GIT_REF_LISTALL, CONST_CS | CONST_PERSISTENT); - /* git_branch_t */ - REGISTER_LONG_CONSTANT("GIT_BRANCH_LOCAL", GIT_BRANCH_LOCAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_BRANCH_REMOTE", GIT_BRANCH_REMOTE, CONST_CS | CONST_PERSISTENT); - /* git_filemode_t */ - REGISTER_LONG_CONSTANT("GIT_FILEMODE_NEW", GIT_FILEMODE_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILEMODE_TREE", GIT_FILEMODE_TREE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILEMODE_BLOB", GIT_FILEMODE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILEMODE_BLOB_EXECUTABLE", GIT_FILEMODE_BLOB_EXECUTABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILEMODE_LINK", GIT_FILEMODE_LINK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILEMODE_COMMIT", GIT_FILEMODE_COMMIT, CONST_CS | CONST_PERSISTENT); - /* git_submodule_update_t */ - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_UPDATE_RESET", GIT_SUBMODULE_UPDATE_RESET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_UPDATE_CHECKOUT", GIT_SUBMODULE_UPDATE_CHECKOUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_UPDATE_REBASE", GIT_SUBMODULE_UPDATE_REBASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_UPDATE_MERGE", GIT_SUBMODULE_UPDATE_MERGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_UPDATE_NONE", GIT_SUBMODULE_UPDATE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_UPDATE_DEFAULT", GIT_SUBMODULE_UPDATE_DEFAULT, CONST_CS | CONST_PERSISTENT); - /* git_submodule_ignore_t */ - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_IGNORE_RESET", GIT_SUBMODULE_IGNORE_RESET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_IGNORE_NONE", GIT_SUBMODULE_IGNORE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_IGNORE_UNTRACKED", GIT_SUBMODULE_IGNORE_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_IGNORE_DIRTY", GIT_SUBMODULE_IGNORE_DIRTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_IGNORE_ALL", GIT_SUBMODULE_IGNORE_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_IGNORE_DEFAULT", GIT_SUBMODULE_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); - - /* git_attr_t */ - REGISTER_LONG_CONSTANT("GIT_ATTR_UNSPECIFIED_T", GIT_ATTR_UNSPECIFIED_T, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ATTR_TRUE_T", GIT_ATTR_TRUE_T, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ATTR_FALSE_T", GIT_ATTR_FALSE_T, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ATTR_VALUE_T", GIT_ATTR_VALUE_T, CONST_CS | CONST_PERSISTENT); - - /* git_blame_flag_t */ - REGISTER_LONG_CONSTANT("GIT_BLAME_NORMAL", GIT_BLAME_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_BLAME_TRACK_COPIES_SAME_FILE", GIT_BLAME_TRACK_COPIES_SAME_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES", GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES", GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES", GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES, CONST_CS | CONST_PERSISTENT); - - /* git_checkout_strategy_t */ - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NONE", GIT_CHECKOUT_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_SAFE", GIT_CHECKOUT_SAFE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_SAFE_CREATE", GIT_CHECKOUT_SAFE_CREATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_FORCE", GIT_CHECKOUT_FORCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_ALLOW_CONFLICTS", GIT_CHECKOUT_ALLOW_CONFLICTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_REMOVE_UNTRACKED", GIT_CHECKOUT_REMOVE_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_REMOVE_IGNORED", GIT_CHECKOUT_REMOVE_IGNORED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_UPDATE_ONLY", GIT_CHECKOUT_UPDATE_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_DONT_UPDATE_INDEX", GIT_CHECKOUT_DONT_UPDATE_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NO_REFRESH", GIT_CHECKOUT_NO_REFRESH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_SKIP_UNMERGED", GIT_CHECKOUT_SKIP_UNMERGED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_USE_OURS", GIT_CHECKOUT_USE_OURS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_USE_THEIRS", GIT_CHECKOUT_USE_THEIRS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH", GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES", GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_UPDATE_SUBMODULES", GIT_CHECKOUT_UPDATE_SUBMODULES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED", GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED, CONST_CS | CONST_PERSISTENT); - - /* git_checkout_notify_t */ - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_NONE", GIT_CHECKOUT_NOTIFY_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_CONFLICT", GIT_CHECKOUT_NOTIFY_CONFLICT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_DIRTY", GIT_CHECKOUT_NOTIFY_DIRTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_UPDATED", GIT_CHECKOUT_NOTIFY_UPDATED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_UNTRACKED", GIT_CHECKOUT_NOTIFY_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_IGNORED", GIT_CHECKOUT_NOTIFY_IGNORED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CHECKOUT_NOTIFY_ALL", GIT_CHECKOUT_NOTIFY_ALL, CONST_CS | CONST_PERSISTENT); - - /* git_cap_t */ - REGISTER_LONG_CONSTANT("GIT_CAP_THREADS", GIT_CAP_THREADS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CAP_HTTPS", GIT_CAP_HTTPS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CAP_SSH", GIT_CAP_SSH, CONST_CS | CONST_PERSISTENT); - - /* git_libgit2_opt_t */ - REGISTER_LONG_CONSTANT("GIT_OPT_GET_MWINDOW_SIZE", GIT_OPT_GET_MWINDOW_SIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_SET_MWINDOW_SIZE", GIT_OPT_SET_MWINDOW_SIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_GET_MWINDOW_MAPPED_LIMIT", GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_SET_MWINDOW_MAPPED_LIMIT", GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_GET_SEARCH_PATH", GIT_OPT_GET_SEARCH_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_SET_SEARCH_PATH", GIT_OPT_SET_SEARCH_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_SET_CACHE_OBJECT_LIMIT", GIT_OPT_SET_CACHE_OBJECT_LIMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_SET_CACHE_MAX_SIZE", GIT_OPT_SET_CACHE_MAX_SIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_ENABLE_CACHING", GIT_OPT_ENABLE_CACHING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_GET_CACHED_MEMORY", GIT_OPT_GET_CACHED_MEMORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_GET_TEMPLATE_PATH", GIT_OPT_GET_TEMPLATE_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OPT_SET_TEMPLATE_PATH", GIT_OPT_SET_TEMPLATE_PATH, CONST_CS | CONST_PERSISTENT); - - /* git_config_level_t */ - REGISTER_LONG_CONSTANT("GIT_CONFIG_LEVEL_SYSTEM", GIT_CONFIG_LEVEL_SYSTEM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CONFIG_LEVEL_XDG", GIT_CONFIG_LEVEL_XDG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CONFIG_LEVEL_GLOBAL", GIT_CONFIG_LEVEL_GLOBAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CONFIG_LEVEL_LOCAL", GIT_CONFIG_LEVEL_LOCAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CONFIG_LEVEL_APP", GIT_CONFIG_LEVEL_APP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CONFIG_HIGHEST_LEVEL", GIT_CONFIG_HIGHEST_LEVEL, CONST_CS | CONST_PERSISTENT); - - /* git_cvar_t */ - REGISTER_LONG_CONSTANT("GIT_CVAR_FALSE", GIT_CVAR_FALSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CVAR_TRUE", GIT_CVAR_TRUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CVAR_INT32", GIT_CVAR_INT32, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CVAR_STRING", GIT_CVAR_STRING, CONST_CS | CONST_PERSISTENT); - - /* git_diff_option_t */ - REGISTER_LONG_CONSTANT("GIT_DIFF_NORMAL", GIT_DIFF_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_REVERSE", GIT_DIFF_REVERSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_INCLUDE_IGNORED", GIT_DIFF_INCLUDE_IGNORED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_RECURSE_IGNORED_DIRS", GIT_DIFF_RECURSE_IGNORED_DIRS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_INCLUDE_UNTRACKED", GIT_DIFF_INCLUDE_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_RECURSE_UNTRACKED_DIRS", GIT_DIFF_RECURSE_UNTRACKED_DIRS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_INCLUDE_UNMODIFIED", GIT_DIFF_INCLUDE_UNMODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_INCLUDE_TYPECHANGE", GIT_DIFF_INCLUDE_TYPECHANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_INCLUDE_TYPECHANGE_TREES", GIT_DIFF_INCLUDE_TYPECHANGE_TREES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_IGNORE_FILEMODE", GIT_DIFF_IGNORE_FILEMODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_IGNORE_SUBMODULES", GIT_DIFF_IGNORE_SUBMODULES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_IGNORE_CASE", GIT_DIFF_IGNORE_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_DISABLE_PATHSPEC_MATCH", GIT_DIFF_DISABLE_PATHSPEC_MATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_SKIP_BINARY_CHECK", GIT_DIFF_SKIP_BINARY_CHECK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS", GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FORCE_TEXT", GIT_DIFF_FORCE_TEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FORCE_BINARY", GIT_DIFF_FORCE_BINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_IGNORE_WHITESPACE", GIT_DIFF_IGNORE_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_IGNORE_WHITESPACE_CHANGE", GIT_DIFF_IGNORE_WHITESPACE_CHANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_IGNORE_WHITESPACE_EOL", GIT_DIFF_IGNORE_WHITESPACE_EOL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_SHOW_UNTRACKED_CONTENT", GIT_DIFF_SHOW_UNTRACKED_CONTENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_SHOW_UNMODIFIED", GIT_DIFF_SHOW_UNMODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_PATIENCE", GIT_DIFF_PATIENCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_MINIMAL", GIT_DIFF_MINIMAL, CONST_CS | CONST_PERSISTENT); - /* git_diff_flag_t */ - REGISTER_LONG_CONSTANT("GIT_DIFF_FLAG_BINARY", GIT_DIFF_FLAG_BINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FLAG_NOT_BINARY", GIT_DIFF_FLAG_NOT_BINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FLAG_VALID_OID", GIT_DIFF_FLAG_VALID_OID, CONST_CS | CONST_PERSISTENT); - /* git_delta_t */ - REGISTER_LONG_CONSTANT("GIT_DELTA_UNMODIFIED", GIT_DELTA_UNMODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_ADDED", GIT_DELTA_ADDED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_DELETED", GIT_DELTA_DELETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_MODIFIED", GIT_DELTA_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_RENAMED", GIT_DELTA_RENAMED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_COPIED", GIT_DELTA_COPIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_IGNORED", GIT_DELTA_IGNORED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_UNTRACKED", GIT_DELTA_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DELTA_TYPECHANGE", GIT_DELTA_TYPECHANGE, CONST_CS | CONST_PERSISTENT); - /* git_diff_line_t */ - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_CONTEXT", GIT_DIFF_LINE_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_ADDITION", GIT_DIFF_LINE_ADDITION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_DELETION", GIT_DIFF_LINE_DELETION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_CONTEXT_EOFNL", GIT_DIFF_LINE_CONTEXT_EOFNL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_ADD_EOFNL", GIT_DIFF_LINE_ADD_EOFNL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_DEL_EOFNL", GIT_DIFF_LINE_DEL_EOFNL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_FILE_HDR", GIT_DIFF_LINE_FILE_HDR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_HUNK_HDR", GIT_DIFF_LINE_HUNK_HDR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_LINE_BINARY", GIT_DIFF_LINE_BINARY, CONST_CS | CONST_PERSISTENT); - /* git_diff_find_t */ - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_RENAMES", GIT_DIFF_FIND_RENAMES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_RENAMES_FROM_REWRITES", GIT_DIFF_FIND_RENAMES_FROM_REWRITES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_COPIES", GIT_DIFF_FIND_COPIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED", GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_REWRITES", GIT_DIFF_FIND_REWRITES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_BREAK_REWRITES", GIT_DIFF_BREAK_REWRITES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_AND_BREAK_REWRITES", GIT_DIFF_FIND_AND_BREAK_REWRITES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("(GIT_DIFF_FIND_REWRITES | GIT_DIFF_BREAK_REWRITES)", (GIT_DIFF_FIND_REWRITES | GIT_DIFF_BREAK_REWRITES), CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_FOR_UNTRACKED", GIT_DIFF_FIND_FOR_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_ALL", GIT_DIFF_FIND_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE", GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_IGNORE_WHITESPACE", GIT_DIFF_FIND_IGNORE_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE", GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FIND_EXACT_MATCH_ONLY", GIT_DIFF_FIND_EXACT_MATCH_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY", GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY, CONST_CS | CONST_PERSISTENT); - /* git_diff_format_t */ - REGISTER_LONG_CONSTANT("GIT_DIFF_FORMAT_PATCH", GIT_DIFF_FORMAT_PATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FORMAT_PATCH_HEADER", GIT_DIFF_FORMAT_PATCH_HEADER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FORMAT_RAW", GIT_DIFF_FORMAT_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FORMAT_NAME_ONLY", GIT_DIFF_FORMAT_NAME_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIFF_FORMAT_NAME_STATUS", GIT_DIFF_FORMAT_NAME_STATUS, CONST_CS | CONST_PERSISTENT); - - /* git_error_code */ - REGISTER_LONG_CONSTANT("GIT_OK", GIT_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ERROR", GIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ENOTFOUND", GIT_ENOTFOUND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EEXISTS", GIT_EEXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EAMBIGUOUS", GIT_EAMBIGUOUS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EBUFS", GIT_EBUFS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EUSER", GIT_EUSER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EBAREREPO", GIT_EBAREREPO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EUNBORNBRANCH", GIT_EUNBORNBRANCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EUNMERGED", GIT_EUNMERGED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ENONFASTFORWARD", GIT_ENONFASTFORWARD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EINVALIDSPEC", GIT_EINVALIDSPEC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_EMERGECONFLICT", GIT_EMERGECONFLICT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ELOCKED", GIT_ELOCKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PASSTHROUGH", GIT_PASSTHROUGH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_ITEROVER", GIT_ITEROVER, CONST_CS | CONST_PERSISTENT); - - /* git_error_t */ - REGISTER_LONG_CONSTANT("GITERR_NONE", GITERR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_NOMEMORY", GITERR_NOMEMORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_OS", GITERR_OS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_INVALID", GITERR_INVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_REFERENCE", GITERR_REFERENCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_ZLIB", GITERR_ZLIB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_REPOSITORY", GITERR_REPOSITORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_CONFIG", GITERR_CONFIG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_REGEX", GITERR_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_ODB", GITERR_ODB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_INDEX", GITERR_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_OBJECT", GITERR_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_NET", GITERR_NET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_TAG", GITERR_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_TREE", GITERR_TREE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_INDEXER", GITERR_INDEXER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_SSL", GITERR_SSL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_SUBMODULE", GITERR_SUBMODULE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_THREAD", GITERR_THREAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_STASH", GITERR_STASH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_CHECKOUT", GITERR_CHECKOUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_FETCHHEAD", GITERR_FETCHHEAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_MERGE", GITERR_MERGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_SSH", GITERR_SSH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GITERR_FILTER", GITERR_FILTER, CONST_CS | CONST_PERSISTENT); - - /* git_filter_mode_t */ - REGISTER_LONG_CONSTANT("GIT_FILTER_TO_WORKTREE", GIT_FILTER_TO_WORKTREE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILTER_SMUDGE", GIT_FILTER_SMUDGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILTER_TO_ODB", GIT_FILTER_TO_ODB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_FILTER_CLEAN", GIT_FILTER_CLEAN, CONST_CS | CONST_PERSISTENT); - - /* git_indexcap_t */ - REGISTER_LONG_CONSTANT("GIT_INDEXCAP_IGNORE_CASE", GIT_INDEXCAP_IGNORE_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_INDEXCAP_NO_FILEMODE", GIT_INDEXCAP_NO_FILEMODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_INDEXCAP_NO_SYMLINKS", GIT_INDEXCAP_NO_SYMLINKS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_INDEXCAP_FROM_OWNER", GIT_INDEXCAP_FROM_OWNER, CONST_CS | CONST_PERSISTENT); - /* git_index_add_option_t */ - REGISTER_LONG_CONSTANT("GIT_INDEX_ADD_DEFAULT", GIT_INDEX_ADD_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_INDEX_ADD_FORCE", GIT_INDEX_ADD_FORCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH", GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_INDEX_ADD_CHECK_PATHSPEC", GIT_INDEX_ADD_CHECK_PATHSPEC, CONST_CS | CONST_PERSISTENT); - - /* git_merge_tree_flag_t */ - REGISTER_LONG_CONSTANT("GIT_MERGE_TREE_FIND_RENAMES", GIT_MERGE_TREE_FIND_RENAMES, CONST_CS | CONST_PERSISTENT); - /* git_merge_automerge_flags */ - REGISTER_LONG_CONSTANT("GIT_MERGE_AUTOMERGE_NORMAL", GIT_MERGE_AUTOMERGE_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_MERGE_AUTOMERGE_NONE", GIT_MERGE_AUTOMERGE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_MERGE_AUTOMERGE_FAVOR_OURS", GIT_MERGE_AUTOMERGE_FAVOR_OURS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_MERGE_AUTOMERGE_FAVOR_THEIRS", GIT_MERGE_AUTOMERGE_FAVOR_THEIRS, CONST_CS | CONST_PERSISTENT); - /* git_merge_flags_t */ - REGISTER_LONG_CONSTANT("GIT_MERGE_NO_FASTFORWARD", GIT_MERGE_NO_FASTFORWARD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_MERGE_FASTFORWARD_ONLY", GIT_MERGE_FASTFORWARD_ONLY, CONST_CS | CONST_PERSISTENT); - - /* git_direction */ - REGISTER_LONG_CONSTANT("GIT_DIRECTION_FETCH", GIT_DIRECTION_FETCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_DIRECTION_PUSH", GIT_DIRECTION_PUSH, CONST_CS | CONST_PERSISTENT); - - /* git_odb_stream_t */ - REGISTER_LONG_CONSTANT("GIT_STREAM_RDONLY", GIT_STREAM_RDONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STREAM_WRONLY", GIT_STREAM_WRONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STREAM_RW", GIT_STREAM_RW, CONST_CS | CONST_PERSISTENT); - - /* git_packbuilder_stage_t */ - REGISTER_LONG_CONSTANT("GIT_PACKBUILDER_ADDING_OBJECTS", GIT_PACKBUILDER_ADDING_OBJECTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PACKBUILDER_DELTAFICATION", GIT_PACKBUILDER_DELTAFICATION, CONST_CS | CONST_PERSISTENT); - - /* git_pathspec_flag_t */ - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_DEFAULT", GIT_PATHSPEC_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_IGNORE_CASE", GIT_PATHSPEC_IGNORE_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_USE_CASE", GIT_PATHSPEC_USE_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_NO_GLOB", GIT_PATHSPEC_NO_GLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_NO_MATCH_ERROR", GIT_PATHSPEC_NO_MATCH_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_FIND_FAILURES", GIT_PATHSPEC_FIND_FAILURES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_PATHSPEC_FAILURES_ONLY", GIT_PATHSPEC_FAILURES_ONLY, CONST_CS | CONST_PERSISTENT); - - /* git_reference_normalize_t */ - REGISTER_LONG_CONSTANT("GIT_REF_FORMAT_NORMAL", GIT_REF_FORMAT_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REF_FORMAT_ALLOW_ONELEVEL", GIT_REF_FORMAT_ALLOW_ONELEVEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REF_FORMAT_REFSPEC_PATTERN", GIT_REF_FORMAT_REFSPEC_PATTERN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REF_FORMAT_REFSPEC_SHORTHAND", GIT_REF_FORMAT_REFSPEC_SHORTHAND, CONST_CS | CONST_PERSISTENT); - - /* git_remote_autotag_option_t */ - REGISTER_LONG_CONSTANT("GIT_REMOTE_DOWNLOAD_TAGS_AUTO", GIT_REMOTE_DOWNLOAD_TAGS_AUTO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REMOTE_DOWNLOAD_TAGS_NONE", GIT_REMOTE_DOWNLOAD_TAGS_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REMOTE_DOWNLOAD_TAGS_ALL", GIT_REMOTE_DOWNLOAD_TAGS_ALL, CONST_CS | CONST_PERSISTENT); - - /* git_repository_open_flag_t */ - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_OPEN_NO_SEARCH", GIT_REPOSITORY_OPEN_NO_SEARCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_OPEN_CROSS_FS", GIT_REPOSITORY_OPEN_CROSS_FS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_OPEN_BARE", GIT_REPOSITORY_OPEN_BARE, CONST_CS | CONST_PERSISTENT); - /* git_repository_init_flag_t */ - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_BARE", GIT_REPOSITORY_INIT_BARE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_NO_REINIT", GIT_REPOSITORY_INIT_NO_REINIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_NO_DOTGIT_DIR", GIT_REPOSITORY_INIT_NO_DOTGIT_DIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_MKDIR", GIT_REPOSITORY_INIT_MKDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_MKPATH", GIT_REPOSITORY_INIT_MKPATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE", GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE, CONST_CS | CONST_PERSISTENT); - /* git_repository_init_mode_t */ - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_SHARED_UMASK", GIT_REPOSITORY_INIT_SHARED_UMASK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_SHARED_GROUP", GIT_REPOSITORY_INIT_SHARED_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_INIT_SHARED_ALL", GIT_REPOSITORY_INIT_SHARED_ALL, CONST_CS | CONST_PERSISTENT); - /* git_repository_state_t */ - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_NONE", GIT_REPOSITORY_STATE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_MERGE", GIT_REPOSITORY_STATE_MERGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_REVERT", GIT_REPOSITORY_STATE_REVERT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_CHERRY_PICK", GIT_REPOSITORY_STATE_CHERRY_PICK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_BISECT", GIT_REPOSITORY_STATE_BISECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_REBASE", GIT_REPOSITORY_STATE_REBASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_REBASE_INTERACTIVE", GIT_REPOSITORY_STATE_REBASE_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_REBASE_MERGE", GIT_REPOSITORY_STATE_REBASE_MERGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_APPLY_MAILBOX", GIT_REPOSITORY_STATE_APPLY_MAILBOX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE", GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE, CONST_CS | CONST_PERSISTENT); - - /* git_reset_t */ - REGISTER_LONG_CONSTANT("GIT_RESET_SOFT", GIT_RESET_SOFT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_RESET_MIXED", GIT_RESET_MIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_RESET_HARD", GIT_RESET_HARD, CONST_CS | CONST_PERSISTENT); - - /* git_revparse_mode_t */ - REGISTER_LONG_CONSTANT("GIT_REVPARSE_SINGLE", GIT_REVPARSE_SINGLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REVPARSE_RANGE", GIT_REVPARSE_RANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_REVPARSE_MERGE_BASE", GIT_REVPARSE_MERGE_BASE, CONST_CS | CONST_PERSISTENT); - - /* git_stash_flags */ - REGISTER_LONG_CONSTANT("GIT_STASH_DEFAULT", GIT_STASH_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STASH_KEEP_INDEX", GIT_STASH_KEEP_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STASH_INCLUDE_UNTRACKED", GIT_STASH_INCLUDE_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STASH_INCLUDE_IGNORED", GIT_STASH_INCLUDE_IGNORED, CONST_CS | CONST_PERSISTENT); - - /* git_status_t */ - REGISTER_LONG_CONSTANT("GIT_STATUS_CURRENT", GIT_STATUS_CURRENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_INDEX_NEW", GIT_STATUS_INDEX_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_INDEX_MODIFIED", GIT_STATUS_INDEX_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_INDEX_DELETED", GIT_STATUS_INDEX_DELETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_INDEX_RENAMED", GIT_STATUS_INDEX_RENAMED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_INDEX_TYPECHANGE", GIT_STATUS_INDEX_TYPECHANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_WT_NEW", GIT_STATUS_WT_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_WT_MODIFIED", GIT_STATUS_WT_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_WT_DELETED", GIT_STATUS_WT_DELETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_WT_TYPECHANGE", GIT_STATUS_WT_TYPECHANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_WT_RENAMED", GIT_STATUS_WT_RENAMED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_IGNORED", GIT_STATUS_IGNORED, CONST_CS | CONST_PERSISTENT); - /* git_status_show_t */ - REGISTER_LONG_CONSTANT("GIT_STATUS_SHOW_INDEX_AND_WORKDIR", GIT_STATUS_SHOW_INDEX_AND_WORKDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_SHOW_INDEX_ONLY", GIT_STATUS_SHOW_INDEX_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_SHOW_WORKDIR_ONLY", GIT_STATUS_SHOW_WORKDIR_ONLY, CONST_CS | CONST_PERSISTENT); - /* git_status_opt_t */ - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_INCLUDE_UNTRACKED", GIT_STATUS_OPT_INCLUDE_UNTRACKED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_INCLUDE_IGNORED", GIT_STATUS_OPT_INCLUDE_IGNORED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_INCLUDE_UNMODIFIED", GIT_STATUS_OPT_INCLUDE_UNMODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_EXCLUDE_SUBMODULES", GIT_STATUS_OPT_EXCLUDE_SUBMODULES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS", GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH", GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_RECURSE_IGNORED_DIRS", GIT_STATUS_OPT_RECURSE_IGNORED_DIRS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX", GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR", GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_SORT_CASE_SENSITIVELY", GIT_STATUS_OPT_SORT_CASE_SENSITIVELY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY", GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_RENAMES_FROM_REWRITES", GIT_STATUS_OPT_RENAMES_FROM_REWRITES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_STATUS_OPT_NO_REFRESH", GIT_STATUS_OPT_NO_REFRESH, CONST_CS | CONST_PERSISTENT); - - /* git_submodule_status_t */ - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_IN_HEAD", GIT_SUBMODULE_STATUS_IN_HEAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_IN_INDEX", GIT_SUBMODULE_STATUS_IN_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_IN_CONFIG", GIT_SUBMODULE_STATUS_IN_CONFIG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_IN_WD", GIT_SUBMODULE_STATUS_IN_WD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_INDEX_ADDED", GIT_SUBMODULE_STATUS_INDEX_ADDED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_INDEX_DELETED", GIT_SUBMODULE_STATUS_INDEX_DELETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_INDEX_MODIFIED", GIT_SUBMODULE_STATUS_INDEX_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_UNINITIALIZED", GIT_SUBMODULE_STATUS_WD_UNINITIALIZED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_ADDED", GIT_SUBMODULE_STATUS_WD_ADDED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_DELETED", GIT_SUBMODULE_STATUS_WD_DELETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_MODIFIED", GIT_SUBMODULE_STATUS_WD_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED", GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_WD_MODIFIED", GIT_SUBMODULE_STATUS_WD_WD_MODIFIED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SUBMODULE_STATUS_WD_UNTRACKED", GIT_SUBMODULE_STATUS_WD_UNTRACKED, CONST_CS | CONST_PERSISTENT); - - /* git_trace_level_t */ - REGISTER_LONG_CONSTANT("GIT_TRACE_NONE", GIT_TRACE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRACE_FATAL", GIT_TRACE_FATAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRACE_ERROR", GIT_TRACE_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRACE_WARN", GIT_TRACE_WARN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRACE_INFO", GIT_TRACE_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRACE_DEBUG", GIT_TRACE_DEBUG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRACE_TRACE", GIT_TRACE_TRACE, CONST_CS | CONST_PERSISTENT); - - /* git_credtype_t */ - REGISTER_LONG_CONSTANT("GIT_CREDTYPE_USERPASS_PLAINTEXT", GIT_CREDTYPE_USERPASS_PLAINTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CREDTYPE_SSH_KEY", GIT_CREDTYPE_SSH_KEY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CREDTYPE_SSH_CUSTOM", GIT_CREDTYPE_SSH_CUSTOM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_CREDTYPE_DEFAULT", GIT_CREDTYPE_DEFAULT, CONST_CS | CONST_PERSISTENT); - /* git_transport_flags_t */ - REGISTER_LONG_CONSTANT("GIT_TRANSPORTFLAGS_NONE", GIT_TRANSPORTFLAGS_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TRANSPORTFLAGS_NO_CHECK_CERT", GIT_TRANSPORTFLAGS_NO_CHECK_CERT, CONST_CS | CONST_PERSISTENT); - /* git_smart_service_t */ - REGISTER_LONG_CONSTANT("GIT_SERVICE_UPLOADPACK_LS", GIT_SERVICE_UPLOADPACK_LS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SERVICE_UPLOADPACK", GIT_SERVICE_UPLOADPACK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SERVICE_RECEIVEPACK_LS", GIT_SERVICE_RECEIVEPACK_LS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_SERVICE_RECEIVEPACK", GIT_SERVICE_RECEIVEPACK, CONST_CS | CONST_PERSISTENT); - - /* git_treewalk_mode */ - REGISTER_LONG_CONSTANT("GIT_TREEWALK_PRE", GIT_TREEWALK_PRE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_TREEWALK_POST", GIT_TREEWALK_POST, CONST_CS | CONST_PERSISTENT); - - /* git_otype */ - REGISTER_LONG_CONSTANT("GIT_OBJ_ANY", GIT_OBJ_ANY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_BAD", GIT_OBJ_BAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ__EXT1", GIT_OBJ__EXT1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_COMMIT", GIT_OBJ_COMMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_TREE", GIT_OBJ_TREE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_BLOB", GIT_OBJ_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_TAG", GIT_OBJ_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ__EXT2", GIT_OBJ__EXT2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_OFS_DELTA", GIT_OBJ_OFS_DELTA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GIT_OBJ_REF_DELTA", GIT_OBJ_REF_DELTA, CONST_CS | CONST_PERSISTENT); - - return SUCCESS; -} - -PHP_RINIT_FUNCTION(git2) -{ - git_threads_init(); - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(git2) -{ - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(git2) -{ - git_threads_shutdown(); - return SUCCESS; -} - -zend_module_entry git2_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 - STANDARD_MODULE_HEADER, -#endif - PHP_GIT2_EXTNAME, - php_git2_functions, /* Functions */ - PHP_MINIT(git2), /* MINIT */ - PHP_MSHUTDOWN(git2), /* MSHUTDOWN */ - PHP_RINIT(git2), /* RINIT */ - PHP_RSHUTDOWN(git2), /* RSHUTDOWN */ - PHP_MINFO(git2), /* MINFO */ -#if ZEND_MODULE_API_NO >= 20010901 - PHP_GIT2_EXTVER, -#endif - PHP_MODULE_GLOBALS(git2), - PHP_GINIT(git2), - PHP_GSHUTDOWN(git2), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; - -#ifdef COMPILE_DL_GIT2 -ZEND_GET_MODULE(git2) -#endif \ No newline at end of file diff --git a/php_git2.h b/php_git2.h deleted file mode 100644 index 4c5493a976..0000000000 --- a/php_git2.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_H -#define PHP_GIT2_H - -#define PHP_GIT2_EXTNAME "git2" -#define PHP_GIT2_EXTVER "0.3.0" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "zend.h" -#include "zend_interfaces.h" -#include "zend_exceptions.h" -#include "ext/standard/php_smart_str.h" -#include "ext/spl/spl_exceptions.h" -#include "ext/standard/php_var.h" -#include "ext/standard/php_string.h" -#include "ext/standard/php_incomplete_class.h" -#include "ext/standard/info.h" -#include "ext/standard/php_array.h" -#include "limits.h" - -#include "git2.h" -#include "git2/odb.h" -#include "git2/odb_backend.h" -#include "git2/trace.h" -#include "git2/sys/filter.h" -#include "git2/sys/odb_backend.h" - -#include "date/php_date.h" - -#include - -/* Define the entry point symbol - * Zend will use when loading this module - */ -extern zend_module_entry git2_module_entry; -#define phpext_git2_ptr &git2_module_entry - -ZEND_BEGIN_MODULE_GLOBALS(git2) - long dummy; -ZEND_END_MODULE_GLOBALS(git2) - -ZEND_EXTERN_MODULE_GLOBALS(git2) - -#ifdef ZTS -#define GIT2G(v) TSRMG(git2_globals_id, zend_git2_globals *, v) -#else -#define GIT2G(v) (git2_globals.v) -#endif - -#define PHP_GIT2_RESOURCE_NAME "git2" - - -#ifdef ZTS -#define GIT2_TSRMLS_SET(target) void ***tsrm_ls = target; -#define GIT2_TSRMLS_DECL void ***tsrm_ls; -#define GIT2_TSRMLS_SET2(target, value) target->tsrm_ls = value; -#else -#define GIT2_TSRMLS_SET(target) -#define GIT2_TSRMLS_SET2(target, value) -#define GIT2_TSRMLS_DECL -#endif - -enum php_git2_resource_type { - PHP_GIT2_TYPE_REPOSITORY, - PHP_GIT2_TYPE_COMMIT, - PHP_GIT2_TYPE_TREE, - PHP_GIT2_TYPE_TREE_ENTRY, - PHP_GIT2_TYPE_BLOB, - PHP_GIT2_TYPE_REVWALK, - PHP_GIT2_TYPE_TREEBUILDER, - PHP_GIT2_TYPE_REFERENCE, - PHP_GIT2_TYPE_REFERENCE_ITERATOR, - PHP_GIT2_TYPE_CONFIG, - PHP_GIT2_TYPE_CONFIG_ITERATOR, - PHP_GIT2_TYPE_OBJECT, - PHP_GIT2_TYPE_INDEX, - PHP_GIT2_TYPE_ODB, - PHP_GIT2_TYPE_REFDB, - PHP_GIT2_TYPE_STATUS_LIST, - PHP_GIT2_TYPE_BRANCH_ITERATOR, - PHP_GIT2_TYPE_TAG, - PHP_GIT2_TYPE_CRED, - PHP_GIT2_TYPE_TRANSPORT, - PHP_GIT2_TYPE_REMOTE, - PHP_GIT2_TYPE_DIFF, - PHP_GIT2_TYPE_MERGE_RESULT, - PHP_GIT2_TYPE_MERGE_HEAD, - PHP_GIT2_TYPE_PATHSPEC, - PHP_GIT2_TYPE_PATHSPEC_MATCH_LIST, - PHP_GIT2_TYPE_PATCH, - PHP_GIT2_TYPE_DIFF_HUNK, - PHP_GIT2_TYPE_BUF, - PHP_GIT2_TYPE_FILTER_LIST, - PHP_GIT2_TYPE_FILTER_SOURCE, - PHP_GIT2_TYPE_DIFF_LINE, - PHP_GIT2_TYPE_INDEX_CONFLICT_ITERATOR, - PHP_GIT2_TYPE_SMART_SUBTRANSPORT, - PHP_GIT2_TYPE_NOTE, - PHP_GIT2_TYPE_NOTE_ITERATOR, - PHP_GIT2_TYPE_ODB_STREAM, - PHP_GIT2_TYPE_ODB_OBJECT, - PHP_GIT2_TYPE_ODB_WRITEPACK, - PHP_GIT2_TYPE_ODB_BACKEND, - PHP_GIT2_TYPE_REFLOG, - PHP_GIT2_TYPE_REFLOG_ENTRY, - PHP_GIT2_TYPE_BLAME, - PHP_GIT2_TYPE_PACKBUILDER, - PHP_GIT2_TYPE_SUBMODULE, - PHP_GIT2_TYPE_PUSH, - PHP_GIT2_TYPE_REFSPEC, - PHP_GIT2_TYPE_INDEXER, - PHP_GIT2_TYPE_FILTER, /* for conventional reason */ -}; - -typedef struct php_git2_t { - enum php_git2_resource_type type; - union { - git_repository *repository; - git_commit *commit; - git_tree *tree; - git_tree_entry *tree_entry; - git_blob *blob; - git_revwalk *revwalk; - git_treebuilder *treebuilder; - git_reference *reference; - git_reference_iterator *reference_iterator; - git_config *config; - git_config_iterator *config_iterator; - git_object *object; - git_index *index; - git_odb *odb; - git_refdb *refdb; - git_status_list *status_list; - git_branch_iterator *branch_iterator; - git_tag *tag; - git_cred *cred; - git_transport *transport; - git_remote *remote; - git_diff *diff; - git_merge_result *merge_result; - git_merge_head *merge_head; - git_pathspec *pathspec; - git_pathspec_match_list *pathspec_match_list; - git_patch *patch; - git_diff_hunk *diff_hunk; - git_buf *buf; - git_filter_list *filter_list; - git_filter_source *filter_source; - git_diff_line *diff_line; - git_index_conflict_iterator *index_conflict_iterator; - git_smart_subtransport *smart_subtransport; - git_note *note; - git_note_iterator *note_iterator; - git_odb_stream *odb_stream; - git_odb_object *odb_object; - git_odb_writepack *odb_writepack; - git_odb_backend *odb_backend; - git_reflog *reflog; - git_reflog_entry *reflog_entry; - git_blame *blame; - git_packbuilder *packbuilder; - git_submodule *submodule; - git_push *push; - git_refspec *refspec; - git_indexer *indexer; - git_filter *filter; - } v; - int should_free_v; - int resource_id; - int mutable; -} php_git2_t; - -typedef struct php_git2_cb_t { - zval *payload; - zend_fcall_info *fci; - zend_fcall_info_cache *fcc; - GIT2_TSRMLS_DECL -} php_git2_cb_t; - -typedef struct php_git2_fcall_t { - zend_fcall_info fci; - zend_fcall_info_cache fcc; - zval *value; -} php_git2_fcall_t; - -typedef struct php_git2_multi_cb_t { - int num_callbacks; - php_git2_fcall_t *callbacks; - zval *payload; - GIT2_TSRMLS_DECL -} php_git2_multi_cb_t; - -typedef struct php_git2_filter { - git_filter super; - php_git2_multi_cb_t *multi; -} php_git2_filter; - -typedef struct php_git2_odb_backend { - git_odb_backend parent; - php_git2_multi_cb_t *multi; -} php_git2_odb_backend; - -typedef struct php_git2_odb_backend_foreach_callback { - zend_object zo; - git_odb_foreach_cb callback; - php_git2_cb_t *payload; -} php_git2_odb_backend_foreach_callback; - -extern zend_class_entry *php_git2_odb_backend_foreach_callback_class_entry; - -#endif /* PHP_GIT2_H */ diff --git a/php_git2_priv.h b/php_git2_priv.h deleted file mode 100644 index 31bd3f2b30..0000000000 --- a/php_git2_priv.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_PRIV_H -#define PHP_GIT2_PRIV_H - -extern int git2_resource_handle; - -#if PHP_VERSION_ID>=50399 -#define PHP_GIT2_LIST_INSERT(type, handle) zend_list_insert(type, handle TSRMLS_CC) -#else -#define PHP_GIT2_LIST_INSERT(type, handle) zend_list_insert(type, handle) -#endif - -# if ZEND_MODULE_API_NO >= 20100525 -# define PHP_GIT2_STD_CREATE_OBJECT(STRUCT_NAME) \ - STRUCT_NAME *object;\ - \ - object = (STRUCT_NAME*)ecalloc(1, sizeof(*object));\ - zend_object_std_init(&object->zo, ce TSRMLS_CC);\ - object_properties_init(&object->zo, ce);\ - \ - retval.handle = zend_objects_store_put(object,\ - (zend_objects_store_dtor_t)zend_objects_destroy_object,\ - (zend_objects_free_object_storage_t) STRUCT_NAME##_free_storage ,\ - NULL TSRMLS_CC);\ - retval.handlers = zend_get_std_object_handlers(); -# else -# define PHP_GIT2_STD_CREATE_OBJECT(STRUCT_NAME) \ - STRUCT_NAME *object;\ - zval *tmp = NULL;\ - \ - object = (STRUCT_NAME*)ecalloc(1, sizeof(*object));\ - zend_object_std_init(&object->zo, ce TSRMLS_CC);\ - zend_hash_copy(object->zo.properties, &ce->default_properties, (copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *)); \ - \ - retval.handle = zend_objects_store_put(object,\ - (zend_objects_store_dtor_t)zend_objects_destroy_object,\ - (zend_objects_free_object_storage_t) STRUCT_NAME##_free_storage ,\ - NULL TSRMLS_CC);\ - retval.handlers = zend_get_std_object_handlers(); -# endif - -#define PHP_GIT2_V(git2, type) git2->v.type -#define GIT2_RVAL_P(git2) git2->resource_id -#define GIT2_SHOULD_FREE(git2) git2->should_free_v - -#define PHP_GIT2_MAKE_RESOURCE(val) \ -do {\ - val = (php_git2_t *)emalloc(sizeof(php_git2_t));\ - if (!val) {\ - php_error_docref(NULL TSRMLS_CC, E_ERROR, "emalloc failed");\ - RETURN_FALSE;\ - }\ - val->should_free_v = 0;\ - val->type = 0;\ - val->mutable = 0;\ -} while (0);\ - - -#define PHP_GIT2_MAKE_RESOURCE_NOCHECK(val) \ -do {\ - val = (php_git2_t *)emalloc(sizeof(php_git2_t));\ - val->should_free_v = 0;\ - val->type = 0;\ - val->mutable = 0;\ -} while (0);\ - -#define GIT2_OID_HEXSIZE (GIT_OID_HEXSZ+1) -#define GIT2_BUFFER_SIZE 512 - -int php_git2_make_resource(php_git2_t **out, enum php_git2_resource_type type, void *resource, int should_free TSRMLS_DC); - -#include "helper.h" - -#endif \ No newline at end of file diff --git a/push.c b/push.c deleted file mode 100644 index 2e678f026a..0000000000 --- a/push.c +++ /dev/null @@ -1,239 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "push.h" - -static int php_git2_push_status_foreach_cb(const char *ref, const char *msg, void *data) -{ - php_git2_t *result; - zval *param_ref, *param_msg, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)data; - int retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_ref); - MAKE_STD_ZVAL(param_msg); - ZVAL_NULL(param_ref); - ZVAL_NULL(param_msg); - - if (ref != NULL) { - ZVAL_STRING(param_ref, ref, 1); - } - if (msg != NULL) { - ZVAL_STRING(param_msg, msg, 1); - } - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 3, ¶m_ref, ¶m_msg, &p->payload)) { - zend_list_delete(result->resource_id); - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -/* {{{ proto resource git_push_new(resource $remote) - */ -PHP_FUNCTION(git_push_new) -{ - php_git2_t *result = NULL, *_remote = NULL; - git_push *out = NULL; - zval *remote = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_push_new(&out, PHP_GIT2_V(_remote, remote)); - if (php_git2_check_error(error, "git_push_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_PUSH, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_push_set_options(resource $push, $opts) - */ -PHP_FUNCTION(git_push_set_options) -{ - int result = 0; - zval *push = NULL, *opts = NULL; - php_git2_t *_push = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &push, &opts) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - //result = git_push_set_options(PHP_GIT2_V(_push, push), opts); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_push_set_callbacks(resource $push, $pack_progress_cb, $pack_progress_cb_payload, $transfer_progress_cb, $transfer_progress_cb_payload) - */ -PHP_FUNCTION(git_push_set_callbacks) -{ - int result = 0; - zval *push = NULL, *pack_progress_cb_payload = NULL, *transfer_progress_cb_payload = NULL; - php_git2_t *_push = NULL; - zend_fcall_info pack_fci = empty_fcall_info; - zend_fcall_info_cache pack_fcc = empty_fcall_info_cache; - zend_fcall_info transfer_fci = empty_fcall_info; - zend_fcall_info_cache transfer_fcc = empty_fcall_info_cache; - php_git2_cb_t *pack_cb = NULL; - php_git2_cb_t *transfer_cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfzfz", &push, &pack_fci, &pack_fcc, &pack_progress_cb_payload, &transfer_fci, &transfer_fcc, &transfer_progress_cb_payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&pack_cb, &pack_fci, &pack_fcc, pack_progress_cb_payload TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_cb_init(&transfer_cb, &transfer_fci, &transfer_fcc, transfer_progress_cb_payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_push_set_callbacks(PHP_GIT2_V(_push, push), NULL, pack_cb, NULL, transfer_cb); - php_git2_cb_free(pack_cb); - php_git2_cb_free(transfer_cb); - RETURN_LONG(result); -} -/* }}} */ - - - -/* {{{ proto long git_push_add_refspec(resource $push, string $refspec) - */ -PHP_FUNCTION(git_push_add_refspec) -{ - int result = 0, refspec_len = 0; - zval *push = NULL; - php_git2_t *_push = NULL; - char *refspec = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &push, &refspec, &refspec_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_push_add_refspec(PHP_GIT2_V(_push, push), refspec); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_push_update_tips(resource $push) - */ -PHP_FUNCTION(git_push_update_tips) -{ - int result = 0; - zval *push = NULL; - php_git2_t *_push = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &push) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_push_update_tips(PHP_GIT2_V(_push, push)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_push_finish(resource $push) - */ -PHP_FUNCTION(git_push_finish) -{ - int result = 0; - zval *push = NULL; - php_git2_t *_push = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &push) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_push_finish(PHP_GIT2_V(_push, push)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_push_unpack_ok(resource $push) - */ -PHP_FUNCTION(git_push_unpack_ok) -{ - int result = 0; - zval *push = NULL; - php_git2_t *_push = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &push) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_push_unpack_ok(PHP_GIT2_V(_push, push)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_push_status_foreach(resource $push, Callable callback, mixed $payload) - */ -PHP_FUNCTION(git_push_status_foreach) -{ - int result = 0; - zval *push = NULL, *payload = NULL; - php_git2_t *_push = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &push, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_push_status_foreach(PHP_GIT2_V(_push, push), php_git2_push_status_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_push_free(resource $push) - */ -PHP_FUNCTION(git_push_free) -{ - zval *push = NULL; - php_git2_t *_push = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &push) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_push, php_git2_t*, &push, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_push)) { - git_push_free(PHP_GIT2_V(_push, push)); - GIT2_SHOULD_FREE(_push) = 0; - }; - zval_ptr_dtor(&push); -} -/* }}} */ - diff --git a/push.h b/push.h deleted file mode 100644 index fc4a131ace..0000000000 --- a/push.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_PUSH_H -#define PHP_GIT2_PUSH_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_new, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_set_options, 0, 0, 2) - ZEND_ARG_INFO(0, push) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_set_callbacks, 0, 0, 5) - ZEND_ARG_INFO(0, push) - ZEND_ARG_INFO(0, pack_progress_cb) - ZEND_ARG_INFO(0, pack_progress_cb_payload) - ZEND_ARG_INFO(0, transfer_progress_cb) - ZEND_ARG_INFO(0, transfer_progress_cb_payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_add_refspec, 0, 0, 2) - ZEND_ARG_INFO(0, push) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_update_tips, 0, 0, 1) - ZEND_ARG_INFO(0, push) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_finish, 0, 0, 1) - ZEND_ARG_INFO(0, push) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_unpack_ok, 0, 0, 1) - ZEND_ARG_INFO(0, push) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_status_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, push) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, data) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_push_free, 0, 0, 1) - ZEND_ARG_INFO(0, push) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_push_new(remote) -*/ -PHP_FUNCTION(git_push_new); - -/* {{{ proto long git_push_set_options(push, opts) -*/ -PHP_FUNCTION(git_push_set_options); - -/* {{{ proto long git_push_set_callbacks(push, pack_progress_cb, pack_progress_cb_payload, transfer_progress_cb, transfer_progress_cb_payload) -*/ -PHP_FUNCTION(git_push_set_callbacks); - -/* {{{ proto long git_push_add_refspec(push, refspec) -*/ -PHP_FUNCTION(git_push_add_refspec); - -/* {{{ proto long git_push_update_tips(push) -*/ -PHP_FUNCTION(git_push_update_tips); - -/* {{{ proto long git_push_finish(push) -*/ -PHP_FUNCTION(git_push_finish); - -/* {{{ proto long git_push_unpack_ok(push) -*/ -PHP_FUNCTION(git_push_unpack_ok); - -/* {{{ proto long git_push_status_foreach(push, ref, msg, data), data) -*/ -PHP_FUNCTION(git_push_status_foreach); - -/* {{{ proto void git_push_free(push) -*/ -PHP_FUNCTION(git_push_free); - -#endif diff --git a/ref.php b/ref.php deleted file mode 100644 index 0235eeea8d..0000000000 --- a/ref.php +++ /dev/null @@ -1,19 +0,0 @@ -getFunctions() as $func) { - /** @var ReflectionFunction $func */ - - $name = $func->getName(); - $result[$name] = array(); - foreach ($func->getParameters() as $param) { - /** @var ReflectionParameter $param */ - $result[$name][] = '$' . $param->getName(); - } -} - -echo " $params) { - printf("function %s(%s){}\n", $func, join(", ", $params)); -} diff --git a/reference.c b/reference.c deleted file mode 100644 index 2befa063b9..0000000000 --- a/reference.c +++ /dev/null @@ -1,874 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "reference.h" - -static int php_git2_reference_foreach_cb(git_reference *reference, void *payload) -{ - php_git2_t *result; - zval *param_reference, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_reference); - - php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, reference, 0 TSRMLS_CC); - zend_list_addref(result->resource_id); - ZVAL_RESOURCE(param_reference, result->resource_id); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 2, ¶m_reference, &p->payload)) { - zend_list_delete(result->resource_id); - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - zend_list_delete(result->resource_id); - return retval; -} - -static int php_git2_reference_foreach_name_cb(const char *name, void *payload) -{ - php_git2_t *result; - zval *param_name, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - GIT2_TSRMLS_SET(p->tsrm_ls) - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_name); - ZVAL_STRING(param_name, name, 1); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 2, ¶m_name, &p->payload)) { - zval_ptr_dtor(&retval_ptr); - zend_list_delete(result->resource_id); - return GIT_EUSER; - } - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - zend_list_delete(result->resource_id); - - return retval; -} - -/* {{{ proto resource git_reference_lookup(resource $repo, string $name) - */ -PHP_FUNCTION(git_reference_lookup) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference *out = NULL; - zval *repo = NULL; - char *name = NULL; - int name_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_lookup(&out, PHP_GIT2_V(_repo, repository), name); - if (php_git2_check_error(error, "git_reference_lookup" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_reference_name_to_id(repo, name) -*/ -PHP_FUNCTION(git_reference_name_to_id) -{ - zval *repo; - php_git2_t *_repo; - char *name = {0}; - int name_len; - git_oid id; - char out[GIT2_OID_HEXSIZE] = {0}; - int error; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_name_to_id(&id, PHP_GIT2_V(_repo, repository), name); - if (php_git2_check_error(error, "git_reference_lookup" TSRMLS_CC)) { - RETURN_FALSE - } - - git_oid_fmt(out, &id); - RETURN_STRING(out, 1); -} - -/* {{{ proto resource git_reference_dwim(resource $repo, string $shorthand) - */ -PHP_FUNCTION(git_reference_dwim) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference *out = NULL; - zval *repo = NULL; - char *shorthand = NULL; - int shorthand_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &shorthand, &shorthand_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_dwim(&out, PHP_GIT2_V(_repo, repository), shorthand); - if (php_git2_check_error(error, "git_reference_dwim" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_reference_symbolic_create(resource $repo, string $name, string $target, long $force) - */ -PHP_FUNCTION(git_reference_symbolic_create) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference *out = NULL; - zval *repo = NULL; - char *name = NULL, *target = NULL; - int name_len = 0, target_len = 0, error = 0; - long force = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rssl", &repo, &name, &name_len, &target, &target_len, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_symbolic_create(&out, PHP_GIT2_V(_repo, repository), name, target, force); - if (php_git2_check_error(error, "git_reference_symbolic_create" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_reference_create(resource $repo, string $name, string $id, long $force) - */ -PHP_FUNCTION(git_reference_create) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference *out = NULL; - zval *repo = NULL; - char *name = NULL, *id = NULL; - int name_len = 0, id_len = 0, error = 0; - git_oid __id = {0}; - long force = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rssl", &repo, &name, &name_len, &id, &id_len, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - error = git_reference_create(&out, PHP_GIT2_V(_repo, repository), name, &__id, force); - if (php_git2_check_error(error, "git_reference_create" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_reference_target(resource $ref) - */ -PHP_FUNCTION(git_reference_target) -{ - const git_oid *result = NULL; - zval *ref = NULL; - php_git2_t *_ref = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_target(PHP_GIT2_V(_ref, reference)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto resource git_reference_target_peel(ref) -*/ -PHP_FUNCTION(git_reference_target_peel) -{ - zval *ref; - php_git2_t *_ref; - git_oid *oid; - char out[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - oid = git_reference_target_peel(PHP_GIT2_V(_ref, reference)); - - git_oid_fmt(out, oid); - RETURN_STRING(out, 1); -} - -/* {{{ proto string git_reference_symbolic_target(resource $ref) - */ -PHP_FUNCTION(git_reference_symbolic_target) -{ - const char *result = NULL; - zval *ref = NULL; - php_git2_t *_ref = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_symbolic_target(PHP_GIT2_V(_ref, reference)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto resource git_reference_type(resource $ref) - */ -PHP_FUNCTION(git_reference_type) -{ - git_ref_t result; - zval *ref = NULL; - php_git2_t *_ref = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_type(PHP_GIT2_V(_ref, reference)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto string git_reference_name(resource $ref) - */ -PHP_FUNCTION(git_reference_name) -{ - const char *result = NULL; - zval *ref = NULL; - php_git2_t *_ref = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_name(PHP_GIT2_V(_ref, reference)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto resource git_reference_resolve(resource $ref) - */ -PHP_FUNCTION(git_reference_resolve) -{ - php_git2_t *result = NULL, *_ref = NULL; - git_reference *out = NULL; - zval *ref = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_resolve(&out, PHP_GIT2_V(_ref, reference)); - if (php_git2_check_error(error, "git_reference_resolve" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_reference_owner(resource $ref) - */ -PHP_FUNCTION(git_reference_owner) -{ - git_repository *result = NULL; - zval *ref = NULL; - php_git2_t *_ref = NULL, *__result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_owner(PHP_GIT2_V(_ref, reference)); - if (php_git2_make_resource(&__result, PHP_GIT2_TYPE_REFERENCE, result, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(__result)); -} -/* }}} */ - -/* {{{ proto resource git_reference_symbolic_set_target(resource $ref, string $target) - */ -PHP_FUNCTION(git_reference_symbolic_set_target) -{ - php_git2_t *result = NULL, *_ref = NULL; - git_reference *out = NULL; - zval *ref = NULL; - char *target = NULL; - int target_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &ref, &target, &target_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_symbolic_set_target(&out, PHP_GIT2_V(_ref, reference), target); - if (php_git2_check_error(error, "git_reference_symbolic_set_target" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_reference_set_target(resource $ref, string $id) - */ -PHP_FUNCTION(git_reference_set_target) -{ - php_git2_t *result = NULL, *_ref = NULL; - git_reference *out = NULL; - zval *ref = NULL; - char *id = NULL; - int id_len = 0, error = 0; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &ref, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - error = git_reference_set_target(&out, PHP_GIT2_V(_ref, reference), &__id); - if (php_git2_check_error(error, "git_reference_set_target" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_reference_rename(resource $ref, string $new_name, long $force) - */ -PHP_FUNCTION(git_reference_rename) -{ - int result = 0, new_name_len = 0; - git_reference *new_ref = NULL; - zval *ref = NULL; - php_git2_t *_ref = NULL; - char *new_name = NULL; - long force = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &ref, &new_name, &new_name_len, &force) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_rename(&new_ref, PHP_GIT2_V(_ref, reference), new_name, force); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reference_delete(resource $ref) - */ -PHP_FUNCTION(git_reference_delete) -{ - int result = 0; - zval *ref = NULL; - php_git2_t *_ref = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reference_delete(PHP_GIT2_V(_ref, reference)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_reference_list(repo) -*/ -PHP_FUNCTION(git_reference_list) -{ - zval *repo; - php_git2_t *_repo; - git_strarray list; - zval *result; - int error; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_reference_list(&list, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_reference_list" TSRMLS_CC)) { - RETURN_FALSE - } - - php_git2_strarray_to_array(&list, &result TSRMLS_CC); - git_strarray_free(&list); - - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ - -/* {{{ proto long git_reference_foreach(resource $repo, $callback, $payload) - */ -PHP_FUNCTION(git_reference_foreach) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb; - zval *payload; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &repo, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_reference_foreach(PHP_GIT2_V(_repo, repository), php_git2_reference_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reference_foreach_name(resource $repo, $callback, $payload) - */ -PHP_FUNCTION(git_reference_foreach_name) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb; - zval *payload; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &repo, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_reference_foreach_name(PHP_GIT2_V(_repo, repository), php_git2_reference_foreach_name_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_reference_free(resource $ref) - */ -PHP_FUNCTION(git_reference_free) -{ - zval *ref = NULL; - php_git2_t *_ref = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_ref)) { - git_reference_free(PHP_GIT2_V(_ref, reference)); - GIT2_SHOULD_FREE(_ref) = 0; - }; - zval_ptr_dtor(&ref); -} -/* }}} */ - -/* {{{ proto long git_reference_cmp(ref1, ref2) -*/ -PHP_FUNCTION(git_reference_cmp) -{ - zval *e1, *e2; - php_git2_t *g_e1, *g_e2; - int result; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &e1, &e2) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(g_e1, php_git2_t*, &e1, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(g_e2, php_git2_t*, &e2, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - result = git_reference_cmp(PHP_GIT2_V(g_e1, reference), PHP_GIT2_V(g_e2, reference)); - RETURN_LONG(result); -} - -/* {{{ proto resource git_reference_iterator_new(resource $repo) - */ -PHP_FUNCTION(git_reference_iterator_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference_iterator *out = NULL; - zval *repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_iterator_new(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_reference_iterator_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_reference_iterator_glob_new(resource $repo, string $glob) - */ -PHP_FUNCTION(git_reference_iterator_glob_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reference_iterator *out = NULL; - zval *repo = NULL; - char *glob = NULL; - int glob_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &glob, &glob_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_iterator_glob_new(&out, PHP_GIT2_V(_repo, repository), glob); - if (php_git2_check_error(error, "git_reference_iterator_glob_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE_ITERATOR, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_reference_next(resource $iter) - */ -PHP_FUNCTION(git_reference_next) -{ - php_git2_t *result = NULL, *_iter = NULL; - git_reference *out = NULL; - zval *iter = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_next(&out, PHP_GIT2_V(_iter, reference_iterator)); - if (error == GIT_ITEROVER || php_git2_check_error(error, "git_reference_next" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_reference_next_name(resource $iter) - */ -PHP_FUNCTION(git_reference_next_name) -{ - php_git2_t *_iter = NULL; - const char *out = NULL; - zval *iter = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_next_name(&out, PHP_GIT2_V(_iter, reference_iterator)); - if (php_git2_check_error(error, "git_reference_next_name" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(out, 1); -} -/* }}} */ - - -/* {{{ proto void git_reference_iterator_free(resource $iter) - */ -PHP_FUNCTION(git_reference_iterator_free) -{ - zval *iter = NULL; - php_git2_t *_iter = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &iter) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_iter)) { - git_reference_iterator_free(PHP_GIT2_V(_iter, reference_iterator)); - GIT2_SHOULD_FREE(_iter) = 0; - }; - zval_ptr_dtor(&iter); -} -/* }}} */ - -/* {{{ proto long git_reference_foreach_glob(resource $repo, string $glob, $callback, $payload) - */ -PHP_FUNCTION(git_reference_foreach_glob) -{ - int result = 0, glob_len = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *glob = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb; - zval *payload = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsfz", &repo, &glob, &glob_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_reference_foreach_glob(PHP_GIT2_V(_repo, repository), glob, php_git2_reference_foreach_name_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reference_has_log(ref) -*/ -PHP_FUNCTION(git_reference_has_log) -{ - zval *ref; - php_git2_t *_ref; - int has = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - has = git_reference_has_log(PHP_GIT2_V(_ref, reference)); - - RETURN_LONG(has); -} - -/* {{{ proto long git_reference_is_branch(ref) -*/ -PHP_FUNCTION(git_reference_is_branch) -{ - zval *ref; - php_git2_t *_ref; - int is_branch = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - is_branch = git_reference_is_branch(PHP_GIT2_V(_ref, reference)); - - RETURN_LONG(is_branch); -} - -/* {{{ proto long git_reference_is_remote(ref) -*/ -PHP_FUNCTION(git_reference_is_remote) -{ - zval *ref; - php_git2_t *_ref; - int is_remote = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - is_remote = git_reference_is_remote(PHP_GIT2_V(_ref, reference)); - RETURN_LONG(is_remote); -} - -/* {{{ proto long git_reference_is_tag(ref) -*/ -PHP_FUNCTION(git_reference_is_tag) -{ - zval *ref; - php_git2_t *_ref; - int is_tag = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - is_tag = git_reference_is_tag(PHP_GIT2_V(_ref, reference)); - RETURN_LONG(is_tag); -} - -/* {{{ proto resource git_reference_normalize_name(name, flags) -*/ -PHP_FUNCTION(git_reference_normalize_name) -{ - char *name = {0}; - int name_len; - long flags; - char buffer[GIT2_BUFFER_SIZE] = {0}; - size_t buffer_sz = GIT2_BUFFER_SIZE; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sl", &name, &name_len, &flags) == FAILURE) { - return; - } - error = git_reference_normalize_name(buffer, buffer_sz, name, flags); - if (php_git2_check_error(error, "git_reference_normalize_name" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_STRING(buffer, 1); -} - -/* {{{ proto resource git_reference_peel(resource $ref, $type) - */ -PHP_FUNCTION(git_reference_peel) -{ - php_git2_t *result = NULL, *_ref = NULL; - git_object *out = NULL; - zval *ref = NULL; - int error = 0; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &ref, &type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reference_peel(&out, PHP_GIT2_V(_ref, reference), type); - if (php_git2_check_error(error, "git_reference_peel" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_OBJECT, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_reference_is_valid_name(refname) -*/ -PHP_FUNCTION(git_reference_is_valid_name) -{ - char *refname = {0}; - int refname_len; - int acceptable = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &refname, &refname_len) == FAILURE) { - return; - } - acceptable = git_reference_is_valid_name(refname); - RETURN_BOOL(acceptable); -} - -/* {{{ proto resource git_reference_shorthand(ref) -*/ -PHP_FUNCTION(git_reference_shorthand) -{ - zval *ref; - php_git2_t *_ref; - const char *name; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &ref) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - name = git_reference_shorthand(PHP_GIT2_V(_ref, reference)); - RETURN_STRING(name, 1); -} - diff --git a/reference.h b/reference.h deleted file mode 100644 index 086fc43d01..0000000000 --- a/reference.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REFERENCE_H -#define PHP_GIT2_REFERENCE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_lookup, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_name_to_id, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_dwim, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, shorthand) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_symbolic_create, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, target) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_create, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_target, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_target_peel, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_symbolic_target, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_type, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_name, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_resolve, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_owner, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_symbolic_set_target, 0, 0, 2) - ZEND_ARG_INFO(0, ref) - ZEND_ARG_INFO(0, target) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_set_target, 0, 0, 2) - ZEND_ARG_INFO(0, ref) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_rename, 0, 0, 3) - ZEND_ARG_INFO(0, ref) - ZEND_ARG_INFO(0, new_name) - ZEND_ARG_INFO(0, force) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_delete, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_list, 0, 0, 2) - ZEND_ARG_INFO(0, array) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_foreach_name, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_free, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_cmp, 0, 0, 2) - ZEND_ARG_INFO(0, ref1) - ZEND_ARG_INFO(0, ref2) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_iterator_new, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_iterator_glob_new, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, glob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_next, 0, 0, 1) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_next_name, 0, 0, 1) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_iterator_free, 0, 0, 1) - ZEND_ARG_INFO(0, iter) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_foreach_glob, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, glob) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_has_log, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_is_branch, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_is_remote, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_is_tag, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_normalize_name, 0, 0, 4) - ZEND_ARG_INFO(0, buffer_size) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_peel, 0, 0, 2) - ZEND_ARG_INFO(0, ref) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_is_valid_name, 0, 0, 1) - ZEND_ARG_INFO(0, refname) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_shorthand, 0, 0, 1) - ZEND_ARG_INFO(0, ref) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_reference_lookup(repo, name) -*/ -PHP_FUNCTION(git_reference_lookup); - -/* {{{ proto resource git_reference_name_to_id(repo, name) -*/ -PHP_FUNCTION(git_reference_name_to_id); - -/* {{{ proto resource git_reference_dwim(repo, shorthand) -*/ -PHP_FUNCTION(git_reference_dwim); - -/* {{{ proto resource git_reference_symbolic_create(repo, name, target, force) -*/ -PHP_FUNCTION(git_reference_symbolic_create); - -/* {{{ proto resource git_reference_create(repo, name, id, force) -*/ -PHP_FUNCTION(git_reference_create); - -/* {{{ proto resource git_reference_target(ref) -*/ -PHP_FUNCTION(git_reference_target); - -/* {{{ proto resource git_reference_target_peel(ref) -*/ -PHP_FUNCTION(git_reference_target_peel); - -/* {{{ proto resource git_reference_symbolic_target(ref) -*/ -PHP_FUNCTION(git_reference_symbolic_target); - -/* {{{ proto resource git_reference_type(ref) -*/ -PHP_FUNCTION(git_reference_type); - -/* {{{ proto resource git_reference_name(ref) -*/ -PHP_FUNCTION(git_reference_name); - -/* {{{ proto resource git_reference_resolve(ref) -*/ -PHP_FUNCTION(git_reference_resolve); - -/* {{{ proto resource git_reference_owner(ref) -*/ -PHP_FUNCTION(git_reference_owner); - -/* {{{ proto resource git_reference_symbolic_set_target(ref, target) -*/ -PHP_FUNCTION(git_reference_symbolic_set_target); - -/* {{{ proto resource git_reference_set_target(ref, id) -*/ -PHP_FUNCTION(git_reference_set_target); - -/* {{{ proto resource git_reference_rename(ref, new_name, force) -*/ -PHP_FUNCTION(git_reference_rename); - -/* {{{ proto long git_reference_delete(ref) -*/ -PHP_FUNCTION(git_reference_delete); - -/* {{{ proto long git_reference_list(array, repo) -*/ -PHP_FUNCTION(git_reference_list); - -/* {{{ proto long git_reference_foreach(repo, callback, payload) -*/ -PHP_FUNCTION(git_reference_foreach); - -/* {{{ proto long git_reference_foreach_name(repo, callback, payload) -*/ -PHP_FUNCTION(git_reference_foreach_name); - -/* {{{ proto void git_reference_free(ref) -*/ -PHP_FUNCTION(git_reference_free); - -/* {{{ proto long git_reference_cmp(ref1, ref2) -*/ -PHP_FUNCTION(git_reference_cmp); - -/* {{{ proto resource git_reference_iterator_new(repo) -*/ -PHP_FUNCTION(git_reference_iterator_new); - -/* {{{ proto resource git_reference_iterator_glob_new(repo, glob) -*/ -PHP_FUNCTION(git_reference_iterator_glob_new); - -/* {{{ proto resource git_reference_next(iter) -*/ -PHP_FUNCTION(git_reference_next); - -/* {{{ proto resource git_reference_next_name(iter) -*/ -PHP_FUNCTION(git_reference_next_name); - -/* {{{ proto void git_reference_iterator_free(iter) -*/ -PHP_FUNCTION(git_reference_iterator_free); - -/* {{{ proto long git_reference_foreach_glob(repo, glob, callback, payload) -*/ -PHP_FUNCTION(git_reference_foreach_glob); - -/* {{{ proto long git_reference_has_log(ref) -*/ -PHP_FUNCTION(git_reference_has_log); - -/* {{{ proto long git_reference_is_branch(ref) -*/ -PHP_FUNCTION(git_reference_is_branch); - -/* {{{ proto long git_reference_is_remote(ref) -*/ -PHP_FUNCTION(git_reference_is_remote); - -/* {{{ proto long git_reference_is_tag(ref) -*/ -PHP_FUNCTION(git_reference_is_tag); - -/* {{{ proto resource git_reference_normalize_name(buffer_size, name, flags) -*/ -PHP_FUNCTION(git_reference_normalize_name); - -/* {{{ proto resource git_reference_peel(ref, type) -*/ -PHP_FUNCTION(git_reference_peel); - -/* {{{ proto long git_reference_is_valid_name(refname) -*/ -PHP_FUNCTION(git_reference_is_valid_name); - -/* {{{ proto resource git_reference_shorthand(ref) -*/ -PHP_FUNCTION(git_reference_shorthand); - -#endif \ No newline at end of file diff --git a/reflog.c b/reflog.c deleted file mode 100644 index 35d95fdec1..0000000000 --- a/reflog.c +++ /dev/null @@ -1,302 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "reflog.h" - -/* {{{ proto resource git_reflog_read(resource $repo, string $name) - */ -PHP_FUNCTION(git_reflog_read) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_reflog *out = NULL; - zval *repo = NULL; - char *name = NULL; - int name_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_reflog_read(&out, PHP_GIT2_V(_repo, repository), name); - if (php_git2_check_error(error, "git_reflog_read" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFLOG, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto long git_reflog_write(resource $reflog) - */ -PHP_FUNCTION(git_reflog_write) -{ - int result = 0; - zval *reflog = NULL; - php_git2_t *_reflog = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &reflog) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reflog, php_git2_t*, &reflog, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_write(PHP_GIT2_V(_reflog, reflog)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reflog_append(resource $reflog, string $id, array $committer, string $msg) - */ -PHP_FUNCTION(git_reflog_append) -{ - int result = 0, id_len = 0, msg_len = 0; - zval *reflog = NULL, *committer = NULL; - php_git2_t *_reflog = NULL; - char *id = NULL, *msg = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsas", &reflog, &id, &id_len, &committer, &msg, &msg_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reflog, php_git2_t*, &reflog, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_reflog_append(PHP_GIT2_V(_reflog, reflog), &__id, committer, msg); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reflog_append_to(resource $repo, string $name, string $id, array $committer, string $msg) - */ -PHP_FUNCTION(git_reflog_append_to) -{ - int result = 0, name_len = 0, id_len = 0, msg_len = 0; - zval *repo = NULL, *committer = NULL; - php_git2_t *_repo = NULL; - char *name = NULL, *id = NULL, *msg = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rssas", &repo, &name, &name_len, &id, &id_len, &committer, &msg, &msg_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_reflog_append_to(PHP_GIT2_V(_repo, repository), name, &__id, committer, msg); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reflog_rename(resource $repo, string $old_name, string $name) - */ -PHP_FUNCTION(git_reflog_rename) -{ - int result = 0, old_name_len = 0, name_len = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *old_name = NULL, *name = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &repo, &old_name, &old_name_len, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_rename(PHP_GIT2_V(_repo, repository), old_name, name); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reflog_delete(resource $repo, string $name) - */ -PHP_FUNCTION(git_reflog_delete) -{ - int result = 0, name_len = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *name = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_delete(PHP_GIT2_V(_repo, repository), name); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reflog_entrycount(resource $reflog) - */ -PHP_FUNCTION(git_reflog_entrycount) -{ - size_t result = 0; - zval *reflog = NULL; - php_git2_t *_reflog = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &reflog) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reflog, php_git2_t*, &reflog, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_entrycount(PHP_GIT2_V(_reflog, reflog)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_reflog_entry_byindex(resource $reflog, long $idx) - */ -PHP_FUNCTION(git_reflog_entry_byindex) -{ - const git_reflog_entry *result = NULL; - zval *reflog = NULL; - php_git2_t *_reflog = NULL, *_result; - long idx = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &reflog, &idx) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reflog, php_git2_t*, &reflog, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_entry_byindex(PHP_GIT2_V(_reflog, reflog), idx); - if (php_git2_make_resource(&_result, PHP_GIT2_TYPE_REFLOG_ENTRY, result, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(_result)); -} -/* }}} */ - -/* {{{ proto long git_reflog_drop(resource $reflog, long $idx, long $rewrite_previous_entry) - */ -PHP_FUNCTION(git_reflog_drop) -{ - int result = 0; - zval *reflog = NULL; - php_git2_t *_reflog = NULL; - long idx = 0, rewrite_previous_entry = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rll", &reflog, &idx, &rewrite_previous_entry) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reflog, php_git2_t*, &reflog, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_drop(PHP_GIT2_V(_reflog, reflog), idx, rewrite_previous_entry); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_reflog_entry_id_old(resource $entry) - */ -PHP_FUNCTION(git_reflog_entry_id_old) -{ - const git_oid *result = NULL; - zval *entry = NULL; - php_git2_t *_entry = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &entry) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_entry, php_git2_t*, &entry, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_entry_id_old(PHP_GIT2_V(_entry, reflog_entry)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto string git_reflog_entry_id_new(resource $entry) - */ -PHP_FUNCTION(git_reflog_entry_id_new) -{ - const git_oid *result = NULL; - zval *entry = NULL; - php_git2_t *_entry = NULL; - char __result[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &entry) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_entry, php_git2_t*, &entry, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_entry_id_new(PHP_GIT2_V(_entry, reflog_entry)); - git_oid_fmt(__result, result); - RETURN_STRING(__result, 1); -} -/* }}} */ - -/* {{{ proto array git_reflog_entry_committer(resource $entry) - */ -PHP_FUNCTION(git_reflog_entry_committer) -{ - const git_signature *result = NULL; - zval *__result = NULL, *entry = NULL; - php_git2_t *_entry = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &entry) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_entry, php_git2_t*, &entry, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_entry_committer(PHP_GIT2_V(_entry, reflog_entry)); - php_git2_signature_to_array(result, &__result TSRMLS_CC); - RETURN_ZVAL(__result, 0, 1); -} -/* }}} */ - -/* {{{ proto string git_reflog_entry_message(resource $entry) - */ -PHP_FUNCTION(git_reflog_entry_message) -{ - const char *result = NULL; - zval *entry = NULL; - php_git2_t *_entry = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &entry) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_entry, php_git2_t*, &entry, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reflog_entry_message(PHP_GIT2_V(_entry, reflog_entry)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto void git_reflog_free(resource $reflog) - */ -PHP_FUNCTION(git_reflog_free) -{ - zval *reflog = NULL; - php_git2_t *_reflog = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &reflog) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_reflog, php_git2_t*, &reflog, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_reflog)) { - git_reflog_free(PHP_GIT2_V(_reflog, reflog)); - GIT2_SHOULD_FREE(_reflog) = 0; - }; - zval_ptr_dtor(&reflog); -} -/* }}} */ - diff --git a/reflog.h b/reflog.h deleted file mode 100644 index 5d1ad59618..0000000000 --- a/reflog.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REFLOG_H -#define PHP_GIT2_REFLOG_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_read, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_write, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_append, 0, 0, 4) - ZEND_ARG_INFO(0, reflog) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, committer) - ZEND_ARG_INFO(0, msg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_append_to, 0, 0, 5) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, id) - ZEND_ARG_INFO(0, committer) - ZEND_ARG_INFO(0, msg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_rename, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, old_name) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_delete, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_entrycount, 0, 0, 1) - ZEND_ARG_INFO(0, reflog) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_entry_byindex, 0, 0, 2) - ZEND_ARG_INFO(0, reflog) - ZEND_ARG_INFO(0, idx) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_drop, 0, 0, 3) - ZEND_ARG_INFO(0, reflog) - ZEND_ARG_INFO(0, idx) - ZEND_ARG_INFO(0, rewrite_previous_entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_entry_id_old, 0, 0, 1) - ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_entry_id_new, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_entry_committer, 0, 0, 1) - ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_entry_message, 0, 0, 1) - ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reflog_free, 0, 0, 1) - ZEND_ARG_INFO(0, reflog) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_reflog_read(repo, name) -*/ -PHP_FUNCTION(git_reflog_read); - -/* {{{ proto resource git_reflog_write() -*/ -PHP_FUNCTION(git_reflog_write); - -/* {{{ proto long git_reflog_append(reflog, id, committer, msg) -*/ -PHP_FUNCTION(git_reflog_append); - -/* {{{ proto long git_reflog_append_to(repo, name, id, committer, msg) -*/ -PHP_FUNCTION(git_reflog_append_to); - -/* {{{ proto long git_reflog_rename(repo, old_name, name) -*/ -PHP_FUNCTION(git_reflog_rename); - -/* {{{ proto long git_reflog_delete(repo, name) -*/ -PHP_FUNCTION(git_reflog_delete); - -/* {{{ proto resource git_reflog_entrycount(reflog) -*/ -PHP_FUNCTION(git_reflog_entrycount); - -/* {{{ proto resource git_reflog_entry_byindex(reflog, idx) -*/ -PHP_FUNCTION(git_reflog_entry_byindex); - -/* {{{ proto long git_reflog_drop(reflog, idx, rewrite_previous_entry) -*/ -PHP_FUNCTION(git_reflog_drop); - -/* {{{ proto resource git_reflog_entry_id_old(entry) -*/ -PHP_FUNCTION(git_reflog_entry_id_old); - -/* {{{ proto resource git_reflog_entry_id_new() -*/ -PHP_FUNCTION(git_reflog_entry_id_new); - -/* {{{ proto resource git_reflog_entry_committer(entry) -*/ -PHP_FUNCTION(git_reflog_entry_committer); - -/* {{{ proto resource git_reflog_entry_message(entry) -*/ -PHP_FUNCTION(git_reflog_entry_message); - -/* {{{ proto void git_reflog_free(reflog) -*/ -PHP_FUNCTION(git_reflog_free); - -#endif \ No newline at end of file diff --git a/refspec.c b/refspec.c deleted file mode 100644 index 956d2474f2..0000000000 --- a/refspec.c +++ /dev/null @@ -1,189 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "refspec.h" - -/* {{{ proto string git_refspec_src(resource $refspec) - */ -PHP_FUNCTION(git_refspec_src) -{ - const char *result = NULL; - zval *refspec = NULL; - php_git2_t *_refspec = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &refspec) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_refspec, php_git2_t*, &refspec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_src(PHP_GIT2_V(_refspec, refspec)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto string git_refspec_dst(resource $refspec) - */ -PHP_FUNCTION(git_refspec_dst) -{ - const char *result = NULL; - zval *refspec = NULL; - php_git2_t *_refspec = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &refspec) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_refspec, php_git2_t*, &refspec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_dst(PHP_GIT2_V(_refspec, refspec)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto string git_refspec_string(resource $refspec) - */ -PHP_FUNCTION(git_refspec_string) -{ - const char *result = NULL; - zval *refspec = NULL; - php_git2_t *_refspec = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &refspec) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_refspec, php_git2_t*, &refspec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_string(PHP_GIT2_V(_refspec, refspec)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto long git_refspec_force(resource $refspec) - */ -PHP_FUNCTION(git_refspec_force) -{ - int result = 0; - zval *refspec = NULL; - php_git2_t *_refspec = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &refspec) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_refspec, php_git2_t*, &refspec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_force(PHP_GIT2_V(_refspec, refspec)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_refspec_direction(resource $spec) - */ -PHP_FUNCTION(git_refspec_direction) -{ - git_direction result; - zval *spec = NULL; - php_git2_t *_spec = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &spec) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_spec, php_git2_t*, &spec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_direction(PHP_GIT2_V(_spec, refspec)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_refspec_src_matches(resource $refspec, string $refname) - */ -PHP_FUNCTION(git_refspec_src_matches) -{ - int result = 0, refname_len = 0; - zval *refspec = NULL; - php_git2_t *_refspec = NULL; - char *refname = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &refspec, &refname, &refname_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_refspec, php_git2_t*, &refspec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_src_matches(PHP_GIT2_V(_refspec, refspec), refname); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_refspec_dst_matches(resource $refspec, string $refname) - */ -PHP_FUNCTION(git_refspec_dst_matches) -{ - int result = 0, refname_len = 0; - zval *refspec = NULL; - php_git2_t *_refspec = NULL; - char *refname = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &refspec, &refname, &refname_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_refspec, php_git2_t*, &refspec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_refspec_dst_matches(PHP_GIT2_V(_refspec, refspec), refname); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto string git_refspec_transform(long $outlen, resource $spec, string $name) - */ -PHP_FUNCTION(git_refspec_transform) -{ - // TODO(chobie): fix this implementation - php_git2_t *_spec = NULL; - char out = NULL, *name = NULL; - long outlen = 0; - zval *spec = NULL; - int name_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "lrs", &outlen, &spec, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_spec, php_git2_t*, &spec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_refspec_transform(&out, outlen, PHP_GIT2_V(_spec, refspec), name); - if (php_git2_check_error(error, "git_refspec_transform" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(out, 1); -} -/* }}} */ - -/* {{{ proto string git_refspec_rtransform(long $outlen, resource $spec, string $name) - */ -PHP_FUNCTION(git_refspec_rtransform) -{ - // TODO(chobie): fix this implementation - php_git2_t *_spec = NULL; - char out = NULL, *name = NULL; - long outlen = 0; - zval *spec = NULL; - int name_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "lrs", &outlen, &spec, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_spec, php_git2_t*, &spec, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_refspec_rtransform(&out, outlen, PHP_GIT2_V(_spec, refspec), name); - if (php_git2_check_error(error, "git_refspec_rtransform" TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_STRING(out, 1); -} -/* }}} */ - diff --git a/refspec.h b/refspec.h deleted file mode 100644 index 4ca4118c50..0000000000 --- a/refspec.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REFSPEC_H -#define PHP_GIT2_REFSPEC_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_src, 0, 0, 1) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_dst, 0, 0, 1) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_string, 0, 0, 1) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_force, 0, 0, 1) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_direction, 0, 0, 1) - ZEND_ARG_INFO(0, spec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_src_matches, 0, 0, 2) - ZEND_ARG_INFO(0, refspec) - ZEND_ARG_INFO(0, refname) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_dst_matches, 0, 0, 2) - ZEND_ARG_INFO(0, refspec) - ZEND_ARG_INFO(0, refname) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_transform, 0, 0, 4) - ZEND_ARG_INFO(0, out) - ZEND_ARG_INFO(0, outlen) - ZEND_ARG_INFO(0, spec) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_refspec_rtransform, 0, 0, 4) - ZEND_ARG_INFO(0, out) - ZEND_ARG_INFO(0, outlen) - ZEND_ARG_INFO(0, spec) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -/* {{{ proto string git_refspec_src(resource $refspec) - */ -PHP_FUNCTION(git_refspec_src); - -/* {{{ proto string git_refspec_dst(resource $refspec) - */ -PHP_FUNCTION(git_refspec_dst); - -/* {{{ proto string git_refspec_string(resource $refspec) - */ -PHP_FUNCTION(git_refspec_string); - -/* {{{ proto long git_refspec_force(resource $refspec) - */ -PHP_FUNCTION(git_refspec_force); - -/* {{{ proto resource git_refspec_direction(resource $spec) - */ -PHP_FUNCTION(git_refspec_direction); - -/* {{{ proto long git_refspec_src_matches(resource $refspec, string $refname) - */ -PHP_FUNCTION(git_refspec_src_matches); - -/* {{{ proto long git_refspec_dst_matches(resource $refspec, string $refname) - */ -PHP_FUNCTION(git_refspec_dst_matches); - -/* {{{ proto resource git_refspec_transform(long $outlen, resource $spec, string $name) - */ -PHP_FUNCTION(git_refspec_transform); - -/* {{{ proto resource git_refspec_rtransform(long $outlen, resource $spec, string $name) - */ -PHP_FUNCTION(git_refspec_rtransform); - -#endif diff --git a/remote.c b/remote.c deleted file mode 100644 index 6820d3e6e5..0000000000 --- a/remote.c +++ /dev/null @@ -1,1004 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "remote.h" - -/* {{{ proto resource git_remote_create(resource $repo, string $name, string $url) - */ -PHP_FUNCTION(git_remote_create) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_remote *out = NULL; - zval *repo = NULL; - char *name = NULL, *url = NULL; - int name_len = 0, url_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &repo, &name, &name_len, &url, &url_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_create(&out, PHP_GIT2_V(_repo, repository), name, url); - if (php_git2_check_error(error, "git_remote_create" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REMOTE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_remote_create_with_fetchspec(resource $repo, string $name, string $url, string $fetch) - */ -PHP_FUNCTION(git_remote_create_with_fetchspec) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_remote *out = NULL; - zval *repo = NULL; - char *name = NULL, *url = NULL, *fetch = NULL; - int name_len = 0, url_len = 0, fetch_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsss", &repo, &name, &name_len, &url, &url_len, &fetch, &fetch_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_create_with_fetchspec(&out, PHP_GIT2_V(_repo, repository), name, url, fetch); - if (php_git2_check_error(error, "git_remote_create_with_fetchspec" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REMOTE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_remote_create_inmemory(resource $repo, string $fetch, string $url) - */ -PHP_FUNCTION(git_remote_create_inmemory) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_remote *out = NULL; - zval *repo = NULL; - char *fetch = NULL, *url = NULL; - int fetch_len = 0, url_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rss", &repo, &fetch, &fetch_len, &url, &url_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_create_inmemory(&out, PHP_GIT2_V(_repo, repository), fetch, url); - if (php_git2_check_error(error, "git_remote_create_inmemory" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REMOTE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_remote_load(resource $repo, string $name) - */ -PHP_FUNCTION(git_remote_load) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_remote *out = NULL; - zval *repo = NULL; - char *name = NULL; - int name_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &name, &name_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_load(&out, PHP_GIT2_V(_repo, repository), name); - if (php_git2_check_error(error, "git_remote_load" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REMOTE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto long git_remote_save(resource $remote) - */ -PHP_FUNCTION(git_remote_save) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_save(PHP_GIT2_V(_remote, remote)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto resource git_remote_owner(resource $remote) - */ -PHP_FUNCTION(git_remote_owner) -{ - git_repository *result = NULL; - zval *remote = NULL; - php_git2_t *_remote = NULL, *__result = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_owner(PHP_GIT2_V(_remote, remote)); - if (php_git2_make_resource(&__result, PHP_GIT2_TYPE_REMOTE, result, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(__result)); -} -/* }}} */ - -/* {{{ proto string git_remote_name(resource $remote) - */ -PHP_FUNCTION(git_remote_name) -{ - const char *result = NULL; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_name(PHP_GIT2_V(_remote, remote)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto string git_remote_url(resource $remote) - */ -PHP_FUNCTION(git_remote_url) -{ - const char *result = NULL; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_url(PHP_GIT2_V(_remote, remote)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto string git_remote_pushurl(resource $remote) - */ -PHP_FUNCTION(git_remote_pushurl) -{ - const char *result = NULL; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_pushurl(PHP_GIT2_V(_remote, remote)); - RETURN_STRING(result, 1); -} -/* }}} */ - -/* {{{ proto long git_remote_set_url(resource $remote, string $url) - */ -PHP_FUNCTION(git_remote_set_url) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - char *url = NULL; - int url_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &remote, &url, &url_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_set_url(PHP_GIT2_V(_remote, remote), url); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto long git_remote_set_pushurl(resource $remote, string $url) - */ -PHP_FUNCTION(git_remote_set_pushurl) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - char *url = NULL; - int url_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &remote, &url, &url_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_set_pushurl(PHP_GIT2_V(_remote, remote), url); - RETURN_BOOL(result); -} -/* }}} */ - - -/* {{{ proto long git_remote_add_fetch(resource $remote, string $refspec) - */ -PHP_FUNCTION(git_remote_add_fetch) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - char *refspec = NULL; - int refspec_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &remote, &refspec, &refspec_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_add_fetch(PHP_GIT2_V(_remote, remote), refspec); - RETURN_BOOL(result); -} -/* }}} */ - - -/* {{{ proto array git_remote_get_fetch_refspecs(resource $remote) - */ -PHP_FUNCTION(git_remote_get_fetch_refspecs) -{ - zval *result; - git_strarray array = {0}; - zval *remote = NULL; - php_git2_t *_remote = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_get_fetch_refspecs(&array, PHP_GIT2_V(_remote, remote)); - php_git2_strarray_to_array(&array, &result TSRMLS_CC); - git_strarray_free(&array); - - RETURN_ZVAL(result, 0, 1); - -} -/* }}} */ - - -/* {{{ proto long git_remote_set_fetch_refspecs(resource $remote, array $array) - */ -PHP_FUNCTION(git_remote_set_fetch_refspecs) -{ - int result = 0; - zval *remote = NULL, *array = NULL; - php_git2_t *_remote = NULL; - git_strarray out = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ra", &remote, &array) == FAILURE) { - return; - } - - php_git2_array_to_strarray(&out, array TSRMLS_CC); - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_set_fetch_refspecs(PHP_GIT2_V(_remote, remote), &out); - php_git2_strarray_free(&out); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_remote_add_push(resource $remote, string $refspec) - */ -PHP_FUNCTION(git_remote_add_push) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - char *refspec = NULL; - int refspec_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &remote, &refspec, &refspec_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_add_push(PHP_GIT2_V(_remote, remote), refspec); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_remote_get_push_refspecs(array $array, resource $remote) - */ -PHP_FUNCTION(git_remote_get_push_refspecs) -{ - git_strarray _array = {0}; - zval *remote = NULL, *array = NULL; - php_git2_t *_remote = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ar", &array, &remote) == FAILURE) { - return; - } - - php_git2_strarray_to_array(&_array, array TSRMLS_CC); - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_get_push_refspecs(&_array, PHP_GIT2_V(_remote, remote)); - git_strarray_free(&_array); - - RETURN_LONG(error); -} -/* }}} */ - - -/* {{{ proto long git_remote_set_push_refspecs(resource $remote, array $array) - */ -PHP_FUNCTION(git_remote_set_push_refspecs) -{ - int result = 0; - zval *remote = NULL, *array = NULL; - php_git2_t *_remote = NULL; - git_strarray _array = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote, &array) == FAILURE) { - return; - } - - php_git2_strarray_to_array(&_array, array TSRMLS_CC); - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_set_push_refspecs(PHP_GIT2_V(_remote, remote), &_array); - git_strarray_free(&_array); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto void git_remote_clear_refspecs(resource $remote) - */ -PHP_FUNCTION(git_remote_clear_refspecs) -{ - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_clear_refspecs(PHP_GIT2_V(_remote, remote)); -} -/* }}} */ - - -/* {{{ proto long git_remote_refspec_count(resource $remote) - */ -PHP_FUNCTION(git_remote_refspec_count) -{ - size_t result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_refspec_count(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto resource git_remote_get_refspec(resource $remote, long $n) - */ -PHP_FUNCTION(git_remote_get_refspec) -{ - const git_refspec *result = NULL; - zval *remote = NULL; - php_git2_t *_remote = NULL, *out; - long n = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &remote, &n) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_get_refspec(PHP_GIT2_V(_remote, remote), n); - if (php_git2_make_resource(&out, PHP_GIT2_TYPE_REFSPEC, result, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(out)); -} -/* }}} */ - -/* {{{ proto bool git_remote_connect(resource $remote, long $direction) - */ -PHP_FUNCTION(git_remote_connect) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - long direction = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &remote, &direction) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_connect(PHP_GIT2_V(_remote, remote), direction); - RETURN_BOOL(result); -} -/* }}} */ - -static void php_git2_git_remote_head_to_array(git_remote_head *head, zval **out TSRMLS_DC) -{ - zval *result = NULL; - char oid[41] = {0}, loid[41] = {0}; - - - git_oid_fmt(oid, &head->oid); - git_oid_fmt(loid, &head->loid); - - MAKE_STD_ZVAL(result); - array_init(result); - add_assoc_long_ex(result, ZEND_STRS("local"), head->local); - add_assoc_string_ex(result, ZEND_STRS("oid"), oid, 1); - add_assoc_string_ex(result, ZEND_STRS("loid"), loid, 1); - add_assoc_string_ex(result, ZEND_STRS("name"), head->name, 1); - - *out = result; -} - -/* {{{ proto resource git_remote_ls(resource $remote) - */ -PHP_FUNCTION(git_remote_ls) -{ - git_remote_head **out = NULL; - size_t size = 0; - zval *remote = NULL, *retval = NULL, *container = NULL; - php_git2_t *_remote = NULL; - int error = 0, i = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - if (git_remote_connected(PHP_GIT2_V(_remote, remote)) == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "passed git_remote hasn't been connected"); - RETURN_FALSE; - } - error = git_remote_ls(&out, &size, PHP_GIT2_V(_remote, remote)); - if (php_git2_check_error(error, "git_remote_ls" TSRMLS_CC)) { - RETURN_FALSE; - } - - MAKE_STD_ZVAL(container); - array_init(container); - for (i = 0; i < size; i++) { - php_git2_git_remote_head_to_array(out[i], &retval TSRMLS_CC); - add_next_index_zval(container, retval); - } - RETURN_ZVAL(container, 0, 1); -} -/* }}} */ - - -/* {{{ proto long git_remote_download(resource $remote) - */ -PHP_FUNCTION(git_remote_download) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_download(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_remote_connected(resource $remote) - */ -PHP_FUNCTION(git_remote_connected) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_connected(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_remote_stop(resource $remote) - */ -PHP_FUNCTION(git_remote_stop) -{ - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_stop(PHP_GIT2_V(_remote, remote)); -} -/* }}} */ - -/* {{{ proto void git_remote_disconnect(resource $remote) - */ -PHP_FUNCTION(git_remote_disconnect) -{ - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_disconnect(PHP_GIT2_V(_remote, remote)); -} -/* }}} */ - - -/* {{{ proto void git_remote_free(resource $remote) - */ -PHP_FUNCTION(git_remote_free) -{ - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (_remote->should_free_v) { - git_remote_free(PHP_GIT2_V(_remote, remote)); - }; - zval_ptr_dtor(&remote); -} -/* }}} */ - - -/* {{{ proto long git_remote_update_tips(resource $remote) - */ -PHP_FUNCTION(git_remote_update_tips) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_update_tips(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_remote_fetch(resource $remote) - */ -PHP_FUNCTION(git_remote_fetch) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_fetch(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_remote_valid_url(string $url) - */ -PHP_FUNCTION(git_remote_valid_url) -{ - int result = 0; - char *url = NULL; - int url_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &url, &url_len) == FAILURE) { - return; - } - - result = git_remote_valid_url(url); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_remote_supported_url(string $url) - */ -PHP_FUNCTION(git_remote_supported_url) -{ - int result = 0; - char *url = NULL; - int url_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &url, &url_len) == FAILURE) { - return; - } - - result = git_remote_supported_url(url); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto resource git_remote_list(resource $repo) - */ -PHP_FUNCTION(git_remote_list) -{ - zval *result = NULL; - git_strarray out = {0}; - zval *repo = NULL; - php_git2_t *_repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_remote_list(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_remote_list" TSRMLS_CC)) { - RETURN_FALSE; - } - - php_git2_strarray_to_array(&out, &result TSRMLS_CC); - git_strarray_free(&out); - - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ - - -/* {{{ proto void git_remote_check_cert(resource $remote, long $check) - */ -PHP_FUNCTION(git_remote_check_cert) -{ - zval *remote = NULL; - php_git2_t *_remote = NULL; - long check = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &remote, &check) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_check_cert(PHP_GIT2_V(_remote, remote), check); -} -/* }}} */ - - -/* {{{ proto long git_remote_set_transport(resource $remote, resource $transport) - */ -PHP_FUNCTION(git_remote_set_transport) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - zval *transport = NULL; - php_git2_t *_transport = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rr", &remote, &transport) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_transport, php_git2_t*, &transport, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_set_transport(PHP_GIT2_V(_remote, remote), PHP_GIT2_V(_transport, transport)); - RETURN_LONG(result); -} -/* }}} */ - -typedef struct php_git2_remote_cb_t { - php_git2_fcall_t callbacks[4]; - zval *payload; - GIT2_TSRMLS_DECL -} php_git2_remote_cb_t; - -static int cred_cb(git_cred **cred, const char *url, const char *username_from_url, unsigned int allowed_types, void *data) -{ - php_git2_t *result; - zval *param_url = NULL, *param_username_from_url = NULL, *param_allowed_types = NULL, *retval_ptr; - php_git2_remote_cb_t *cb = (php_git2_remote_cb_t*)data; - GIT2_TSRMLS_SET(cb->tsrm_ls); - int retval = 1; - - if (cb != NULL) { - MAKE_STD_ZVAL(param_url); - MAKE_STD_ZVAL(param_username_from_url); - MAKE_STD_ZVAL(param_allowed_types); - ZVAL_NULL(param_url); - ZVAL_NULL(param_username_from_url); - - if (url != NULL) { - ZVAL_STRING(param_url, url, 1); - } - if (username_from_url != NULL) { - ZVAL_STRING(param_username_from_url, username_from_url, 1); - } - ZVAL_LONG(param_allowed_types, allowed_types); - Z_ADDREF_P(cb->payload); - SEPARATE_ZVAL_TO_MAKE_IS_REF(&cb->payload); - - if (php_git2_call_function_v(&cb->callbacks[0].fci, &cb->callbacks[0].fcc TSRMLS_CC, &retval_ptr, 4, - ¶m_url, ¶m_username_from_url, ¶m_allowed_types, &cb->payload)) { - fprintf(stderr, "CALL FUNCTION ERROR"); - } - } - - if (retval_ptr && Z_TYPE_P(retval_ptr) == IS_RESOURCE) { - ZEND_FETCH_RESOURCE_NO_RETURN(result, php_git2_t*, &retval_ptr, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - *cred = PHP_GIT2_V(result, cred); - zval_ptr_dtor(&retval_ptr); - } - return retval; -} - -/* {{{ proto long git_remote_set_callbacks(remote, callbacks) -*/ -PHP_FUNCTION(git_remote_set_callbacks) -{ - zval *remote; - php_git2_t *_remote; - zval *callbacks, *credentials_cb = NULL; - struct git_remote_callbacks cb = GIT_REMOTE_CALLBACKS_INIT; - php_git2_remote_cb_t *_payload = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ra", &remote, &callbacks) == FAILURE) { - return; - } - - /* TODO(chobie): support other callbacks */ - cb.credentials = cred_cb; - credentials_cb = php_git2_read_arrval(callbacks, ZEND_STRS("credentials") TSRMLS_CC); - - /* TODO(chobie): can we free payload? */ - _payload = emalloc(sizeof(php_git2_remote_cb_t)); - MAKE_STD_ZVAL(_payload->payload); - GIT2_TSRMLS_SET2(_payload, TSRMLS_C); - - if (credentials_cb != NULL) { - char *is_callable_error; - - if(zend_fcall_info_init(credentials_cb, 0, &(_payload->callbacks[0].fci), &(_payload->callbacks[0].fci), NULL, &is_callable_error TSRMLS_CC) == SUCCESS) { - if (is_callable_error) { - efree(is_callable_error); - } - } - Z_ADDREF_P(credentials_cb); - } - cb.payload = _payload; - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_set_callbacks(PHP_GIT2_V(_remote, remote), &cb); -} - -/* {{{ proto resource git_remote_stats(resource $remote) - */ -PHP_FUNCTION(git_remote_stats) -{ - const git_transfer_progress *result = NULL; - zval *remote = NULL, *retval = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_stats(PHP_GIT2_V(_remote, remote)); - php_git2_git_transfer_progress_to_array(result, &retval TSRMLS_CC); - RETURN_ZVAL(retval, 0, 1); -} -/* }}} */ - - -/* {{{ proto resource git_remote_autotag(resource $remote) - */ -PHP_FUNCTION(git_remote_autotag) -{ - git_remote_autotag_option_t result; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_autotag(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_remote_set_autotag(resource $remote, $value) - */ -PHP_FUNCTION(git_remote_set_autotag) -{ - zval *remote = NULL, *value = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &remote, &value) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_set_autotag(PHP_GIT2_V(_remote, remote), Z_LVAL_P(value)); -} -/* }}} */ - - -static int php_git2_git_remote_rename_problem_cb(const char *problematic_refspec, void *payload) -{ - return 0; -} - - -/* {{{ proto long git_remote_rename(resource $remote, string $new_name, Callable $callback, $payload) - */ -PHP_FUNCTION(git_remote_rename) -{ - int result = 0, new_name_len = 0; - zval *remote = NULL, *payload = NULL; - php_git2_t *_remote = NULL; - char *new_name = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsfz", &remote, &new_name, &new_name_len, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_remote_rename(PHP_GIT2_V(_remote, remote), new_name, php_git2_git_remote_rename_problem_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_remote_update_fetchhead(resource $remote) - */ -PHP_FUNCTION(git_remote_update_fetchhead) -{ - int result = 0; - zval *remote = NULL; - php_git2_t *_remote = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &remote) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_remote_update_fetchhead(PHP_GIT2_V(_remote, remote)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto void git_remote_set_update_fetchhead(resource $remote, long $value) - */ -PHP_FUNCTION(git_remote_set_update_fetchhead) -{ - zval *remote = NULL; - php_git2_t *_remote = NULL; - long value = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &remote, &value) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_remote, php_git2_t*, &remote, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_remote_set_update_fetchhead(PHP_GIT2_V(_remote, remote), value); -} -/* }}} */ - -/* {{{ proto long git_remote_is_valid_name(string $remote_name) - */ -PHP_FUNCTION(git_remote_is_valid_name) -{ - int result = 0; - char *remote_name = NULL; - int remote_name_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &remote_name, &remote_name_len) == FAILURE) { - return; - } - - result = git_remote_is_valid_name(remote_name); - RETURN_BOOL(result); -} -/* }}} */ - diff --git a/remote.h b/remote.h deleted file mode 100644 index c5d1f90d14..0000000000 --- a/remote.h +++ /dev/null @@ -1,391 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REMOTE_H -#define PHP_GIT2_REMOTE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_create, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, url) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_create_with_fetchspec, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, url) - ZEND_ARG_INFO(0, fetch) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_create_inmemory, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, fetch) - ZEND_ARG_INFO(0, url) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_load, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_save, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_owner, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_name, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_url, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_pushurl, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_url, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, url) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_pushurl, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, url) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_add_fetch, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_get_fetch_refspecs, 0, 0, 2) - ZEND_ARG_INFO(0, array) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_fetch_refspecs, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, array) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_add_push, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, refspec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_get_push_refspecs, 0, 0, 2) - ZEND_ARG_INFO(0, array) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_push_refspecs, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, array) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_clear_refspecs, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_refspec_count, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_get_refspec, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, n) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_connect, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, direction) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_ls, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_download, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_connected, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_stop, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_disconnect, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_free, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_update_tips, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_fetch, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_valid_url, 0, 0, 1) - ZEND_ARG_INFO(0, url) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_supported_url, 0, 0, 1) - ZEND_ARG_INFO(0, url) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_list, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_check_cert, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, check) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_transport, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, transport) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_callbacks, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, callbacks) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_stats, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_autotag, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_autotag, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_rename, 0, 0, 4) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, new_name) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_update_fetchhead, 0, 0, 1) - ZEND_ARG_INFO(0, remote) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_set_update_fetchhead, 0, 0, 2) - ZEND_ARG_INFO(0, remote) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_remote_is_valid_name, 0, 0, 1) - ZEND_ARG_INFO(0, remote_name) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_remote_create(repo, name, url) -*/ -PHP_FUNCTION(git_remote_create); - -/* {{{ proto resource git_remote_create_with_fetchspec(repo, name, url, fetch) -*/ -PHP_FUNCTION(git_remote_create_with_fetchspec); - -/* {{{ proto resource git_remote_create_inmemory(repo, fetch, url) -*/ -PHP_FUNCTION(git_remote_create_inmemory); - -/* {{{ proto resource git_remote_load(repo, name) -*/ -PHP_FUNCTION(git_remote_load); - -/* {{{ proto long git_remote_save(remote) -*/ -PHP_FUNCTION(git_remote_save); - -/* {{{ proto resource git_remote_owner(remote) -*/ -PHP_FUNCTION(git_remote_owner); - -/* {{{ proto resource git_remote_name(remote) -*/ -PHP_FUNCTION(git_remote_name); - -/* {{{ proto resource git_remote_url(remote) -*/ -PHP_FUNCTION(git_remote_url); - -/* {{{ proto resource git_remote_pushurl(remote) -*/ -PHP_FUNCTION(git_remote_pushurl); - -/* {{{ proto long git_remote_set_url(remote, url) -*/ -PHP_FUNCTION(git_remote_set_url); - -/* {{{ proto long git_remote_set_pushurl(remote, url) -*/ -PHP_FUNCTION(git_remote_set_pushurl); - -/* {{{ proto long git_remote_add_fetch(remote, refspec) -*/ -PHP_FUNCTION(git_remote_add_fetch); - -/* {{{ proto long git_remote_get_fetch_refspecs(array, remote) -*/ -PHP_FUNCTION(git_remote_get_fetch_refspecs); - -/* {{{ proto long git_remote_set_fetch_refspecs(remote, array) -*/ -PHP_FUNCTION(git_remote_set_fetch_refspecs); - -/* {{{ proto long git_remote_add_push(remote, refspec) -*/ -PHP_FUNCTION(git_remote_add_push); - -/* {{{ proto long git_remote_get_push_refspecs(array, remote) -*/ -PHP_FUNCTION(git_remote_get_push_refspecs); - -/* {{{ proto long git_remote_set_push_refspecs(remote, array) -*/ -PHP_FUNCTION(git_remote_set_push_refspecs); - -/* {{{ proto void git_remote_clear_refspecs(remote) -*/ -PHP_FUNCTION(git_remote_clear_refspecs); - -/* {{{ proto resource git_remote_refspec_count(remote) -*/ -PHP_FUNCTION(git_remote_refspec_count); - -/* {{{ proto resource git_remote_get_refspec(remote, n) -*/ -PHP_FUNCTION(git_remote_get_refspec); - -/* {{{ proto long git_remote_connect(remote, direction) -*/ -PHP_FUNCTION(git_remote_connect); - -/* {{{ proto resource git_remote_ls(remote) -*/ -PHP_FUNCTION(git_remote_ls); - -/* {{{ proto long git_remote_download(remote) -*/ -PHP_FUNCTION(git_remote_download); - -/* {{{ proto long git_remote_connected(remote) -*/ -PHP_FUNCTION(git_remote_connected); - -/* {{{ proto void git_remote_stop(remote) -*/ -PHP_FUNCTION(git_remote_stop); - -/* {{{ proto void git_remote_disconnect(remote) -*/ -PHP_FUNCTION(git_remote_disconnect); - -/* {{{ proto void git_remote_free(remote) -*/ -PHP_FUNCTION(git_remote_free); - -/* {{{ proto long git_remote_update_tips(remote) -*/ -PHP_FUNCTION(git_remote_update_tips); - -/* {{{ proto long git_remote_fetch(remote) -*/ -PHP_FUNCTION(git_remote_fetch); - -/* {{{ proto long git_remote_valid_url(url) -*/ -PHP_FUNCTION(git_remote_valid_url); - -/* {{{ proto long git_remote_supported_url(url) -*/ -PHP_FUNCTION(git_remote_supported_url); - -/* {{{ proto resource git_remote_list(repo) -*/ -PHP_FUNCTION(git_remote_list); - -/* {{{ proto void git_remote_check_cert(remote, check) -*/ -PHP_FUNCTION(git_remote_check_cert); - -/* {{{ proto long git_remote_set_transport(remote, transport) -*/ -PHP_FUNCTION(git_remote_set_transport); - -/* {{{ proto long git_remote_set_callbacks(remote, callbacks) -*/ -PHP_FUNCTION(git_remote_set_callbacks); - -/* {{{ proto resource git_remote_stats(remote) -*/ -PHP_FUNCTION(git_remote_stats); - -/* {{{ proto resource git_remote_autotag(remote) -*/ -PHP_FUNCTION(git_remote_autotag); - -/* {{{ proto void git_remote_set_autotag(remote, value) -*/ -PHP_FUNCTION(git_remote_set_autotag); - -/* {{{ proto long git_remote_rename(remote, new_name, callback, payload) -*/ -PHP_FUNCTION(git_remote_rename); - -/* {{{ proto long git_remote_update_fetchhead(remote) -*/ -PHP_FUNCTION(git_remote_update_fetchhead); - -/* {{{ proto void git_remote_set_update_fetchhead(remote, value) -*/ -PHP_FUNCTION(git_remote_set_update_fetchhead); - -/* {{{ proto long git_remote_is_valid_name(remote_name) -*/ -PHP_FUNCTION(git_remote_is_valid_name); - -#endif \ No newline at end of file diff --git a/repository.c b/repository.c deleted file mode 100644 index 49415fedb4..0000000000 --- a/repository.c +++ /dev/null @@ -1,940 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "repository.h" - -static void php_git2_array_to_git_repository_init_options(git_repository_init_options *opts, zval *array TSRMLS_DC) -{ - long lval; - - lval = php_git2_read_arrval_long(array, ZEND_STRS("version") TSRMLS_CC); - if (lval > 0) { - opts->version = lval; - } - opts->flags = php_git2_read_arrval_long(array, ZEND_STRS("flags") TSRMLS_CC); - opts->mode = php_git2_read_arrval_long(array, ZEND_STRS("mode") TSRMLS_CC); - - opts->workdir_path = php_git2_read_arrval_string(array, ZEND_STRS("workdir_path") TSRMLS_CC); - opts->description = php_git2_read_arrval_string(array, ZEND_STRS("description") TSRMLS_CC); - opts->template_path = php_git2_read_arrval_string(array, ZEND_STRS("template_path") TSRMLS_CC); - opts->initial_head = php_git2_read_arrval_string(array, ZEND_STRS("initial_head") TSRMLS_CC); - opts->origin_url = php_git2_read_arrval_string(array, ZEND_STRS("origin_url") TSRMLS_CC); -} - -static void php_git2_git_repository_init_options_to_array(git_repository_init_options *opts, zval **out TSRMLS_DC) -{ - zval *result; - MAKE_STD_ZVAL(result); - array_init(result); - - add_assoc_long_ex(result, ZEND_STRS("version"), opts->version); - add_assoc_long_ex(result, ZEND_STRS("flags"), opts->flags); - add_assoc_long_ex(result, ZEND_STRS("mode"), opts->mode); - - if (opts->workdir_path != NULL) { - add_assoc_string_ex(result, ZEND_STRS("workdir_path"), opts->workdir_path, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("workdir_path")); - } - - if (opts->workdir_path != NULL) { - add_assoc_string_ex(result, ZEND_STRS("description"), opts->description, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("description")); - } - - if (opts->workdir_path != NULL) { - add_assoc_string_ex(result, ZEND_STRS("template_path"), opts->template_path, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("template_path")); - } - - if (opts->workdir_path != NULL) { - add_assoc_string_ex(result, ZEND_STRS("initial_head"), opts->initial_head, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("initial_head")); - } - - if (opts->workdir_path != NULL) { - add_assoc_string_ex(result, ZEND_STRS("origin_url"), opts->origin_url, 1); - } else { - add_assoc_null_ex(result, ZEND_STRS("origin_url")); - } - *out = result; -} - - -static int php_git2_repository_fetchhead_foreach_cb(const char *ref_name, - const char *remote_url, - const git_oid *oid, - unsigned int is_merge, - void *payload) -{ - zval *param_ref_name, *param_remote_url, *param_oid, *param_is_merge, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - char _oid[GIT2_OID_HEXSIZE] = {0}; - GIT2_TSRMLS_SET(p->tsrm_ls) - - git_oid_fmt(_oid, oid); - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_ref_name); - MAKE_STD_ZVAL(param_remote_url); - MAKE_STD_ZVAL(param_oid); - MAKE_STD_ZVAL(param_is_merge); - ZVAL_STRING(param_ref_name, ref_name, 1); - ZVAL_STRING(param_remote_url, remote_url, 1); - ZVAL_STRING(param_oid, _oid, 1); - ZVAL_BOOL(param_is_merge, is_merge); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 5, - ¶m_ref_name, - ¶m_remote_url, - ¶m_oid, - ¶m_is_merge, - &p->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -static int php_git2_repository_mergehead_foreach_cb(const git_oid *oid, - void *payload) -{ - zval *param_oid, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - char _oid[GIT2_OID_HEXSIZE] = {0}; - GIT2_TSRMLS_SET(p->tsrm_ls) - - git_oid_fmt(_oid, oid); - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_oid); - ZVAL_STRING(param_oid, _oid, 1); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 2, ¶m_oid, &p->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -/* {{{ proto resource git_repository_new() -*/ -PHP_FUNCTION(git_repository_new) -{ - git_repository *repository; - php_git2_t *git2; - int error; - - error = git_repository_new(&repository); - if (php_git2_check_error(error, "git_repository_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&git2, PHP_GIT2_TYPE_REPOSITORY, repository, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(git2)); -} - -/* {{{ proto resource git_repository_init(string $path, long is_bare = 0) -*/ -PHP_FUNCTION(git_repository_init) -{ - git_repository *repository; - php_git2_t *git2; - char *path; - int error, path_len, is_bare = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s|l", &path, &path_len, &is_bare) == FAILURE) { - return; - } - error = git_repository_init(&repository, path, is_bare); - if (php_git2_check_error(error, "git_repository_init" TSRMLS_CC)) { - RETURN_FALSE - } - if (php_git2_make_resource(&git2, PHP_GIT2_TYPE_REPOSITORY, repository, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(git2)); -} - -/* {{{ proto resource git_repository_open(string $path) -*/ -PHP_FUNCTION(git_repository_open_bare) -{ - char *path; - int path_len; - git_repository *repository; - int error = 0; - php_git2_t *git2; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &path, &path_len) == FAILURE) { - return; - } - - error = git_repository_open_bare(&repository, path); - if (php_git2_check_error(error, "git_repository_open_bare" TSRMLS_CC)) { - RETURN_FALSE - } - if (php_git2_make_resource(&git2, PHP_GIT2_TYPE_REPOSITORY, repository, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(git2)); -} - -/* {{{ proto resource git_repository_open(string $path) - */ -PHP_FUNCTION(git_repository_open) -{ - php_git2_t *result = NULL; - git_repository *out = NULL; - char *path = NULL; - int path_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s", &path, &path_len) == FAILURE) { - return; - } - - error = git_repository_open(&out, path); - if (php_git2_check_error(error, "git_repository_open" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REPOSITORY, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto string git_repository_get_namespace(resource $repository) -*/ -PHP_FUNCTION(git_repository_get_namespace) -{ - zval *repository; - php_git2_t *git2; - const char *ns; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repository) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &repository, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ns = git_repository_get_namespace(PHP_GIT2_V(git2, repository)); - if (ns != NULL) { - RETURN_STRING(ns, 1); - } else { - RETURN_STRING("", 1); - } -} -/* }}} */ - -/* {{{ proto string git_repository_workdir(resource $repository) -*/ -PHP_FUNCTION(git_repository_workdir) -{ - zval *repository; - php_git2_t *git2; - const char *workdir; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repository) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(git2, php_git2_t*, &repository, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - workdir = git_repository_workdir(PHP_GIT2_V(git2, repository)); - if (workdir != NULL) { - RETURN_STRING(workdir, 1); - } else { - RETURN_STRING("", 1); - } -} -/* }}} */ - -/* {{{ proto resource git_repository_wrap_odb(resource $odb) - */ -PHP_FUNCTION(git_repository_wrap_odb) -{ - php_git2_t *result = NULL; - git_repository *out = NULL; - zval *odb = NULL; - php_git2_t *_odb = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &odb) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_odb, php_git2_t*, &odb, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_wrap_odb(&out, PHP_GIT2_V(_odb, odb)); - if (php_git2_check_error(error, "git_repository_wrap_odb" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REPOSITORY, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_repository_discover(start_path, across_fs, ceiling_dirs) -*/ -PHP_FUNCTION(git_repository_discover) -{ - char *start_path = {0}; - int start_path_len; - long across_fs; - char *ceiling_dirs = {0}; - int ceiling_dirs_len; - int error = 0; - char buffer[GIT2_BUFFER_SIZE]; - size_t buffer_len = GIT2_BUFFER_SIZE; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sls", &start_path, &start_path_len, &across_fs, &ceiling_dirs, &ceiling_dirs_len) == FAILURE) { - return; - } - - error = git_repository_discover(buffer, buffer_len, start_path, across_fs, ceiling_dirs); - if (php_git2_check_error(error, "git_repository_discover" TSRMLS_CC)) { - RETURN_FALSE - } - - RETURN_STRING(buffer, 1); -} - -/* {{{ proto resource git_repository_open_ext(string $path, long $flags, string $ceiling_dirs) - */ -PHP_FUNCTION(git_repository_open_ext) -{ - php_git2_t *result = NULL; - git_repository *out = NULL; - char *path = NULL; - int path_len = 0; - long flags = 0; - char *ceiling_dirs = NULL; - int ceiling_dirs_len = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sls", &path, &path_len, &flags, &ceiling_dirs, &ceiling_dirs_len) == FAILURE) { - return; - } - - error = git_repository_open_ext(&out, path, flags, ceiling_dirs); - if (php_git2_check_error(error, "git_repository_open_ext" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REPOSITORY, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto void git_repository_free(resource $repo) - */ -PHP_FUNCTION(git_repository_free) -{ - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_repo)) { - git_repository_free(PHP_GIT2_V(_repo, repository)); - GIT2_SHOULD_FREE(_repo) = 0; - }; - zval_ptr_dtor(&repo); -} -/* }}} */ - -/* {{{ proto resource git_repository_init_ext(string $repo_path, $opts) - */ -PHP_FUNCTION(git_repository_init_ext) -{ - git_repository_init_options options = GIT_REPOSITORY_INIT_OPTIONS_INIT; - php_git2_t *result = NULL; - git_repository *out = NULL; - char *repo_path = NULL; - int repo_path_len = 0, error = 0; - zval *opts = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sa", &repo_path, &repo_path_len, &opts) == FAILURE) { - return; - } - - php_git2_array_to_git_repository_init_options(&options, opts TSRMLS_CC); - error = git_repository_init_ext(&out, repo_path, &options); - if (php_git2_check_error(error, "git_repository_init_ext" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REPOSITORY, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_repository_head(resource $repo) - */ -PHP_FUNCTION(git_repository_head) -{ - php_git2_t *result = NULL; - git_reference *out = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_head(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_head" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFERENCE, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto long git_repository_head_detached(resource $repo) - */ -PHP_FUNCTION(git_repository_head_detached) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_head_detached(PHP_GIT2_V(_repo, repository)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_repository_head_unborn(resource $repo) - */ -PHP_FUNCTION(git_repository_head_unborn) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_head_unborn(PHP_GIT2_V(_repo, repository)); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_repository_is_empty(resource $repo) - */ -PHP_FUNCTION(git_repository_is_empty) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_is_empty(PHP_GIT2_V(_repo, repository)); - RETURN_BOOL(result); -} -/* }}} */ - - -/* {{{ proto string git_repository_path(resource $repo) - */ -PHP_FUNCTION(git_repository_path) -{ - const char *result = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_path(PHP_GIT2_V(_repo, repository)); - RETURN_STRING(result, 1); -} -/* }}} */ - - -/* {{{ proto long git_repository_set_workdir(resource $repo, string $workdir, long $update_gitlink) - */ -PHP_FUNCTION(git_repository_set_workdir) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *workdir = NULL; - int workdir_len = 0; - long update_gitlink = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsl", &repo, &workdir, &workdir_len, &update_gitlink) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_set_workdir(PHP_GIT2_V(_repo, repository), workdir, update_gitlink); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_repository_is_bare(resource $repo) - */ -PHP_FUNCTION(git_repository_is_bare) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_is_bare(PHP_GIT2_V(_repo, repository)); - RETURN_BOOL(result); -} -/* }}} */ - -/* {{{ proto resource git_repository_config(resource $repo) - */ -PHP_FUNCTION(git_repository_config) -{ - php_git2_t *result = NULL; - git_config *out = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_config(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_config" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_CONFIG, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_repository_odb(resource $repo) - */ -PHP_FUNCTION(git_repository_odb) -{ - php_git2_t *result = NULL; - git_odb *out = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_odb(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_odb" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_ODB, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto resource git_repository_refdb(resource $repo) - */ -PHP_FUNCTION(git_repository_refdb) -{ - php_git2_t *result = NULL; - git_refdb *out = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_refdb(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_refdb" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REFDB, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_repository_index(resource $repo) - */ -PHP_FUNCTION(git_repository_index) -{ - php_git2_t *result = NULL; - git_index *out = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_index(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_index" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_INDEX, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - -/* {{{ proto resource git_repository_message(long $len, resource $repo) - */ -PHP_FUNCTION(git_repository_message) -{ - zval *repo; - php_git2_t *_repo; - char buffer[GIT2_BUFFER_SIZE]; - size_t buffer_len = GIT2_BUFFER_SIZE; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_message(buffer, buffer_len, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_message" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_STRING(buffer, 1); -} -/* }}} */ - - -/* {{{ proto long git_repository_message_remove(resource $repo) - */ -PHP_FUNCTION(git_repository_message_remove) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_message_remove(PHP_GIT2_V(_repo, repository)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_repository_merge_cleanup(resource $repo) - */ -PHP_FUNCTION(git_repository_merge_cleanup) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_repository_merge_cleanup(PHP_GIT2_V(_repo, repository)); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_repository_fetchhead_foreach(resource $repo, Callable $callback, $payload) - */ -PHP_FUNCTION(git_repository_fetchhead_foreach) -{ - int result = 0; - zval *repo = NULL, *payload = NULL; - php_git2_t *_repo = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &repo, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_repository_fetchhead_foreach(PHP_GIT2_V(_repo, repository), php_git2_repository_fetchhead_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_repository_mergehead_foreach(resource $repo, Callable $callback, $payload) - */ -PHP_FUNCTION(git_repository_mergehead_foreach) -{ - int result = 0; - zval *repo = NULL, *payload = NULL; - php_git2_t *_repo = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &repo, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_repository_mergehead_foreach(PHP_GIT2_V(_repo, repository), php_git2_repository_mergehead_foreach_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto string git_repository_hashfile(resource $repo, string $path, long $type, string $as_path) - */ -PHP_FUNCTION(git_repository_hashfile) -{ - php_git2_t *_repo = NULL; - git_oid out = {0}; - zval *repo = NULL; - char *path = NULL, *as_path = NULL, buf[41] = {0}; - int path_len = 0, as_path_len = 0, error = 0; - long type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsls", &repo, &path, &path_len, &type, &as_path, &as_path_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_hashfile(&out, PHP_GIT2_V(_repo, repository), path, type, as_path); - if (php_git2_check_error(error, "git_repository_hashfile" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto long git_repository_set_head(repo, refname) -*/ -PHP_FUNCTION(git_repository_set_head) -{ - zval *repo; - php_git2_t *_repo; - char *refname = {0}; - int refname_len; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &refname, &refname_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_set_head(PHP_GIT2_V(_repo, repository), refname); - if (php_git2_check_error(error, "git_repository_set_head" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto long git_repository_set_head_detached(repo, commitish) -*/ -PHP_FUNCTION(git_repository_set_head_detached) -{ - zval *repo; - php_git2_t *_repo; - char *commitish = {0}; - int commitish_len; - int error = 0; - git_oid id; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &commitish, &commitish_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&id, commitish, commitish_len) != GIT_OK) { - return; - } - - error = git_repository_set_head_detached(PHP_GIT2_V(_repo, repository), &id); - if (php_git2_check_error(error, "git_repository_set_head_detached" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto long git_repository_detach_head(repo) -*/ -PHP_FUNCTION(git_repository_detach_head) -{ - zval *repo; - php_git2_t *_repo; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_detach_head(PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_repository_detach_head" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto long git_repository_state(repo) -*/ -PHP_FUNCTION(git_repository_state) -{ - zval *repo; - php_git2_t *_repo; - int state = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - state = git_repository_state(PHP_GIT2_V(_repo, repository)); - - RETURN_LONG(state); -} -/* }}} */ - -/* {{{ proto long git_repository_set_namespace(repo, nmspace) -*/ -PHP_FUNCTION(git_repository_set_namespace) -{ - zval *repo; - php_git2_t *_repo; - char *nmspace = {0}; - int nmspace_len; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &nmspace, &nmspace_len) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_repository_set_namespace(PHP_GIT2_V(_repo, repository), nmspace); - if (php_git2_check_error(error, "git_repository_set_namespace" TSRMLS_CC)) { - RETURN_FALSE - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto long git_repository_is_shallow(repo) -*/ -PHP_FUNCTION(git_repository_is_shallow) -{ - zval *repo; - php_git2_t *_repo; - int is_shallow; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - is_shallow = git_repository_is_shallow(PHP_GIT2_V(_repo, repository)); - RETURN_LONG(is_shallow); -} -/* }}} */ - -/* {{{ proto array git_repository_init_options_new() -*/ -PHP_FUNCTION(git_repository_init_options_new) -{ - git_repository_init_options opts = GIT_REPOSITORY_INIT_OPTIONS_INIT; - zval *result; - - php_git2_git_repository_init_options_to_array(&opts, &result TSRMLS_CC); - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ \ No newline at end of file diff --git a/repository.h b/repository.h deleted file mode 100644 index d6ff40b191..0000000000 --- a/repository.h +++ /dev/null @@ -1,324 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REPOSITORY_H -#define PHP_GIT2_REPOSITORY_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_new, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_init, 0, 0, 1) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, is_bare) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_open_bare, 0, 0, 1) - ZEND_ARG_INFO(0, bare_path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_open, 0, 0, 1) - ZEND_ARG_INFO(0, path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_get_namespace, 0, 0, 1) - ZEND_ARG_INFO(0, repository) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_workdir, 0, 0, 1) - ZEND_ARG_INFO(0, repository) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_wrap_odb, 0, 0, 1) - ZEND_ARG_INFO(0, odb) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_discover, 0, 0, 4) - ZEND_ARG_INFO(0, path_size) - ZEND_ARG_INFO(0, start_path) - ZEND_ARG_INFO(0, across_fs) - ZEND_ARG_INFO(0, ceiling_dirs) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_open_ext, 0, 0, 3) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, ceiling_dirs) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_free, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_init_ext, 0, 0, 2) - ZEND_ARG_INFO(0, repo_path) - ZEND_ARG_INFO(0, opts) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_head, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_head_detached, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_head_unborn, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_is_empty, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_path, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_set_workdir, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, workdir) - ZEND_ARG_INFO(0, update_gitlink) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_is_bare, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_config, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_odb, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_refdb, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_index, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_message, 0, 0, 2) - ZEND_ARG_INFO(0, len) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_message_remove, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_merge_cleanup, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_fetchhead_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_mergehead_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_hashfile, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, type) - ZEND_ARG_INFO(0, as_path) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_set_head, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, refname) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_set_head_detached, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, commitish) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_detach_head, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_state, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_set_namespace, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, nmspace) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_repository_is_shallow, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_repository_new() -*/ -PHP_FUNCTION(git_repository_new); - -/* {{{ proto resource git_repository_init(string $path, long is_bare = 0) -*/ -PHP_FUNCTION(git_repository_init); - -/* {{{ proto resource git_repository_open(string $path) -*/ -PHP_FUNCTION(git_repository_open_bare); - -/* {{{ proto resource git_repository_open(string $path) -*/ -PHP_FUNCTION(git_repository_open); - -/* {{{ proto string git_repository_get_namespace(resource $repository) -*/ -PHP_FUNCTION(git_repository_get_namespace); - -/* {{{ proto string git_repository_workdir(resource $repository) -*/ -PHP_FUNCTION(git_repository_workdir); - -/* {{{ proto resource git_repository_wrap_odb(odb) -*/ -PHP_FUNCTION(git_repository_wrap_odb); - -/* {{{ proto resource git_repository_discover(path_size, start_path, across_fs, ceiling_dirs) -*/ -PHP_FUNCTION(git_repository_discover); - -/* {{{ proto resource git_repository_open_ext(path, flags, ceiling_dirs) -*/ -PHP_FUNCTION(git_repository_open_ext); - -/* {{{ proto void git_repository_free(repo) -*/ -PHP_FUNCTION(git_repository_free); - -/* {{{ proto resource git_repository_init_ext(repo_path, opts) -*/ -PHP_FUNCTION(git_repository_init_ext); - -/* {{{ proto resource git_repository_head(repo) -*/ -PHP_FUNCTION(git_repository_head); - -/* {{{ proto long git_repository_head_detached(repo) -*/ -PHP_FUNCTION(git_repository_head_detached); - -/* {{{ proto long git_repository_head_unborn(repo) -*/ -PHP_FUNCTION(git_repository_head_unborn); - -/* {{{ proto long git_repository_is_empty(repo) -*/ -PHP_FUNCTION(git_repository_is_empty); - -/* {{{ proto resource git_repository_path(repo) -*/ -PHP_FUNCTION(git_repository_path); - -/* {{{ proto long git_repository_set_workdir(repo, workdir, update_gitlink) -*/ -PHP_FUNCTION(git_repository_set_workdir); - -/* {{{ proto long git_repository_is_bare(repo) -*/ -PHP_FUNCTION(git_repository_is_bare); - -/* {{{ proto resource git_repository_config(repo) -*/ -PHP_FUNCTION(git_repository_config); - -/* {{{ proto resource git_repository_odb(repo) -*/ -PHP_FUNCTION(git_repository_odb); - -/* {{{ proto resource git_repository_refdb(repo) -*/ -PHP_FUNCTION(git_repository_refdb); - -/* {{{ proto resource git_repository_index(repo) -*/ -PHP_FUNCTION(git_repository_index); - -/* {{{ proto resource git_repository_message(len, repo) -*/ -PHP_FUNCTION(git_repository_message); - -/* {{{ proto long git_repository_message_remove(repo) -*/ -PHP_FUNCTION(git_repository_message_remove); - -/* {{{ proto long git_repository_merge_cleanup(repo) -*/ -PHP_FUNCTION(git_repository_merge_cleanup); - -/* {{{ proto long git_repository_fetchhead_foreach(repo, callback, payload) -*/ -PHP_FUNCTION(git_repository_fetchhead_foreach); - -/* {{{ proto long git_repository_mergehead_foreach(repo, callback, payload) -*/ -PHP_FUNCTION(git_repository_mergehead_foreach); - -/* {{{ proto resource git_repository_hashfile(repo, path, type, as_path) -*/ -PHP_FUNCTION(git_repository_hashfile); - -/* {{{ proto long git_repository_set_head(repo, refname) -*/ -PHP_FUNCTION(git_repository_set_head); - -/* {{{ proto long git_repository_set_head_detached(repo, commitish) -*/ -PHP_FUNCTION(git_repository_set_head_detached); - -/* {{{ proto long git_repository_detach_head(repo) -*/ -PHP_FUNCTION(git_repository_detach_head); - -/* {{{ proto long git_repository_state(repo) -*/ -PHP_FUNCTION(git_repository_state); - -/* {{{ proto long git_repository_set_namespace(repo, nmspace) -*/ -PHP_FUNCTION(git_repository_set_namespace); - -/* {{{ proto long git_repository_is_shallow(repo) -*/ -PHP_FUNCTION(git_repository_is_shallow); - -/* {{{ proto array git_repository_init_options_new() -*/ -PHP_FUNCTION(git_repository_init_options_new); - -#endif \ No newline at end of file diff --git a/requirements.html b/requirements.html new file mode 100644 index 0000000000..fecb5684e9 --- /dev/null +++ b/requirements.html @@ -0,0 +1,121 @@ + + + + + + + + + + Requirements — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Previous topic

+

Installing/Configuring

+

Next topic

+

Installation

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Requirements

+
    +
  • libgit2
  • +
  • php5.3 higher
  • +
  • php-devel
  • +
  • pcre-devel
  • +
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/reset.c b/reset.c deleted file mode 100644 index f46a616bb7..0000000000 --- a/reset.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "reset.h" - -/* {{{ proto long git_reset(resource $repo, resource $target, $reset_type) - */ -PHP_FUNCTION(git_reset) -{ - int result = 0; - zval *repo = NULL, *target = NULL; - php_git2_t *_repo = NULL, *_target = NULL; - long reset_type = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rrl", &repo, &target, &reset_type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_target, php_git2_t*, &target, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reset(PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_target, object), reset_type); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_reset_default(resource $repo, resource $target, array $pathspecs) - */ -PHP_FUNCTION(git_reset_default) -{ - int result = 0; - zval *repo = NULL, *target = NULL, *pathspecs = NULL, *array = NULL; - php_git2_t *_repo = NULL, *_target = NULL; - git_strarray _pathspecs = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rra", &repo, &target, &pathspecs) == FAILURE) { - return; - } - if (zend_hash_num_elements(pathspecs) > 0) { - php_git2_array_to_strarray(&_pathspecs, pathspecs TSRMLS_CC); - } - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - ZEND_FETCH_RESOURCE(_target, php_git2_t*, &target, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_reset_default(PHP_GIT2_V(_repo, repository), PHP_GIT2_V(_target, object), &_pathspecs); - if (zend_hash_num_elements(pathspecs) > 0) { - git_strarray_free(&array); - } - - RETURN_LONG(result); -} -/* }}} */ - diff --git a/reset.h b/reset.h deleted file mode 100644 index 4c1dabfc91..0000000000 --- a/reset.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_RESET_H -#define PHP_GIT2_RESET_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reset, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, target) - ZEND_ARG_INFO(0, reset_type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reset_default, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, target) - ZEND_ARG_INFO(0, pathspecs) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_reset(repo, target, reset_type) -*/ -PHP_FUNCTION(git_reset); - -/* {{{ proto long git_reset_default(repo, target, pathspecs) -*/ -PHP_FUNCTION(git_reset_default); - -#endif \ No newline at end of file diff --git a/resources.html b/resources.html new file mode 100644 index 0000000000..e012683caf --- /dev/null +++ b/resources.html @@ -0,0 +1,116 @@ + + + + + + + + + + Resources — php-git 0.2 documentation + + + + + + + + + + + + + + + +
+
+

Previous topic

+

Runtime Configuration

+

Next topic

+

Predefined Constants

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Resources

+

nothing

+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/revparse.c b/revparse.c deleted file mode 100644 index 07b4ab8c58..0000000000 --- a/revparse.c +++ /dev/null @@ -1,122 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "revparse.h" - -/* {{{ proto resource git_revparse_single(resource $repo, string $spec) - */ -PHP_FUNCTION(git_revparse_single) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_object *out = NULL; - zval *repo = NULL; - char *spec = NULL; - int spec_len = 0, error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &spec, &spec_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_revparse_single(&out, PHP_GIT2_V(_repo, repository), spec); - if (php_git2_check_error(error, "git_revparse_single" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_OBJECT, out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto array git_revparse_ext(resource $repo, string $spec) - */ -PHP_FUNCTION(git_revparse_ext) -{ - zval *array, *a, *b; - php_git2_t *result = NULL, *result2 = NULL; - git_object *object_out = NULL; - git_reference *reference_out = NULL; - zval *repo = NULL; - php_git2_t *_repo = NULL; - char *spec = NULL; - int spec_len = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &spec, &spec_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_revparse_ext(&object_out, &reference_out, PHP_GIT2_V(_repo, repository), spec); - if (php_git2_check_error(error, "git_revparse_ext" TSRMLS_CC)) { - RETURN_FALSE; - } - - MAKE_STD_ZVAL(array); - MAKE_STD_ZVAL(a); - MAKE_STD_ZVAL(b); - - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_OBJECT, object_out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(a, GIT2_RVAL_P(result)); - - if (php_git2_make_resource(&result2, PHP_GIT2_TYPE_REFERENCE, reference_out, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(b, GIT2_RVAL_P(result2)); - - array_init(array); - add_next_index_zval(array, a); - add_next_index_zval(array, b); - RETURN_ZVAL(array, 0, 1); -} -/* }}} */ - -/* {{{ proto array git_revparse(resource $repo, string $spec) - */ -PHP_FUNCTION(git_revparse) -{ - git_revspec revspec; - zval *repo = NULL; - php_git2_t *_repo = NULL, *_from = NULL, *_to = NULL; - zval *result = NULL, *from, *to; - char *spec = NULL; - int spec_len = 0; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &repo, &spec, &spec_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - memset(&revspec, '\0', sizeof(revspec)); - error = git_revparse(&revspec, PHP_GIT2_V(_repo, repository), spec); - if (php_git2_check_error(error, "git_revparse" TSRMLS_CC)) { - RETURN_FALSE; - } - MAKE_STD_ZVAL(result); - if (php_git2_make_resource(&_from, PHP_GIT2_TYPE_OBJECT, revspec.from, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(from, GIT2_RVAL_P(_from)); - - if (php_git2_make_resource(&_to, PHP_GIT2_TYPE_OBJECT, revspec.to, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(to, GIT2_RVAL_P(_to)); - - array_init(result); - add_assoc_zval_ex(result, ZEND_STRS("from"), from); - add_assoc_zval_ex(result, ZEND_STRS("to"), to); - add_assoc_long_ex(result, ZEND_STRS("flags"), revspec.flags); - - RETURN_ZVAL(result, 0, 1); -} -/* }}} */ - diff --git a/revparse.h b/revparse.h deleted file mode 100644 index 8aa88dfa40..0000000000 --- a/revparse.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REVPARSE_H -#define PHP_GIT2_REVPARSE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revparse_single, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, spec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revparse_ext, 0, 0, 3) - ZEND_ARG_INFO(0, reference_out) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, spec) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revparse, 0, 0, 3) - ZEND_ARG_INFO(0, revspec) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, spec) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_revparse_single(repo, spec) -*/ -PHP_FUNCTION(git_revparse_single); - -/* {{{ proto resource git_revparse_ext(reference_out, repo, spec) -*/ -PHP_FUNCTION(git_revparse_ext); - -/* {{{ proto long git_revparse(revspec, repo, spec) -*/ -PHP_FUNCTION(git_revparse); - -#endif \ No newline at end of file diff --git a/revwalk.c b/revwalk.c deleted file mode 100644 index 1d261356b5..0000000000 --- a/revwalk.c +++ /dev/null @@ -1,353 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "revwalk.h" - -/* {{{ proto resource git_revwalk_new(resource $repo) - */ -PHP_FUNCTION(git_revwalk_new) -{ - php_git2_t *result = NULL, *_repo = NULL; - git_revwalk *out = NULL; - zval *repo = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_revwalk_new(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_revwalk_new" TSRMLS_CC)) { - RETURN_FALSE; - } - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REVWALK, out, 1 TSRMLS_CC)) { - RETURN_FALSE; - } - ZVAL_RESOURCE(return_value, GIT2_RVAL_P(result)); -} -/* }}} */ - - -/* {{{ proto void git_revwalk_reset(walker) -*/ -PHP_FUNCTION(git_revwalk_reset) -{ - zval *walker; - php_git2_t *_walker; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walker) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_walker, php_git2_t*, &walker, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - git_revwalk_reset(PHP_GIT2_V(_walker, revwalk)); -} - -/* {{{ proto long git_revwalk_push(resource $walk, string $id) - */ -PHP_FUNCTION(git_revwalk_push) -{ - int result = 0, id_len = 0; - zval *walk = NULL; - php_git2_t *_walk = NULL; - char *id = NULL; - git_oid __id = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &id, &id_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (git_oid_fromstrn(&__id, id, id_len)) { - RETURN_FALSE; - } - result = git_revwalk_push(PHP_GIT2_V(_walk, revwalk), &__id); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_revwalk_push_glob(resource $walk, string $glob) - */ -PHP_FUNCTION(git_revwalk_push_glob) -{ - int result = 0, glob_len = 0; - zval *walk = NULL; - php_git2_t *_walk = NULL; - char *glob = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &glob, &glob_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_revwalk_push_glob(PHP_GIT2_V(_walk, revwalk), glob); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_revwalk_push_head(walk) -*/ -PHP_FUNCTION(git_revwalk_push_head) -{ - zval *walk; - php_git2_t *_walk; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walk) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_revwalk_push_head(PHP_GIT2_V(_walk, revwalk)); - if (php_git2_check_error(error, "git_revwalk_push_head" TSRMLS_CC)) { - RETURN_FALSE; - } else { - RETURN_TRUE; - } -} - -/* {{{ proto long git_revwalk_hide(walk, commit_id) -*/ -PHP_FUNCTION(git_revwalk_hide) -{ - zval *walk; - php_git2_t *_walk; - char *commit_id = {0}; - int commit_id_len; - git_oid oid; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &commit_id, &commit_id_len) == FAILURE) { - return; - } - if (git_oid_fromstrn(&oid, commit_id, commit_id_len) != GIT_OK) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_revwalk_hide(PHP_GIT2_V(_walk, revwalk), &oid); - - if (php_git2_check_error(error, "git_revwalk_hide" TSRMLS_CC)) { - RETURN_FALSE; - } else { - RETURN_TRUE; - } - -} - -/* {{{ proto long git_revwalk_hide_glob(resource $walk, string $glob) - */ -PHP_FUNCTION(git_revwalk_hide_glob) -{ - int result = 0, glob_len = 0; - zval *walk = NULL; - php_git2_t *_walk = NULL; - char *glob = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &glob, &glob_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_revwalk_hide_glob(PHP_GIT2_V(_walk, revwalk), glob); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_revwalk_hide_head(walk) -*/ -PHP_FUNCTION(git_revwalk_hide_head) -{ - zval *walk; - php_git2_t *_walk; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walk) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - error = git_revwalk_hide_head(PHP_GIT2_V(_walk, revwalk)); - if (php_git2_check_error(error, "git_revwalk_hide_head" TSRMLS_CC)) { - RETURN_FALSE; - } else { - RETURN_TRUE; - } -} - -/* {{{ proto long git_revwalk_push_ref(resource $walk, string $refname) - */ -PHP_FUNCTION(git_revwalk_push_ref) -{ - int result = 0, refname_len = 0; - zval *walk = NULL; - php_git2_t *_walk = NULL; - char *refname = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &refname, &refname_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_revwalk_push_ref(PHP_GIT2_V(_walk, revwalk), refname); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto long git_revwalk_hide_ref(resource $walk, string $refname) - */ -PHP_FUNCTION(git_revwalk_hide_ref) -{ - int result = 0, refname_len = 0; - zval *walk = NULL; - php_git2_t *_walk = NULL; - char *refname = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &refname, &refname_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_revwalk_hide_ref(PHP_GIT2_V(_walk, revwalk), refname); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto string git_revwalk_next(walk) -*/ -PHP_FUNCTION(git_revwalk_next) -{ - zval *walk; - php_git2_t *_walk; - git_oid id = {0}; - char out[GIT2_OID_HEXSIZE] = {0}; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walk) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_revwalk_next(&id, PHP_GIT2_V(_walk, revwalk)); - if (error == GIT_ITEROVER) { - RETURN_FALSE; - } - - git_oid_fmt(out, &id); - RETURN_STRING(out, 1); -} - -/* {{{ proto void git_revwalk_sorting(walk, sort_mode) -*/ -PHP_FUNCTION(git_revwalk_sorting) -{ - zval *walk; - php_git2_t *_walk; - long sort_mode = GIT_SORT_NONE; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &walk, &sort_mode) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - git_revwalk_sorting(PHP_GIT2_V(_walk, revwalk), sort_mode); -} - -/* {{{ proto long git_revwalk_push_range(resource $walk, string $range) - */ -PHP_FUNCTION(git_revwalk_push_range) -{ - int result = 0, range_len = 0; - zval *walk = NULL; - php_git2_t *_walk = NULL; - char *range = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rs", &walk, &range, &range_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_revwalk_push_range(PHP_GIT2_V(_walk, revwalk), range); - RETURN_LONG(result); -} -/* }}} */ - - -/* {{{ proto void git_revwalk_simplify_first_parent(walk) -*/ -PHP_FUNCTION(git_revwalk_simplify_first_parent) -{ - zval *walk; - php_git2_t *_walk; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walk) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - git_revwalk_simplify_first_parent(PHP_GIT2_V(_walk, revwalk)); -} - -/* {{{ proto void git_revwalk_free(resource $walk) - */ -PHP_FUNCTION(git_revwalk_free) -{ - zval *walk = NULL; - php_git2_t *_walk = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walk) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (GIT2_SHOULD_FREE(_walk)) { - git_revwalk_free(PHP_GIT2_V(_walk, revwalk)); - GIT2_SHOULD_FREE(_walk) = 0; - }; - zval_ptr_dtor(&walk); -} -/* }}} */ - - -/* {{{ proto resource git_revwalk_repository(walk) -*/ -PHP_FUNCTION(git_revwalk_repository) -{ - zval *walk; - php_git2_t *_walk, *result; - git_repository *repository; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &walk) == FAILURE) { - return; - } - ZEND_FETCH_RESOURCE(_walk, php_git2_t*, &walk, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - - repository = git_revwalk_repository(PHP_GIT2_V(_walk, revwalk)); - if (php_git2_make_resource(&result, PHP_GIT2_TYPE_REPOSITORY, repository, 0 TSRMLS_CC)) { - RETURN_FALSE; - } - - ZVAL_RESOURCE(return_value, result->resource_id); -} - diff --git a/revwalk.h b/revwalk.h deleted file mode 100644 index ef9a7b6eac..0000000000 --- a/revwalk.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_REVWALK_H -#define PHP_GIT2_REVWALK_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_new, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_reset, 0, 0, 1) - ZEND_ARG_INFO(0, walker) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_push, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_push_glob, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, glob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_push_head, 0, 0, 1) - ZEND_ARG_INFO(0, walk) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_hide, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, commit_id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_hide_glob, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, glob) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_hide_head, 0, 0, 1) - ZEND_ARG_INFO(0, walk) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_push_ref, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, refname) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_hide_ref, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, refname) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_next, 0, 0, 2) - ZEND_ARG_INFO(0, walk) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_sorting, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, sort_mode) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_push_range, 0, 0, 2) - ZEND_ARG_INFO(0, walk) - ZEND_ARG_INFO(0, range) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_simplify_first_parent, 0, 0, 1) - ZEND_ARG_INFO(0, walk) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_free, 0, 0, 1) - ZEND_ARG_INFO(0, walk) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_revwalk_repository, 0, 0, 1) - ZEND_ARG_INFO(0, walk) -ZEND_END_ARG_INFO() - -/* {{{ proto long git_revwalk_new(repo) -*/ -PHP_FUNCTION(git_revwalk_new); - -/* {{{ proto void git_revwalk_reset(walker) -*/ -PHP_FUNCTION(git_revwalk_reset); - -/* {{{ proto long git_revwalk_push(walk, id) -*/ -PHP_FUNCTION(git_revwalk_push); - -/* {{{ proto long git_revwalk_push_glob(walk, glob) -*/ -PHP_FUNCTION(git_revwalk_push_glob); - -/* {{{ proto long git_revwalk_push_head(walk) -*/ -PHP_FUNCTION(git_revwalk_push_head); - -/* {{{ proto long git_revwalk_hide(walk, commit_id) -*/ -PHP_FUNCTION(git_revwalk_hide); - -/* {{{ proto long git_revwalk_hide_glob(walk, glob) -*/ -PHP_FUNCTION(git_revwalk_hide_glob); - -/* {{{ proto long git_revwalk_hide_head(walk) -*/ -PHP_FUNCTION(git_revwalk_hide_head); - -/* {{{ proto long git_revwalk_push_ref(walk, refname) -*/ -PHP_FUNCTION(git_revwalk_push_ref); - -/* {{{ proto long git_revwalk_hide_ref(walk, refname) -*/ -PHP_FUNCTION(git_revwalk_hide_ref); - -/* {{{ proto long git_revwalk_next(walk) -*/ -PHP_FUNCTION(git_revwalk_next); - -/* {{{ proto void git_revwalk_sorting(walk, sort_mode) -*/ -PHP_FUNCTION(git_revwalk_sorting); - -/* {{{ proto long git_revwalk_push_range(walk, range) -*/ -PHP_FUNCTION(git_revwalk_push_range); - -/* {{{ proto void git_revwalk_simplify_first_parent(walk) -*/ -PHP_FUNCTION(git_revwalk_simplify_first_parent); - -/* {{{ proto void git_revwalk_free(walk) -*/ -PHP_FUNCTION(git_revwalk_free); - -/* {{{ proto resource git_revwalk_repository(walk) -*/ -PHP_FUNCTION(git_revwalk_repository); - - -#endif \ No newline at end of file diff --git a/script/cibuild.sh b/script/cibuild.sh deleted file mode 100755 index 720213790d..0000000000 --- a/script/cibuild.sh +++ /dev/null @@ -1,13 +0,0 @@ -export NO_INTERACTION=1 -export TESTS="--show-diff -q" - -mkdir $TRAVIS_BUILD_DIR/libgit2/build -cd $TRAVIS_BUILD_DIR/libgit2/build -cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF -DCMAKE_C_FLAGS=-fPIC .. -cmake --build . -cd $TRAVIS_BUILD_DIR - -phpize -./configure -make -make test diff --git a/search.html b/search.html new file mode 100644 index 0000000000..f59909ba19 --- /dev/null +++ b/search.html @@ -0,0 +1,99 @@ + + + + + + + + + + Search — php-git 0.2 documentation + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+
+ +

Search

+
+ +

+ Please activate JavaScript to enable the search + functionality. +

+
+

+ From here you can search these documents. Enter your search + words into the box below and click "search". Note that the search + function will automatically search for all of the words. Pages + containing fewer words won't appear in the result list. +

+
+ + + +
+ +
+ +
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000000..f8cddb3cf8 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({objects:{},terms:{represent:[47,25],all:[65,39],git_obj_bad:122,init:[117,47,5,57],under:59,string:[54,86,43,66,61,81,79,62,21,113,91,67,42,38,5,51,15,124,53,32,96],getrefer:[117,47,65],fals:[81,30,32,55,21],"void":[79,44,10,81,102,2,67,71,5,40,15,53,107],unixtim:124,list:[120,65],setcont:[62,125,117,5,39],object1:[5,39],git_obj_commit:122,odb:[117,64,12,75,36,91],compat:96,index:[54,117,113,19,13,42,91,33,25,95,107,78],what:51,hide:[117,102,126],asia:[10,124,44,5,39],current:[6,107,121,19,78],experiment:[117,31,39,112],is_bar:57,"new":[1,15,65,66,102,71,103,67,3,68,38,5,33,40,106,117,70,44,10,14,7,51,53,96,54,79,116,20,81,56,119,120,76,57,86,82,123,124,42,92,78,39],method:[54,78,123,92,65,113,81,39,68,5,33,96,32,57],full:124,hash:[86,92,116,61,81,32,55,21,14,67,38,5,15,53,102,39],gitindex:78,len:[43,81],free:[117,26,81,28],path:[1,66,103,3,68,39,70,106,117,113,7,51,53,96,54,116,20,15,120,57,86,82,123,87,91],valu:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,40,90,43,44,45,46,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,118,119,120,121,122,123,124],search:117,gettre:[86,101,117,47,14,7,68,39,106],gitrepositori:[3,37,96,99,77],chang:[65,95,113,39,96],gitrevwalk:76,modul:[117,104],git_obj_blob:122,submodul:53,"boolean":[123,81,23,42,6,51],instal:[117,88,59],txt:54,setmessag:[117,110,101,39,79,5,112],from:[81,79,2,96],memori:81,next:[117,126,65,113,67,39,119,40,95,76],call:[54,123,81,39,5,57],type:[71,43,81,121],more:104,sort:[71,117,126],notic:117,warn:123,newcont:54,flag:65,cach:[123,81],must:32,tokyo:[10,124,44,5,39],work:[42,91],cat:59,can:[65,2,68,104,5,33,51,96,39],sudo:59,share:59,indic:117,high:[81,2],tag:[117,58,110,18,112,45,60,100,83,115,4,93,89,122,85],want:39,multipl:[5,39],setauthor:[117,44,101,10,5,39],write:[101,35,4,5,6,108,117,112,15,53,54,79,116,19,81,25,28,87,41,90,125,30,31,39],sig:124,foreach:[121,39,23,94],instead:[112,73],product:59,getpar:[11,117,39,101],resourc:[117,88,17],clone:59,after:54,manuali:39,mai:[65,113,123,95],data:[43,81],git_working_tre:42,"short":79,bind:117,settarget:[117,112,45],author:[20,44,70],issu:51,inform:104,environ:59,datetimezon:[10,124,44,5,39],soon:51,still:59,pointer:40,paramet:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,40,90,43,44,45,46,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,118,119,120,121,76,123,124],memorybackend:81,fix:[51,5,39],getblob:92,countabl:[106,33],non:51,"return":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,40,90,43,44,45,46,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,118,119,120,121,76,123,124],getcommitt:[20,117,1,101],git_index:113,lator:65,initi:[79,5,39],devel:111,now:[5,39],chobi:42,introduct:[117,104],name:[124,113,83,56,68,39,51,15,53,96],changelog:96,getiter:[117,0,87,13,39,25],refresh:[54,117,107,25],mode:53,found:[65,104],higher:[111,81],gittreeentri:[84,68,34],getlist:[120,117,97,39],procedur:104,iteratoraggreg:[0,13],"static":57,orient:104,out:[65,110,83,45,115],sort_typ:71,your:[54,81,59,57],content:[62,88,81,117],travas:119,ref:[86,82,1,66,20,65,106,102,56,67,71,39,119,40,51,7,76,96],committ:[10,1],base:41,releas:39,extend:[87,81],length:43,git_obj_tag:122,first:[5,39],dont:39,arrai:[120,65,34,81,39],echo:[86,33,106],uninterest:102,blank:57,predefin:[117,122],"__construct":[101,103,36,3,37,70,72,109,117,43,112,73,126,47,75,48,115,77,118,28,87,31,124,125,97,98,99],prioriti:[81,2],messag:[82,79,110,66],master:[86,82,1,66,117,20,106,102,56,67,71,39,119,40,51,7,76,96],stdclass:[95,81],john:124,specifi:[65,2,67,3,68,38,33,71,11,113,14,15,40,53,54,102,81,56,84,119,76,57,124,91,92,95],github:[104,79,59],std:81,target:[51,32,55,21,45],everytim:81,provid:104,remov:[87,15,117],tree:[0,34,68,5,106,8,109,117,14,7,50,15,53,77,116,23,84,118,121,122,86,87,41,42,91,61,94,39],see:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,39,40,90,43,44,45,46,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,118,119,120,121,76,123,124],ani:[123,122],have:[54,79,81,39],tabl:[117,88],engin:81,toobject:[117,23,94,8,121,109],read_head:[117,55,81,28],note:[79,59,112,73,92,65,113,81,123,39,68,5,51,95,31,124,57],also:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,39,40,90,43,44,45,46,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,118,119,120,121,76,123,124],build:59,which:91,gitrawobject:[55,30],noth:[105,17],setcommitt:[117,44,101,10,5,39],object:[64,2,35,67,37,104,69,117,43,12,50,53,77,116,81,23,56,121,122,87,41,42,91,30,94,95,78,99],regular:53,sort_non:[71,122],"class":[28,81,2,41,48,70,31,112],git_repositori:47,renam:92,settre:[101,117,61,5,39],later:[115,110,83,5,45],treeentri:68,doe:81,runtim:[117,88,105],libgit2:[117,111,81,42,104,59],usuali:81,gittre:39,find:[117,113,25],onli:51,setnam:[117,112,83],configur:[117,88,59,105],should:[124,59,73],getobject:[117,47,92],last_commit:39,reset:[40,117,126],gettyp:[63,117,112,80,87,23,41,125,50,94,31,121,85],get:[120,117,81,39,119],getid:[1,101,66,67,40,69,5,71,106,114,117,112,74,7,48,51,52,20,81,119,27,76,86,82,87,41,125,93,31,39],becaus:96,repo:[54,42,82,1,7,20,66,102,123,120,56,67,71,103,33,119,40,51,96,76,57],git_dir:[42,91],requir:[117,88,111],cd584aba22827a6a59cad3ab1b4e026418558bfb:[68,38,92,14],"public":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,40,90,43,44,45,46,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,119,120,121,76,123,124],reload:107,bad:122,altern:2,set:[117,79],tree_hash:[15,116,53,5,39],bare:[78,57],fail:78,statu:59,parent:[11,5,39],"import":[117,79,5,39],email:124,attribut:53,getindex:[54,117,47,33,78],signatur:[117,44,10,124,20,5,70,1,72,39],istre:[117,18,112,125,23,41,49,94,9,31,121],kei:[81,32,55,21,122],var_dump:[39,76],git_object_dir:42,extens:59,preprocessor:96,protect:81,currentri:51,com:[79,59,10,124,104,5,44,39],load:123,walk:[117,39],header:81,rawobject:[117,43,21,81,48,114],backend:[117,28,64,81,2,12,55,21,48,91,98,30,39,26,32],gitblob:39,phpize:59,defin:96,"while":[67,39,76],pack:[117,97,123],gitcommit:39,readm:[116,68,5,15,53,39],them:[65,110,83,45,115],linkabl:117,revis:[117,39],git_index_fil:42,isblob:[117,112,29,121,22,23,41,125,94,31,89],develop:[65,113,59,95],welcom:117,datetim:[10,124,44,5,39],make:59,same:[33,96],getauthor:[20,117,1,101],document:[10,106,44,117],addaltern:[36,117,12,2,47],gitodb:91,http:[104,79,59],oid:51,someon:[10,44,5,39],handi:104,extern:2,php:[1,70,66,65,119,102,71,103,67,3,68,38,5,33,40,106,117,44,10,123,14,7,48,51,53,96,54,79,116,20,81,23,56,15,120,111,121,76,57,86,82,59,124,42,92,94,78,39],sha1:81,entri:[117,34,23,84,68,118,39,94,95,8,121,109],inherit:[81,50,2],exampl:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,39,40,90,43,44,45,46,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,117,118,119,120,121,76,123,124],thi:[54,78,123,28,92,81,65,113,2,112,48,96,68,117,39,33,51,57,31,32,5],filesystem:[19,57],getwalk:[117,73,47,102,67,71,39,119,40,76],git_obj_tre:122,execut:53,getshortmessag:[117,82,101,66],yet:68,previous:123,smith:124,param:81,add:[54,117,59,116,87,2,5,25,53,39],blob:[117,92,9,116,80,94,22,41,90,125,37,5,62,15,52,53,121,122,39],els:[81,23,94],mayb:39,read:[81,21,28,117],repository_path:3,recurs:68,sort_topo:[71,122],blobhash:39,resolv:[68,2],revwalk:[117,73,126,102,67,71,76,119,40,122],api:39,manag:[117,123,103,39,120,51,97,96],intern:[40,48,81],sampl:[54,5],home:42,librari:117,tmp:[54,71,59,102,65,81,14,56,67,3,68,38,92,33,119,40,78,76,57],gettarget:[46,100,31,112,117],getnam:[117,58,31,24,112],refer:[63,65,103,67,39,108,117,112,46,49,51,96,56,24,120,76,123,29,31,74,97,99],addbackend:[117,64,47,81,36,39],repositori:[1,70,66,65,119,2,71,103,67,3,37,38,5,33,40,106,107,117,44,73,10,47,14,7,115,99,51,53,77,54,78,79,116,20,102,81,56,15,120,76,57,86,82,123,68,42,91,92,96,39],offset:[11,95,113,84],isset:81,stage:54,src:[42,59],about:104,obj:81,page:117,lookupref:[86,82,1,66,117,20,47,106,102,56,67,71,39,119,40,51,7,76,96],commit:[1,101,66,102,67,40,38,5,70,6,117,44,10,11,7,76,51,27,79,20,119,122,82,124,41,61,39],sort_revers:[71,122],own:81,storag:81,getmessag:[112,66,117,101,60],sort_dat:[71,122],pcre:111,git:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,32,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,106,107,108,109,110,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],setpar:[101,117,5,39],waf:59,custom:[117,28,64,12,81,91,39],avail:[120,117,39],interfac:[106,0,13,104,33],low:[81,2],object_typ:121,"function":81,head:[86,82,1,66,20,106,102,56,67,71,39,119,40,51,7,76,96],link:53,getentri:[117,87,34,84,39,25,95],"true":[32,81,23,30,5,94,57],count:[87,106,117,33,25],checkout:59,master_hash:[5,39],limit:[51,5],open3:[91,47,117],open2:[42,117,47],featur:2,constant:[117,122],creat:[117,124,81,39,70,51,97,57],"int":[54,43,11,65,113,84,71,106,95,53,121],"abstract":[30,32,55,21,28],exist:[117,123,28,32,81,57],ini:59,file:[54,113,42,68,15,53],check:[81,39],fill:[65,110,83,45,115],git_obj_ani:122,when:[79,124,23,39,5,94,78,57],invalid:123,gitbackend:[12,64],lookup:[117,97,96],branch:[51,39],php5:111,you:[54,73,81,39,33],brandh:39,symbol:[51,53],master_commit:39,libgit2_vers:59,push:[117,126,67,71,39,119,40,76],getcommit:[117,82,1,20,47,7,38,39,66],strpo:39,directori:[42,91,53,57],descript:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,89,18,19,20,21,22,23,24,26,27,30,33,34,35,37,38,40,90,43,44,45,46,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,77,79,80,81,82,83,84,85,86,29,32,42,91,92,93,94,95,78,98,99,100,102,103,106,107,108,110,113,114,96,115,116,118,119,120,121,76,123,124],time:124,walker:[39,76],unset:81},objtypes:{},titles:["Git\\Tree::getIterator","Git\\Commit::getCommitter","Git\\Repository::addAlternate","Git\\Repository::__construct","Git\\Tag::write","Git\\Commit::setParent","Git\\Commit::write","Git\\Commit::getTree","Git\\Tree\\Entry::toObject","Git\\Blob::isTree","Git\\Commit::setCommitter","Git\\Commit::getParent","Git\\ODB::addAlternate","Git\\Index::getIterator","Git\\Repository::getTree","Git\\Tree::remove","Git\\Git","Resources","Git\\Tag::isTree","Git\\Index::write","Git\\Commit::getAuthor","Git\\Backend::read","Git\\Blob::isBlob","Git\\Object::isTree","Git\\Reference::getName","Git\\Index","Git\\Backend::free","Git\\Commit::getId","Git\\Backend","Git\\Reference::isBlob","Git\\Backend::write","Git\\Reference","Git\\Backend::exists","Git\\Index::count","Git\\Tree::getEntries","Git\\Object::write","Git\\ODB","Git\\Blob::__construct","Git\\Repository::getCommit","Examples","Git\\Revwalk::reset","Git\\Object","Git\\Repository::open2","Git\\RawObject::__construct","Git\\Commit::setAuthor","Git\\Tag::setTarget","Git\\Reference::getTarget","Git\\Repository","Git\\RawObject","Git\\Reference::isTree","Git\\Tree::getType","Git\\Reference\\Manager::create","Git\\Blob::getId","Git\\Tree::add","Git\\Index::add","Git\\Backend::read_header","Git\\Repository::lookupRef","Git\\Repository::init","Git\\Tag::getName","Installation","Git\\Tag::getMessage","Git\\Commit::setTree","Git\\Blob::setContent","Git\\Reference::getType","Git\\ODB::addBackend","Git\\Repository::getReferences","Git\\Commit::getMessage","Git\\Revwalk::push","Git\\Tree::path","Git\\Object::getId","Git\\Commit::__construct","Git\\Revwalk::sort","Git\\Signature","Git\\Revwalk::__construct","Git\\Reference::getId","Git\\ODB::__construct","Git\\Repository::getWalker","Git\\Tree::__construct","Git\\Repository::getIndex","Git\\Commit::setMessage","Git\\Blob::getType","Git\\Repository::addBackend","Git\\Commit::getShortMessage","Git\\Tag::setName","Git\\Tree::getEntry","Git\\Tag::getType","Git\\Tree::getId","Git\\Tree","Installing/Configuring","Git\\Tag::isBlob","Git\\Blob::write","Git\\Repository::open3","Git\\Repository::getObject","Git\\Tag::getId","Git\\Object::isBlob","Git\\Index::getEntry","Git\\Reference\\Manager::lookup","Git\\Reference\\Manager","Git\\Backend::__construct","Git\\Reference::__construct","Git\\Tag::getTarget","Git\\Commit","Git\\Revwalk::hide","Git\\Reference\\Manager::__construct","Introduction","Runtime Configuration","Git\\Tree::count","Git\\Index::refresh","Git\\Reference::write","Git\\Tree\\Entry","Git\\Tag::setMessage","Requirements","Git\\Tag","Git\\Index::find","Git\\RawObject::getId","Git\\Tag::__construct","Git\\Tree::write","Welcome to php-git’s documentation!","Git\\Tree\\Entry::__construct","Git\\Revwalk::next","Git\\Reference\\Manager::getList","Git\\Object::getType","Predefined Constants","Git\\Reference\\Manager::pack","Git\\Signature::__construct","Git\\Blob","Git\\Revwalk"],objnames:{},filenames:["classes/tree/get_iterator","classes/commit/get_committer","classes/repository/add_alternate","classes/repository/__construct","classes/tag/write","classes/commit/set_parent","classes/commit/write","classes/commit/get_tree","classes/entry/to_object","classes/blob/is_tree","classes/commit/set_committer","classes/commit/get_parent","classes/odb/add_alternate","classes/index/get_iterator","classes/repository/get_tree","classes/tree/remove","classes/git/index","resources","classes/tag/is_tree","classes/index/write","classes/commit/get_author","classes/backend/read","classes/blob/is_blob","classes/object/is_tree","classes/reference/get_name","classes/index/index","classes/backend/free","classes/commit/get_id","classes/backend/index","classes/reference/is_blob","classes/backend/write","classes/reference/index","classes/backend/exists","classes/index/count","classes/tree/get_entries","classes/object/write","classes/odb/index","classes/blob/__construct","classes/repository/get_commit","examples","classes/revwalk/reset","classes/object/index","classes/repository/open2","classes/rawobject/__construct","classes/commit/set_author","classes/tag/set_target","classes/reference/get_target","classes/repository/index","classes/rawobject/index","classes/reference/is_tree","classes/tree/get_type","classes/manager/create","classes/blob/get_id","classes/tree/add","classes/index/add","classes/backend/read_header","classes/repository/lookup_ref","classes/repository/init","classes/tag/get_name","installation","classes/tag/get_message","classes/commit/set_tree","classes/blob/set_content","classes/reference/get_type","classes/odb/add_backend","classes/repository/get_references","classes/commit/get_message","classes/revwalk/push","classes/tree/path","classes/object/get_id","classes/commit/__construct","classes/revwalk/sort","classes/signature/index","classes/revwalk/__construct","classes/reference/get_id","classes/odb/__construct","classes/repository/get_walker","classes/tree/__construct","classes/repository/get_index","classes/commit/set_message","classes/blob/get_type","classes/repository/add_backend","classes/commit/get_short_message","classes/tag/set_name","classes/tree/get_entry","classes/tag/get_type","classes/tree/get_id","classes/tree/index","setup","classes/tag/is_blob","classes/blob/write","classes/repository/open3","classes/repository/get_object","classes/tag/get_id","classes/object/is_blob","classes/index/get_entry","classes/manager/lookup","classes/manager/index","classes/backend/__construct","classes/reference/__construct","classes/tag/get_target","classes/commit/index","classes/revwalk/hide","classes/manager/__construct","intro","ini","classes/tree/count","classes/index/refresh","classes/reference/write","classes/entry/index","classes/tag/set_message","requirements","classes/tag/index","classes/index/find","classes/rawobject/get_id","classes/tag/__construct","classes/tree/write","index","classes/entry/__construct","classes/revwalk/next","classes/manager/get_list","classes/object/get_type","constants","classes/manager/pack","classes/signature/__construct","classes/blob/index","classes/revwalk/index"]}) \ No newline at end of file diff --git a/setup.html b/setup.html new file mode 100644 index 0000000000..318beedaae --- /dev/null +++ b/setup.html @@ -0,0 +1,121 @@ + + + + + + + + + + Installing/Configuring — php-git 0.2 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Introduction

+

Next topic

+

Requirements

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Installing/Configuring

+

Table of Contents:

+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/signature.c b/signature.c deleted file mode 100644 index e609e845f4..0000000000 --- a/signature.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "signature.h" - -/* {{{ proto resource git_signature_new(string $name, string $email, array $time, long $offset) - */ -PHP_FUNCTION(git_signature_new) -{ - git_signature *out = NULL; - char *name = NULL, *email = NULL; - int name_len = 0, email_len = 0, error = 0; - long time = 0, offset = 0; - zval *signature = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ssll", &name, &name_len, &email, &email_len, &time, &offset) == FAILURE) { - return; - } - - error = git_signature_new(&out, name, email, time, offset); - if (php_git2_check_error(error, "git_signature_new" TSRMLS_CC)) { - RETURN_FALSE; - } - php_git2_signature_to_array(out, &signature TSRMLS_CC); - git_signature_free(out); - RETURN_ZVAL(signature, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_signature_now(string $name, string $email) - */ -PHP_FUNCTION(git_signature_now) -{ - git_signature *out = NULL; - char *name = NULL, *email = NULL; - int name_len = 0, email_len = 0, error = 0; - zval *signature = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ss", &name, &name_len, &email, &email_len) == FAILURE) { - return; - } - - error = git_signature_now(&out, name, email); - if (php_git2_check_error(error, "git_signature_now" TSRMLS_CC)) { - RETURN_FALSE; - } - php_git2_signature_to_array(out, &signature TSRMLS_CC); - git_signature_free(out); - RETURN_ZVAL(signature, 0, 1); -} -/* }}} */ - -/* {{{ proto resource git_signature_default(resource $repo) - */ -PHP_FUNCTION(git_signature_default) -{ - php_git2_t *_repo = NULL; - git_signature *out = NULL; - zval *repo = NULL, *signature = NULL; - int error = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "r", &repo) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_signature_default(&out, PHP_GIT2_V(_repo, repository)); - if (php_git2_check_error(error, "git_signature_default" TSRMLS_CC)) { - RETURN_FALSE; - } - php_git2_signature_to_array(out, &signature TSRMLS_CC); - git_signature_free(out); - RETURN_ZVAL(signature, 0, 1); -} -/* }}} */ diff --git a/signature.h b/signature.h deleted file mode 100644 index 71be5b503e..0000000000 --- a/signature.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_SIGNATURE_H -#define PHP_GIT2_SIGNATURE_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_signature_new, 0, 0, 4) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, email) - ZEND_ARG_INFO(0, time) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_signature_now, 0, 0, 2) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, email) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_signature_default, 0, 0, 1) - ZEND_ARG_INFO(0, repo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_signature_dup, 0, 0, 1) - ZEND_ARG_INFO(0, sig) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_signature_free, 0, 0, 1) - ZEND_ARG_INFO(0, sig) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_signature_new(name, email, time, offset) -*/ -PHP_FUNCTION(git_signature_new); - -/* {{{ proto resource git_signature_now(name, email) -*/ -PHP_FUNCTION(git_signature_now); - -/* {{{ proto resource git_signature_default(repo) -*/ -PHP_FUNCTION(git_signature_default); - -/* {{{ proto resource git_signature_dup(sig) -*/ -PHP_FUNCTION(git_signature_dup); - -/* {{{ proto void git_signature_free(sig) -*/ -PHP_FUNCTION(git_signature_free); - -#endif \ No newline at end of file diff --git a/sources/classes/backend/__construct.txt b/sources/classes/backend/__construct.txt new file mode 100644 index 0000000000..c76a8cc284 --- /dev/null +++ b/sources/classes/backend/__construct.txt @@ -0,0 +1,26 @@ +.. index:: + single: __construct (Git\Backend method) + + +Git\\Backend::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Backend::__construct** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/backend/exists.txt b/sources/classes/backend/exists.txt new file mode 100644 index 0000000000..db706b6c83 --- /dev/null +++ b/sources/classes/backend/exists.txt @@ -0,0 +1,30 @@ +.. index:: + single: exists (Git\Backend method) + + +Git\\Backend::exists +=========================================================== + +Description +*********************************************************** + +abstract public **Git\\Backend::exists** (string *$key*) + + +Parameters +*********************************************************** + +*key* + target hash id. + + +Return Values +*********************************************************** + +this method must return true or false. + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/backend/free.txt b/sources/classes/backend/free.txt new file mode 100644 index 0000000000..f174a6a3f8 --- /dev/null +++ b/sources/classes/backend/free.txt @@ -0,0 +1,26 @@ +.. index:: + single: free (Git\Backend method) + + +Git\\Backend::free +=========================================================== + +Description +*********************************************************** + +public **Git\\Backend::free** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/backend/index.txt b/sources/classes/backend/index.txt new file mode 100644 index 0000000000..8e4f3de694 --- /dev/null +++ b/sources/classes/backend/index.txt @@ -0,0 +1,12 @@ +Git\\Backend +=========================== + +abstract class Git\\Backend + +this class use for custom backend. + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/backend/read.txt b/sources/classes/backend/read.txt new file mode 100644 index 0000000000..a750786eb5 --- /dev/null +++ b/sources/classes/backend/read.txt @@ -0,0 +1,30 @@ +.. index:: + single: read (Git\Backend method) + + +Git\\Backend::read +=========================================================== + +Description +*********************************************************** + +abstract public **Git\\Backend::read** (string *$key*) + + +Parameters +*********************************************************** + +*key* + target hash id + + +Return Values +*********************************************************** + +Git\\RawObject / false + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/backend/read_header.txt b/sources/classes/backend/read_header.txt new file mode 100644 index 0000000000..cad3725d36 --- /dev/null +++ b/sources/classes/backend/read_header.txt @@ -0,0 +1,30 @@ +.. index:: + single: read_header (Git\Backend method) + + +Git\\Backend::read_header +=========================================================== + +Description +*********************************************************** + +abstract public **Git\\Backend::read_header** (*$key*) + + +Parameters +*********************************************************** + +*key* + target hash id. + + +Return Values +*********************************************************** + +Git\RawObject / false + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/backend/write.txt b/sources/classes/backend/write.txt new file mode 100644 index 0000000000..1ed215b7af --- /dev/null +++ b/sources/classes/backend/write.txt @@ -0,0 +1,30 @@ +.. index:: + single: write (Git\Backend method) + + +Git\\Backend::write +=========================================================== + +Description +*********************************************************** + +abstract public **Git\\Backend::write** (Git\RawObject *$object*) + + +Parameters +*********************************************************** + +*object* + Git\RawObject + + +Return Values +*********************************************************** + +true / false + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/__construct.txt b/sources/classes/blob/__construct.txt new file mode 100644 index 0000000000..cfe98cee8a --- /dev/null +++ b/sources/classes/blob/__construct.txt @@ -0,0 +1,28 @@ +.. index:: + single: __construct (Git\Blob method) + + +Git\\Blob::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::__construct** (Git\Repository *$repository*) + + +Parameters +*********************************************************** + +*repository* + Git\Repository object. + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/get_id.txt b/sources/classes/blob/get_id.txt new file mode 100644 index 0000000000..aac683f435 --- /dev/null +++ b/sources/classes/blob/get_id.txt @@ -0,0 +1,26 @@ +.. index:: + single: getId (Git\Blob method) + + +Git\\Blob::getId +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::getId** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/get_type.txt b/sources/classes/blob/get_type.txt new file mode 100644 index 0000000000..8f22a16ed6 --- /dev/null +++ b/sources/classes/blob/get_type.txt @@ -0,0 +1,26 @@ +.. index:: + single: getType (Git\Blob method) + + +Git\\Blob::getType +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::getType** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/index.txt b/sources/classes/blob/index.txt new file mode 100644 index 0000000000..4d699a3f1c --- /dev/null +++ b/sources/classes/blob/index.txt @@ -0,0 +1,9 @@ +Git\\Blob +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/blob/is_blob.txt b/sources/classes/blob/is_blob.txt new file mode 100644 index 0000000000..b5bc583a20 --- /dev/null +++ b/sources/classes/blob/is_blob.txt @@ -0,0 +1,26 @@ +.. index:: + single: isBlob (Git\Blob method) + + +Git\\Blob::isBlob +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::isBlob** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/is_tree.txt b/sources/classes/blob/is_tree.txt new file mode 100644 index 0000000000..1482c2de4a --- /dev/null +++ b/sources/classes/blob/is_tree.txt @@ -0,0 +1,26 @@ +.. index:: + single: isTree (Git\Blob method) + + +Git\\Blob::isTree +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::isTree** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/set_content.txt b/sources/classes/blob/set_content.txt new file mode 100644 index 0000000000..00baeea373 --- /dev/null +++ b/sources/classes/blob/set_content.txt @@ -0,0 +1,28 @@ +.. index:: + single: setContent (Git\Blob method) + + +Git\\Blob::setContent +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::setContent** (*$string*) + + +Parameters +*********************************************************** + +*string* + contents + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/blob/write.txt b/sources/classes/blob/write.txt new file mode 100644 index 0000000000..88bdad8bc4 --- /dev/null +++ b/sources/classes/blob/write.txt @@ -0,0 +1,26 @@ +.. index:: + single: write (Git\Blob method) + + +Git\\Blob::write +=========================================================== + +Description +*********************************************************** + +public **Git\\Blob::write** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/commit/__construct.txt b/sources/classes/commit/__construct.txt new file mode 100644 index 0000000000..7af4c398f4 --- /dev/null +++ b/sources/classes/commit/__construct.txt @@ -0,0 +1,42 @@ +.. index:: + single: __construct (Git\Commit method) + +create new commit. + + +Git\\Commit::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::__construct** (Git\\Repository *$repository*) + + +Parameters +*********************************************************** + +Git\\Repository *repository* + Repository class + + +Return Values +*********************************************************** + +:doc:`Git\\Commit ` + +Examples +*********************************************************** + + +.. code-block:: php + + ` \ No newline at end of file diff --git a/sources/classes/commit/get_author.txt b/sources/classes/commit/get_author.txt new file mode 100644 index 0000000000..28970890f3 --- /dev/null +++ b/sources/classes/commit/get_author.txt @@ -0,0 +1,40 @@ +.. index:: + single: getAuthor (Git\Commit method) + + +Git\\Commit::getAuthor +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getAuthor** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +Git\\Signature + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $commit = $repo->getCommit($ref->getId()); + $author = $commit->getAuthor(); + +See Also +*********************************************************** + +:doc:`Git\\Commit ` +:doc:`Git\\Commit::getCommitter() ` +:doc:`Git\\Signature ` + diff --git a/sources/classes/commit/get_committer.txt b/sources/classes/commit/get_committer.txt new file mode 100644 index 0000000000..dcc25357a1 --- /dev/null +++ b/sources/classes/commit/get_committer.txt @@ -0,0 +1,40 @@ +.. index:: + single: getCommitter (Git\Commit method) + + +Git\\Commit::getCommitter +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getCommitter** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $commit = $repo->getCommit($ref->getId()); + $committer = $commit->getCommitter(); + + +See Also +*********************************************************** + +:doc:`Git\\Commit ` +:doc:`Git\\Commit::getAuthor() ` +:doc:`Git\\Signature ` + diff --git a/sources/classes/commit/get_id.txt b/sources/classes/commit/get_id.txt new file mode 100644 index 0000000000..b74db7fa43 --- /dev/null +++ b/sources/classes/commit/get_id.txt @@ -0,0 +1,26 @@ +.. index:: + single: getId (Git\Commit method) + + +Git\\Commit::getId +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getId** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/commit/get_message.txt b/sources/classes/commit/get_message.txt new file mode 100644 index 0000000000..1428b49c99 --- /dev/null +++ b/sources/classes/commit/get_message.txt @@ -0,0 +1,38 @@ +.. index:: + single: getMessage (Git\Commit method) + + +Git\\Commit::getMessage +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getMessage** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +string + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $commit = $repo->getCommit($ref->getId()); + $message = $commit->getMessage(); + + +See Also +*********************************************************** + +:doc:`Git\\Commit ` +:doc:`Git\\Commit::getShortMessage() ` \ No newline at end of file diff --git a/sources/classes/commit/get_parent.txt b/sources/classes/commit/get_parent.txt new file mode 100644 index 0000000000..3b42b33d43 --- /dev/null +++ b/sources/classes/commit/get_parent.txt @@ -0,0 +1,31 @@ +.. index:: + single: getParent (Git\Commit method) + + +Git\\Commit::getParent +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getParent** (int *$offset* = 0) + + +Parameters +*********************************************************** + +int *offset* + specified parent offset. + +Return Values +*********************************************************** + +Git\\Commit + +Examples +*********************************************************** + +See Also +*********************************************************** + +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/commit/get_short_message.txt b/sources/classes/commit/get_short_message.txt new file mode 100644 index 0000000000..108acb8991 --- /dev/null +++ b/sources/classes/commit/get_short_message.txt @@ -0,0 +1,32 @@ +.. index:: + single: getShortMessage (Git\Commit method) + + +Git\\Commit::getShortMessage +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getShortMessage** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $commit = $repo->getCommit($ref->getId()); + $message = $commit->getShortMessage(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/commit/get_tree.txt b/sources/classes/commit/get_tree.txt new file mode 100644 index 0000000000..1adb8c8b9c --- /dev/null +++ b/sources/classes/commit/get_tree.txt @@ -0,0 +1,39 @@ +.. index:: + single: getTree (Git\Commit method) + + +Git\\Commit::getTree +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::getTree** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Git\\Tree + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $commit = $repo->getCommit($ref->getId()); + $tree = $commit->getTree(); + +See Also +*********************************************************** + +:doc:`Git\\Tree ` +:doc:`Git\\Commit ` diff --git a/sources/classes/commit/index.txt b/sources/classes/commit/index.txt new file mode 100644 index 0000000000..4d8f162531 --- /dev/null +++ b/sources/classes/commit/index.txt @@ -0,0 +1,9 @@ +Git\\Commit +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/commit/set_author.txt b/sources/classes/commit/set_author.txt new file mode 100644 index 0000000000..b8a6952ecb --- /dev/null +++ b/sources/classes/commit/set_author.txt @@ -0,0 +1,42 @@ +.. index:: + single: setAuthor (Git\Commit method) + + +Git\\Commit::setAuthor +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::setAuthor** (Git\\Signature *$author*) + + +Parameters +*********************************************************** + +*author* + author signature. + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + setAuthor(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))); + + +See Also +*********************************************************** + +:doc:`Git\\Signature ` +:doc:`Git\\Commit::setCommitter ` +`DateTime(PHP Documents) `_ +`DateTimeZone(PHP Documents) `_ \ No newline at end of file diff --git a/sources/classes/commit/set_committer.txt b/sources/classes/commit/set_committer.txt new file mode 100644 index 0000000000..a141d624f0 --- /dev/null +++ b/sources/classes/commit/set_committer.txt @@ -0,0 +1,41 @@ +.. index:: + single: setCommitter (Git\Commit method) + + +Git\\Commit::setCommitter +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::setCommitter** (Git\\Signature *$committer*) + + +Parameters +*********************************************************** + +*committer* + committer signature + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + setCommitter(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))); + +See Also +*********************************************************** + +:doc:`Git\\Signature ` +:doc:`Git\\Commit::setAuthor ` +`DateTime(PHP Documents) `_ +`DateTimeZone(PHP Documents) `_ \ No newline at end of file diff --git a/sources/classes/commit/set_message.txt b/sources/classes/commit/set_message.txt new file mode 100644 index 0000000000..e024e29b85 --- /dev/null +++ b/sources/classes/commit/set_message.txt @@ -0,0 +1,46 @@ +.. index:: + single: setMessage (Git\Commit method) + + +Git\\Commit::setMessage +=========================================================== + +.. note:: + have to set commit message when writing commit. + +Description +*********************************************************** + +public **Git\\Commit::setMessage** (string *$message*) + + +Parameters +*********************************************************** + +*message* + commit message. + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + setMessage( + "initial import\n" // short message + ."\n" + ."import from https://github.com/...\n" + ); + + +See Also +*********************************************************** + +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/commit/set_parent.txt b/sources/classes/commit/set_parent.txt new file mode 100644 index 0000000000..d34f62fe3d --- /dev/null +++ b/sources/classes/commit/set_parent.txt @@ -0,0 +1,61 @@ +.. index:: + single: setParent (Git\Commit method) + + +Git\\Commit::setParent +=========================================================== + +.. note:: + php-git can't add multiple parents now. + this limit will fix later. + +.. note:: + do not call this method when first commit. + +Description +*********************************************************** + +public **Git\\Commit::setParent** (string *$hash*) + + +Parameters +*********************************************************** + +*hash* + commit hash id + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +- First Commit + +.. code-block:: php + + setContent("First Object1"); + $hash = $blob->write(); + $tree = new Git\Tree($repository); + $tree->add($hash,"README",100644); + $tree_hash = $tree->write(); + $commit = new Git\Commit($repository); + $commit->setAuthor(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))); + $commit->setCommitter(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))); + $commit->setTree($tree->getId()); + // when first commit. do not call setParent. + //$commit->setParent(""); + $commit->setMessage("initial import"); + $master_hash = $commit->write(); + + +See Also +*********************************************************** + +:doc:`Git\\Signature ` +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/commit/set_tree.txt b/sources/classes/commit/set_tree.txt new file mode 100644 index 0000000000..c7b6f7ca69 --- /dev/null +++ b/sources/classes/commit/set_tree.txt @@ -0,0 +1,29 @@ +.. index:: + single: setTree (Git\Commit method) + + +Git\\Commit::setTree +=========================================================== + +Description +*********************************************************** + +public **Git\\Commit::setTree** (string *$tree*) + + +Parameters +*********************************************************** + +*tree* + tree hash id + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** + +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/commit/write.txt b/sources/classes/commit/write.txt new file mode 100644 index 0000000000..11a6f30a6f --- /dev/null +++ b/sources/classes/commit/write.txt @@ -0,0 +1,32 @@ +.. index:: + single: write (Git\Commit method) + + +Git\\Commit::write +=========================================================== + +write current commit. + +Description +*********************************************************** + +public **Git\\Commit::write** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +boolean + +Examples +*********************************************************** + +See Also +*********************************************************** + +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/entry/__construct.txt b/sources/classes/entry/__construct.txt new file mode 100644 index 0000000000..70b585aa10 --- /dev/null +++ b/sources/classes/entry/__construct.txt @@ -0,0 +1,26 @@ +.. index:: + single: __construct (Git\Tree\Entry method) + + +Git\\Tree\\Entry::__construct +=========================================================== + +Description +*********************************************************** + +**Git\\Tree\\Entry::__construct** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/entry/index.txt b/sources/classes/entry/index.txt new file mode 100644 index 0000000000..0279c084fc --- /dev/null +++ b/sources/classes/entry/index.txt @@ -0,0 +1,9 @@ +Git\\Tree\\Entry +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/entry/to_object.txt b/sources/classes/entry/to_object.txt new file mode 100644 index 0000000000..2a8d48ca0a --- /dev/null +++ b/sources/classes/entry/to_object.txt @@ -0,0 +1,26 @@ +.. index:: + single: toObject (Git\Tree\Entry method) + + +Git\\Tree\\Entry::toObject +=========================================================== + +Description +*********************************************************** + +public **Git\\Tree\\Entry::toObject** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/git/index.txt b/sources/classes/git/index.txt new file mode 100644 index 0000000000..00d6fad742 --- /dev/null +++ b/sources/classes/git/index.txt @@ -0,0 +1,9 @@ +Git\\Git +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/index/add.txt b/sources/classes/index/add.txt new file mode 100644 index 0000000000..6fdd1d8457 --- /dev/null +++ b/sources/classes/index/add.txt @@ -0,0 +1,40 @@ +.. index:: + single: add (Git\Index method) + + +Git\\Index::add +=========================================================== + +add specified file to your index. you have to call Git::Index::write after this method. + + +Description +*********************************************************** + +public **Git\\Index::add** (string *$path*,int *$staging* = 0) + + +Parameters +*********************************************************** + +*path* + file path. + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block:: php + + getIndex(); + $index->add("newcontents.txt"); + $index->write(); + $index->refresh(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/index/count.txt b/sources/classes/index/count.txt new file mode 100644 index 0000000000..c82b6e6f1a --- /dev/null +++ b/sources/classes/index/count.txt @@ -0,0 +1,36 @@ +.. index:: + single: count (Git\Index method) + + +Git\\Index::count +=========================================================== + +Countable Interface. you can count(Git::Index) this method. + +Description +*********************************************************** + +public **Git\\Index::count** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block:: php + + getIndex(); + echo count($index); + // same as echo $index->count(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/index/find.txt b/sources/classes/index/find.txt new file mode 100644 index 0000000000..ec52795717 --- /dev/null +++ b/sources/classes/index/find.txt @@ -0,0 +1,41 @@ +.. index:: + single: find (Git\Index method) + + +Git\\Index::find +=========================================================== + +returns specified file offset in git_index. + +.. note:: + this method may change next development. + +Description +*********************************************************** + +public **Git\\Index::find** (string *$path*) + + +Parameters +*********************************************************** + +*path* + file name + +Return Values +*********************************************************** + +int offset + +Examples +*********************************************************** + +.. code-block::php + + getIndex(); + $offset = $index->find("README.md"); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/index/get_entry.txt b/sources/classes/index/get_entry.txt new file mode 100644 index 0000000000..1281b2b7cd --- /dev/null +++ b/sources/classes/index/get_entry.txt @@ -0,0 +1,70 @@ +.. index:: + single: getEntry (Git\Index method) + + +Git\\Index::getEntry +=========================================================== + +returns specified index entry. + +Description +*********************************************************** + +public **Git\\Index::getEntry** (int *$offset* = 0) + + +Parameters +*********************************************************** + +*offset* + index offset + + +Return Values +*********************************************************** + +Stdclass + +Examples +*********************************************************** + +.. code-block::php + + getIndex(); + $result = $index->getEntry(0); + /* + object(stdClass)#4 (12) { + ["path"]=> + string(10) ".gitignore" + ["oid"]=> + string(40) "5b1a5b7ad3dd7141ccacd25e50e3078de4288a22" + ["dev"]=> + int(2050) + ["ino"]=> + int(1205498) + ["mode"]=> + int(33188) + ["uid"]=> + int(1000) + ["gid"]=> + int(1000) + ["file_size"]=> + int(364) + ["flags"]=> + int(10) + ["flags_extended"]=> + int(0) + ["ctime"]=> + int(1294640280) + ["mtime"]=> + int(1294640280) + } + */ + +.. note:: + return object may change next development + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/index/get_iterator.txt b/sources/classes/index/get_iterator.txt new file mode 100644 index 0000000000..9e059f1eee --- /dev/null +++ b/sources/classes/index/get_iterator.txt @@ -0,0 +1,34 @@ +.. index:: + single: getIterator (Git\Index method) + + +Git\\Index::getIterator +=========================================================== + +IteratorAggregate interface. + +Description +*********************************************************** + +public **Git\\Index::getIterator** () + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block::php + + getIndex(); + foreach($index->getIterator() as $entry){ + // something... + } + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/index/index.txt b/sources/classes/index/index.txt new file mode 100644 index 0000000000..86c808d1ad --- /dev/null +++ b/sources/classes/index/index.txt @@ -0,0 +1,10 @@ +Git\\Index +=========================== + +representation of git index. + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/index/refresh.txt b/sources/classes/index/refresh.txt new file mode 100644 index 0000000000..56e8e19c6d --- /dev/null +++ b/sources/classes/index/refresh.txt @@ -0,0 +1,38 @@ +.. index:: + single: refresh (Git\Index method) + + +Git\\Index::refresh +=========================================================== + +reloading current repository index. + +Description +*********************************************************** + +public **Git\\Index::refresh** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + getIndex(); + /** + * some change wrote. + * you have to refresh index. + */ + $index->refresh(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/index/write.txt b/sources/classes/index/write.txt new file mode 100644 index 0000000000..63bafa4bd8 --- /dev/null +++ b/sources/classes/index/write.txt @@ -0,0 +1,35 @@ +.. index:: + single: write (Git\Index method) + + +Git\\Index::write +=========================================================== + +write current index to filesystem. + +Description +*********************************************************** + +public **Git\\Index::write** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block::php + + getIndex(); + $index->add("newcontents.txt"); + $index->write(); + $index->refresh(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/manager/__construct.txt b/sources/classes/manager/__construct.txt new file mode 100644 index 0000000000..ddc684e9ed --- /dev/null +++ b/sources/classes/manager/__construct.txt @@ -0,0 +1,39 @@ +.. index:: + single: __construct (Git\Reference\Manager method) + + +Git\\Reference\\Manager::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference\\Manager::__construct** (Git\\Repository *$repository*) + + +Parameters +*********************************************************** + +*repository* + Git\\Repository + + +Return Values +*********************************************************** + +:doc:`Git\\Reference\\Manager ` + +Examples +*********************************************************** + +.. code-block:: php + + ` +:doc:`Git\\Repository ` diff --git a/sources/classes/manager/create.txt b/sources/classes/manager/create.txt new file mode 100644 index 0000000000..d2757e4068 --- /dev/null +++ b/sources/classes/manager/create.txt @@ -0,0 +1,48 @@ +.. index:: + single: create (Git\Reference\Manager method) + + +Git\\Reference\\Manager::create +=========================================================== + +.. note:: + Currentry can create non symbolic reference only. + (this is php-git limits. this issue fix soon) + +Description +*********************************************************** + +public **Git\\Reference\\Manager::create** (string *$name*,string *$oid*) + + +Parameters +*********************************************************** + +*name* + reference name (e.g. refs/heads/reference-name) + +*oid* + target commit id + +Return Values +*********************************************************** + +boolean + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + //create new branch `new-branch` what targets `master` commit. + $manager->create("refs/heads/new-branch",$master->getId()); + +See Also +*********************************************************** + +:doc:`Git\\Commit ` +:doc:`Git\\Reference ` diff --git a/sources/classes/manager/get_list.txt b/sources/classes/manager/get_list.txt new file mode 100644 index 0000000000..d439b22efb --- /dev/null +++ b/sources/classes/manager/get_list.txt @@ -0,0 +1,39 @@ +.. index:: + single: getList (Git\Reference\Manager method) + + +Git\\Reference\\Manager::getList +=========================================================== + +get available reference list. + +Description +*********************************************************** + +public **Git\\Reference\\Manager::getList** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +array Git\\Reference + +Examples +*********************************************************** + +.. code-block:: php + + getList(); + +See Also +*********************************************************** + +:doc:`Git\\Reference ` \ No newline at end of file diff --git a/sources/classes/manager/index.txt b/sources/classes/manager/index.txt new file mode 100644 index 0000000000..75951c8f50 --- /dev/null +++ b/sources/classes/manager/index.txt @@ -0,0 +1,9 @@ +Git\\Reference\\Manager +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/manager/lookup.txt b/sources/classes/manager/lookup.txt new file mode 100644 index 0000000000..d485206f35 --- /dev/null +++ b/sources/classes/manager/lookup.txt @@ -0,0 +1,48 @@ +.. index:: + single: lookup (Git\Reference\Manager method) + + +Git\\Reference\\Manager::lookup +=========================================================== + +this method same as Git\Repository::lookup(); + +Description +*********************************************************** + +public **Git\\Reference\\Manager::lookup** (string *$name*) + + +Parameters +*********************************************************** + +*name* + reference name (e.g. refs/heads/master) + + +Return Values +*********************************************************** + +Git\\Reference + +ChangeLog +*********************************************************** + +- method name changed from lookupRef to lookup. + (can't define lookup method because php-compat defines `lookup` preprocessor.) + +Examples +*********************************************************** + +.. code-block:: php + + lookup("refs/heads/master"); + + +See Also +*********************************************************** + +:doc:`Git\\Repository::lookupRef ` \ No newline at end of file diff --git a/sources/classes/manager/pack.txt b/sources/classes/manager/pack.txt new file mode 100644 index 0000000000..149be41ecf --- /dev/null +++ b/sources/classes/manager/pack.txt @@ -0,0 +1,37 @@ +.. index:: + single: pack (Git\Reference\Manager method) + + +Git\\Reference\\Manager::pack +=========================================================== + +.. note:: + WARNING: calling this method may invalidate any existing references previously loaded on the cache. + +Description +*********************************************************** + +public **Git\\Reference\\Manager::pack** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +boolean + +Examples +*********************************************************** + +.. code-block:: php + + pack(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/object/get_id.txt b/sources/classes/object/get_id.txt new file mode 100644 index 0000000000..c85c2821ee --- /dev/null +++ b/sources/classes/object/get_id.txt @@ -0,0 +1,26 @@ +.. index:: + single: getId (Git\Object method) + + +Git\\Object::getId +=========================================================== + +Description +*********************************************************** + +public **Git\\Object::getId** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/object/get_type.txt b/sources/classes/object/get_type.txt new file mode 100644 index 0000000000..dd17aea314 --- /dev/null +++ b/sources/classes/object/get_type.txt @@ -0,0 +1,46 @@ +.. index:: + single: getType (Git\Object method) + + +Git\\Object::getType +=========================================================== + +returns current object type + +Description +*********************************************************** + +public **Git\\Object::getType** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +int object_type + +- Git\\Object\\Tree +- Git\\Object\\Blob + +Examples +*********************************************************** + +.. code-block:: php + + entries as $entry){ + $object = $entry->toObject(); + if($object->getType() == Git\Object\Tree){ + // + } + } + +See Also +*********************************************************** + +:doc:`Git\\Object::isTree ` +:doc:`Git\\Object::isBlob ` \ No newline at end of file diff --git a/sources/classes/object/index.txt b/sources/classes/object/index.txt new file mode 100644 index 0000000000..3b26bab176 --- /dev/null +++ b/sources/classes/object/index.txt @@ -0,0 +1,10 @@ +Git\\Object +=========================== + +Base class for Git\\Commit, Git\\Blob, Git\\Tree, Git\\Commit + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/object/is_blob.txt b/sources/classes/object/is_blob.txt new file mode 100644 index 0000000000..4e7fb9ba41 --- /dev/null +++ b/sources/classes/object/is_blob.txt @@ -0,0 +1,43 @@ +.. index:: + single: isBlob (Git\Object method) + + +Git\\Object::isBlob +=========================================================== + +return true when object is blob. + +Description +*********************************************************** + +public **Git\\Object::isBlob** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block:: php + + entries as $entry){ + $object = $entry->toObject(); + if($object->isTree()){ + // + } else if($object->isBlob()){ + // + } + } + +See Also +*********************************************************** + +:doc:`Git\\Object::isTree ` +:doc:`Git\\Object::getType ` \ No newline at end of file diff --git a/sources/classes/object/is_tree.txt b/sources/classes/object/is_tree.txt new file mode 100644 index 0000000000..142e5860a1 --- /dev/null +++ b/sources/classes/object/is_tree.txt @@ -0,0 +1,48 @@ +.. index:: + single: isTree (Git\Object method) + + +Git\\Object::isTree +=========================================================== + +return true when object is tree. + + +Description +*********************************************************** + +public **Git\\Object::isTree** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +boolean + +Examples +*********************************************************** + +.. code-block:: php + + entries as $entry){ + $object = $entry->toObject(); + if($object->isTree()){ + // + } else if($object->isBlob()){ + // + } + } + +See Also +*********************************************************** + + +:doc:`Git\\Object::isBlob ` +:doc:`Git\\Object::getType ` \ No newline at end of file diff --git a/sources/classes/object/write.txt b/sources/classes/object/write.txt new file mode 100644 index 0000000000..e89ec80b17 --- /dev/null +++ b/sources/classes/object/write.txt @@ -0,0 +1,26 @@ +.. index:: + single: write (Git\Object method) + + +Git\\Object::write +=========================================================== + +Description +*********************************************************** + +public **Git\\Object::write** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/odb/__construct.txt b/sources/classes/odb/__construct.txt new file mode 100644 index 0000000000..136515fb50 --- /dev/null +++ b/sources/classes/odb/__construct.txt @@ -0,0 +1,26 @@ +.. index:: + single: __construct (Git\ODB method) + + +Git\\ODB::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\ODB::__construct** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/odb/add_alternate.txt b/sources/classes/odb/add_alternate.txt new file mode 100644 index 0000000000..839c2e3cb0 --- /dev/null +++ b/sources/classes/odb/add_alternate.txt @@ -0,0 +1,28 @@ +.. index:: + single: addAlternate (Git\ODB method) + + +Git\\ODB::addAlternate +=========================================================== + +Description +*********************************************************** + +public **Git\\ODB::addAlternate** (Git\Backend *$backend*) + + +Parameters +*********************************************************** + +Git\Backend *backend* + custom backend object + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/odb/add_backend.txt b/sources/classes/odb/add_backend.txt new file mode 100644 index 0000000000..d56494058f --- /dev/null +++ b/sources/classes/odb/add_backend.txt @@ -0,0 +1,28 @@ +.. index:: + single: addBackend (Git\ODB method) + + +Git\\ODB::addBackend +=========================================================== + +Description +*********************************************************** + +public **Git\\ODB::addBackend** (Git\Backend *$backend*) + + +Parameters +*********************************************************** + +Git\Backend *backend* + custom backend object + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/odb/index.txt b/sources/classes/odb/index.txt new file mode 100644 index 0000000000..64c8e18558 --- /dev/null +++ b/sources/classes/odb/index.txt @@ -0,0 +1,9 @@ +Git\\ODB +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/rawobject/__construct.txt b/sources/classes/rawobject/__construct.txt new file mode 100644 index 0000000000..e4b05fc8b4 --- /dev/null +++ b/sources/classes/rawobject/__construct.txt @@ -0,0 +1,34 @@ +.. index:: + single: __construct (Git\RawObject method) + + +Git\\RawObject::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\RawObject::__construct** (int *$type*, string *$data*, [int *$len*]) + + +Parameters +*********************************************************** + +*type* + object type. + +*data* + object data + +*len* + object data length + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/rawobject/get_id.txt b/sources/classes/rawobject/get_id.txt new file mode 100644 index 0000000000..e32014893a --- /dev/null +++ b/sources/classes/rawobject/get_id.txt @@ -0,0 +1,26 @@ +.. index:: + single: getId (Git\RawObject method) + + +Git\\RawObject::getId +=========================================================== + +Description +*********************************************************** + +public **Git\\RawObject::getId** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/rawobject/index.txt b/sources/classes/rawobject/index.txt new file mode 100644 index 0000000000..c6e44f0b90 --- /dev/null +++ b/sources/classes/rawobject/index.txt @@ -0,0 +1,11 @@ +Git\\RawObject +=========================== + +this class uses php-git internal. +see also :doc:`Git\\Backend ` + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/reference/__construct.txt b/sources/classes/reference/__construct.txt new file mode 100644 index 0000000000..ff85c29e9d --- /dev/null +++ b/sources/classes/reference/__construct.txt @@ -0,0 +1,28 @@ +.. index:: + single: __construct (Git\Reference method) + + +Git\\Reference::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::__construct** (Git\Repository *$repository*) + + +Parameters +*********************************************************** + +Git\Repository *repository* + Git\Repository object. + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/get_id.txt b/sources/classes/reference/get_id.txt new file mode 100644 index 0000000000..751936ee8a --- /dev/null +++ b/sources/classes/reference/get_id.txt @@ -0,0 +1,26 @@ +.. index:: + single: getId (Git\Reference method) + + +Git\\Reference::getId +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::getId** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/get_name.txt b/sources/classes/reference/get_name.txt new file mode 100644 index 0000000000..49ea57db3b --- /dev/null +++ b/sources/classes/reference/get_name.txt @@ -0,0 +1,26 @@ +.. index:: + single: getName (Git\Reference method) + + +Git\\Reference::getName +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::getName** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/get_target.txt b/sources/classes/reference/get_target.txt new file mode 100644 index 0000000000..8d0a1e7e1a --- /dev/null +++ b/sources/classes/reference/get_target.txt @@ -0,0 +1,26 @@ +.. index:: + single: getTarget (Git\Reference method) + + +Git\\Reference::getTarget +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::getTarget** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/get_type.txt b/sources/classes/reference/get_type.txt new file mode 100644 index 0000000000..fd0236a8b7 --- /dev/null +++ b/sources/classes/reference/get_type.txt @@ -0,0 +1,26 @@ +.. index:: + single: getType (Git\Reference method) + + +Git\\Reference::getType +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::getType** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/index.txt b/sources/classes/reference/index.txt new file mode 100644 index 0000000000..fb1796a78f --- /dev/null +++ b/sources/classes/reference/index.txt @@ -0,0 +1,11 @@ +Git\\Reference +=========================== + +.. note:: + this class is experimental. + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/reference/is_blob.txt b/sources/classes/reference/is_blob.txt new file mode 100644 index 0000000000..6d1cff9d75 --- /dev/null +++ b/sources/classes/reference/is_blob.txt @@ -0,0 +1,26 @@ +.. index:: + single: isBlob (Git\Reference method) + + +Git\\Reference::isBlob +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::isBlob** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/is_tree.txt b/sources/classes/reference/is_tree.txt new file mode 100644 index 0000000000..20538ee5ea --- /dev/null +++ b/sources/classes/reference/is_tree.txt @@ -0,0 +1,26 @@ +.. index:: + single: isTree (Git\Reference method) + + +Git\\Reference::isTree +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::isTree** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/reference/write.txt b/sources/classes/reference/write.txt new file mode 100644 index 0000000000..61b2fc2dca --- /dev/null +++ b/sources/classes/reference/write.txt @@ -0,0 +1,26 @@ +.. index:: + single: write (Git\Reference method) + + +Git\\Reference::write +=========================================================== + +Description +*********************************************************** + +public **Git\\Reference::write** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/repository/__construct.txt b/sources/classes/repository/__construct.txt new file mode 100644 index 0000000000..30017b900e --- /dev/null +++ b/sources/classes/repository/__construct.txt @@ -0,0 +1,35 @@ +.. index:: + single: __construct (Git\Repository method) + + +Git\\Repository::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Repository::__construct** ( [*$repository_path*]) + + +Parameters +*********************************************************** + +*repository_path* + git repository path. + + +Return Values +*********************************************************** + +:doc:`Git\Repository ` + +Examples +*********************************************************** + +.. code-block:: php + + ` + +*priority* + [low] 1 ... 5[high] + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +See Also +*********************************************************** + +:doc:`Git\\Backend ` \ No newline at end of file diff --git a/sources/classes/repository/add_backend.txt b/sources/classes/repository/add_backend.txt new file mode 100644 index 0000000000..ee61466a70 --- /dev/null +++ b/sources/classes/repository/add_backend.txt @@ -0,0 +1,119 @@ +.. index:: + single: addBackend (Git\Repository method) + + +Git\\Repository::addBackend +=========================================================== + +Description +*********************************************************** + +public **Git\\Repository::addBackend** (*$backend*, *$priority*) + + +Parameters +*********************************************************** + +*backend* + Specifies a class that inherits from :doc:`Git\\Backend ` + +*priority* + [low] 1 ... 5[high] + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + exists($key)){ + $object = $this->get($key); + return $object; + } + } + + /** + * Read Header + * + * @param string $key sha1 hash. + * @return Git\RawObject + */ + public function read_header($key){ + if(isset($this->memory[$key])){ + return new \Git\RawObject($obj->type,"",$obj->len); + } + } + + /** + * check specified contents. + * + * @param string $key sha1 hash. + * @return boolean + */ + public function exists($key){ + if(isset($this->memory[$key])){ + return true; + }else{ + return false; + } + } + + /** + * write contents + * + * you have to write key,data,type your storage engine. + * + * @param string $key sha1 hash. + * @param Git\RawObject $object. + * @return hash + */ + public function write($object){ + $key = $object->getId(); + $std = new \Stdclass(); + $std->data = $object->data; + $std->type = $object->type; + $std->len = $object->len; + $this->memory[$key] = $std; + return $key; + } + + public function free() + { + unset($this->memory); + } + } + + + $repository = new Git\Repository("/tmp/example/.git"); + $repository->addBackend(new MemoryBackend(), 5);// higher priority. + +See Also +*********************************************************** + +:doc:`Git\\Backend ` \ No newline at end of file diff --git a/sources/classes/repository/get_commit.txt b/sources/classes/repository/get_commit.txt new file mode 100644 index 0000000000..57beb1dbb6 --- /dev/null +++ b/sources/classes/repository/get_commit.txt @@ -0,0 +1,41 @@ +.. index:: + single: getCommit (Git\Repository method) + + +Git\\Repository::getCommit +=========================================================== + +returns specified Git\\Commit. + +Description +*********************************************************** + +public **Git\\Repository::getCommit** (string *$hash*) + + +Parameters +*********************************************************** + +*hash* + commit hash id. + + +Return Values +*********************************************************** + +:doc:`Git\\Commit ` + +Examples +*********************************************************** + +.. code-block:: php + + getCommit("cd584aba22827a6a59cad3ab1b4e026418558bfb"); + + +See Also +*********************************************************** + +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/repository/get_index.txt b/sources/classes/repository/get_index.txt new file mode 100644 index 0000000000..9eb8289742 --- /dev/null +++ b/sources/classes/repository/get_index.txt @@ -0,0 +1,36 @@ +.. index:: + single: getIndex (Git\Repository method) + + +Git\\Repository::getIndex +=========================================================== + +returns current Git\Index object. this method will fail when bare repository. + +Description +*********************************************************** + +public **Git\\Repository::getIndex** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +:doc:`Git\\Index ` + +Examples +*********************************************************** + +.. code-block:: php + + getIndex(); + + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/repository/get_object.txt b/sources/classes/repository/get_object.txt new file mode 100644 index 0000000000..d9572f5f7d --- /dev/null +++ b/sources/classes/repository/get_object.txt @@ -0,0 +1,44 @@ +.. index:: + single: getObject (Git\Repository method) + + +Git\\Repository::getObject +=========================================================== + +returns specified Git\\Blob. + +.. note:: + this method will rename to Git\\Repository::getBlob + +Description +*********************************************************** + +public **Git\\Repository::getObject** (*$hash*) + + +Parameters +*********************************************************** + +*hash* + blob hash id. + + +Return Values +*********************************************************** + +:doc:`Git\\Blob ` + +Examples +*********************************************************** + +.. code-block:: php + + getObject("cd584aba22827a6a59cad3ab1b4e026418558bfb"); + + +See Also +*********************************************************** + +:doc:`Git\\Blob ` diff --git a/sources/classes/repository/get_references.txt b/sources/classes/repository/get_references.txt new file mode 100644 index 0000000000..073e066275 --- /dev/null +++ b/sources/classes/repository/get_references.txt @@ -0,0 +1,43 @@ +.. index:: + single: getReferences (Git\Repository method) + + +Git\\Repository::getReferences +=========================================================== + +returns a list with all the references that can be found in a repository. + +.. note:: + this method may changed next development. + +Description +*********************************************************** + +public **Git\\Repository::getReferences** (int *$flag*) + + +Parameters +*********************************************************** + +*flag* + fill them out lator + + +Return Values +*********************************************************** + +:doc:`array Git\\References ` + +Examples +*********************************************************** + +.. code-block:: php + + getReferences(); + +See Also +*********************************************************** + +:doc:`Git\\Reference ` \ No newline at end of file diff --git a/sources/classes/repository/get_tree.txt b/sources/classes/repository/get_tree.txt new file mode 100644 index 0000000000..181317e395 --- /dev/null +++ b/sources/classes/repository/get_tree.txt @@ -0,0 +1,40 @@ +.. index:: + single: getTree (Git\Repository method) + + +Git\\Repository::getTree +=========================================================== + +returns specified Git\\Tree. + +Description +*********************************************************** + +public **Git\\Repository::getTree** (*$hash*) + + +Parameters +*********************************************************** + +*hash* + tree hash id. + + +Return Values +*********************************************************** + +:doc:`Git\\Tree ` + +Examples +*********************************************************** + +.. code-block:: php + + getTree("cd584aba22827a6a59cad3ab1b4e026418558bfb"); + +See Also +*********************************************************** + +:doc:`Git\\Tree ` \ No newline at end of file diff --git a/sources/classes/repository/get_walker.txt b/sources/classes/repository/get_walker.txt new file mode 100644 index 0000000000..df9acbb732 --- /dev/null +++ b/sources/classes/repository/get_walker.txt @@ -0,0 +1,44 @@ +.. index:: + single: getWalker (Git\Repository method) + + +Git\\Repository::getWalker +=========================================================== + +returns Git\Revwalk. + +Description +*********************************************************** + +public **Git\\Repository::getWalker** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +:doc:`Git\\Revwalk ` + +Examples +*********************************************************** + + +.. code-block:: php + + lookupRef("refs/heads/master"); + $walker = $repo->getWalker(); + $walker->push($reference->getId()); + + while($commit = $walker->next()){ + var_dump($commit); + } + +See Also +*********************************************************** + +:doc:`Git\\Revwalk ` +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/repository/index.txt b/sources/classes/repository/index.txt new file mode 100644 index 0000000000..1e7e1fd91e --- /dev/null +++ b/sources/classes/repository/index.txt @@ -0,0 +1,10 @@ +Git\\Repository +=========================== + +representation of git_repository. + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/repository/init.txt b/sources/classes/repository/init.txt new file mode 100644 index 0000000000..3a90e70106 --- /dev/null +++ b/sources/classes/repository/init.txt @@ -0,0 +1,45 @@ +.. index:: + single: init (Git\Repository method) + + +Git\\Repository::init +=========================================================== + +create a new git repository on your filesystem. + +Description +*********************************************************** + +public static **Git\\Repository::init** (*$path*, *$is_bare*) + + +Parameters +*********************************************************** + +*path* + blank directory + +*is_bare* + create bare repository when is_bare is true. + + +.. note:: + do not call this method when specified repository exists. + +Return Values +*********************************************************** + +:doc:`Git\\Repository ` + +Examples +*********************************************************** + +.. code-block:: php + + ` \ No newline at end of file diff --git a/sources/classes/repository/lookup_ref.txt b/sources/classes/repository/lookup_ref.txt new file mode 100644 index 0000000000..f98348ffc7 --- /dev/null +++ b/sources/classes/repository/lookup_ref.txt @@ -0,0 +1,40 @@ +.. index:: + single: lookupRef (Git\Repository method) + + +Git\\Repository::lookupRef +=========================================================== + +return specified reference object. + +Description +*********************************************************** + +public **Git\\Repository::lookupRef** (*$name*) + + +Parameters +*********************************************************** + +*name* + reference name. + + +Return Values +*********************************************************** + +:doc:`Git\\Reference ` + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + +See Also +*********************************************************** + +:doc:`Git\\Reference ` \ No newline at end of file diff --git a/sources/classes/repository/open2.txt b/sources/classes/repository/open2.txt new file mode 100644 index 0000000000..75fb4193c2 --- /dev/null +++ b/sources/classes/repository/open2.txt @@ -0,0 +1,53 @@ +.. index:: + single: open2 (Git\Repository method) + + +Git\\Repository::open2 +=========================================================== + +Description +*********************************************************** + +public **Git\\Repository::open2** (string *$git_dir*, string *$git_object_dir*, string *$git_index_file*, string *$git_working_tree*) + + +Parameters +*********************************************************** + +*git_dir* + git repository directory + +*git_object_dir* + object directory + +*git_index_file* + index file + +*git_working_tree* + working tree directory + +Return Values +*********************************************************** + +boolean + +Examples +*********************************************************** + +.. code-block:: php + + open2( + "/home/chobie/src/libgit2/.git", // git directory + "/home/chobie/src/libgit2/.git/objects",// git object directory + "/home/chobie/src/libgit2/.git/index", // git index file + "/home/chobie/src/libgit2/" // git working tree + ); + + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/repository/open3.txt b/sources/classes/repository/open3.txt new file mode 100644 index 0000000000..ced0b9ffd6 --- /dev/null +++ b/sources/classes/repository/open3.txt @@ -0,0 +1,37 @@ +.. index:: + single: open3 (Git\Repository method) + + +Git\\Repository::open3 +=========================================================== + +Description +*********************************************************** + +public **Git\\Repository::open3** (string *$git_dir*, [Git\Odb *$odb*], [string *$index*], [string *$tree*]) + + +Parameters +*********************************************************** + +*git_dir* + specified git repository directory + +*odb* + Git\Odb object which added custom backends. + +*index* + specified git index path. + +*tree* + specified git working tree path. + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/revwalk/__construct.txt b/sources/classes/revwalk/__construct.txt new file mode 100644 index 0000000000..977eef6222 --- /dev/null +++ b/sources/classes/revwalk/__construct.txt @@ -0,0 +1,29 @@ +.. index:: + single: __construct (Git\Revwalk method) + + +Git\\Revwalk::__construct +=========================================================== + +.. note:: + you should use Git\\Repository::getWalker() instead. + +Description +*********************************************************** + +public **Git\\Revwalk::__construct** () + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** + +:doc:`Git\\Repository ` +:doc:`Git\\Repository::getWalker() ` \ No newline at end of file diff --git a/sources/classes/revwalk/hide.txt b/sources/classes/revwalk/hide.txt new file mode 100644 index 0000000000..e21390fd38 --- /dev/null +++ b/sources/classes/revwalk/hide.txt @@ -0,0 +1,52 @@ +.. index:: + single: hide (Git\Revwalk method) + + +Git\\Revwalk::hide +=========================================================== + +hide uninterested commits. + +:: + + o---o---o---o---o---o---o---o + `--o---o--/ + ^hide + +:: + + o---o---o---o---o---o---o---o + + +Description +*********************************************************** + +public **Git\\Revwalk::hide** (*$hash*) + + +Parameters +*********************************************************** + +*hash* + uninterested commit id + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $revwalk = $repo->getWalker(); + $uninterested = "";// specified uninterested commit id + $revwalk->hide($uninterested); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/revwalk/index.txt b/sources/classes/revwalk/index.txt new file mode 100644 index 0000000000..076b50f1bf --- /dev/null +++ b/sources/classes/revwalk/index.txt @@ -0,0 +1,9 @@ +Git\\Revwalk +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/revwalk/next.txt b/sources/classes/revwalk/next.txt new file mode 100644 index 0000000000..363129a702 --- /dev/null +++ b/sources/classes/revwalk/next.txt @@ -0,0 +1,40 @@ +.. index:: + single: next (Git\Revwalk method) + + +Git\\Revwalk::next +=========================================================== + +get next travasable commit. + +Description +*********************************************************** + +public **Git\\Revwalk::next** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +:doc:`Git\\Commit ` + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $revwalk = $repo->getWalker(); + $revwalk->push($master->getId()); + $commit = $revwalk->next(); + +See Also +*********************************************************** + +:doc:`Git\\Commit ` \ No newline at end of file diff --git a/sources/classes/revwalk/push.txt b/sources/classes/revwalk/push.txt new file mode 100644 index 0000000000..248c5ed3f1 --- /dev/null +++ b/sources/classes/revwalk/push.txt @@ -0,0 +1,46 @@ +.. index:: + single: push (Git\Revwalk method) + + +Git\\Revwalk::push +=========================================================== + +push commit to revwalk object. + +Description +*********************************************************** + +public **Git\\Revwalk::push** (string *$hash*) + + +Parameters +*********************************************************** + +*hash* + commit id + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $revwalk = $repo->getWalker(); + $revwalk->push($master->getId()); + while($commit = $revwalk->next()){ + // + } + +See Also +*********************************************************** + +:doc:`Git\\Reference ` +:doc:`Git\\Revwalk::next() ` \ No newline at end of file diff --git a/sources/classes/revwalk/reset.txt b/sources/classes/revwalk/reset.txt new file mode 100644 index 0000000000..5d08195cd5 --- /dev/null +++ b/sources/classes/revwalk/reset.txt @@ -0,0 +1,39 @@ +.. index:: + single: reset (Git\Revwalk method) + + +Git\\Revwalk::reset +=========================================================== + +reset internal pointer. + +Description +*********************************************************** + +public **Git\\Revwalk::reset** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $revwalk = $repo->getWalker(); + $revwalk->push($master->getId()); + $commit = $revwalk->next(); + $revwalk->reset(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/revwalk/sort.txt b/sources/classes/revwalk/sort.txt new file mode 100644 index 0000000000..94c15b06f9 --- /dev/null +++ b/sources/classes/revwalk/sort.txt @@ -0,0 +1,42 @@ +.. index:: + single: sort (Git\Revwalk method) + + +Git\\Revwalk::sort +=========================================================== + +Description +*********************************************************** + +public **Git\\Revwalk::sort** (int *$sort_type*) + +Parameters +*********************************************************** + +*sort_type* + specified sort type + +- Git\\Revwalk\\SORT_NONE +- Git\\Revwalk\\SORT_TOPO +- Git\\Revwalk\\SORT_DATE +- Git\\Revwalk\\SORT_REVERSE + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $revwalk = $repo->getWalker(); + $revwalk->sort(Git\Revwalk\SORT_REVERSE); + $revwalk->push($master->getId()); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/signature/__construct.txt b/sources/classes/signature/__construct.txt new file mode 100644 index 0000000000..139be090fd --- /dev/null +++ b/sources/classes/signature/__construct.txt @@ -0,0 +1,49 @@ +.. index:: + single: __construct (Git\Signature method) + + +Git\\Signature::__construct +=========================================================== + +create signature. + +Description +*********************************************************** + +public **Git\\Signature::__construct** (string *$name*,string *$email*, \\DateTime *$when*) + + +Parameters +*********************************************************** + +*name* + full name. e.g) John Smith + +*email* + email. e.g) john.smith@example.com + +*when* + commit time + + +Return Values +*********************************************************** + +:doc:`Git\\Signature ` + +Examples +*********************************************************** + +.. code-block:: php + + ` \ No newline at end of file diff --git a/sources/classes/signature/index.txt b/sources/classes/signature/index.txt new file mode 100644 index 0000000000..760a7aface --- /dev/null +++ b/sources/classes/signature/index.txt @@ -0,0 +1,9 @@ +Git\\Signature +=========================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/tag/__construct.txt b/sources/classes/tag/__construct.txt new file mode 100644 index 0000000000..a7dfea078f --- /dev/null +++ b/sources/classes/tag/__construct.txt @@ -0,0 +1,28 @@ +.. index:: + single: __construct (Git\Tag method) + + +Git\\Tag::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::__construct** (*$repository*) + + +Parameters +*********************************************************** + +*repository* + fill them out later + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/get_id.txt b/sources/classes/tag/get_id.txt new file mode 100644 index 0000000000..b3db254693 --- /dev/null +++ b/sources/classes/tag/get_id.txt @@ -0,0 +1,26 @@ +.. index:: + single: getId (Git\Tag method) + + +Git\\Tag::getId +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::getId** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/get_message.txt b/sources/classes/tag/get_message.txt new file mode 100644 index 0000000000..c9ee07bade --- /dev/null +++ b/sources/classes/tag/get_message.txt @@ -0,0 +1,26 @@ +.. index:: + single: getMessage (Git\Tag method) + + +Git\\Tag::getMessage +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::getMessage** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/get_name.txt b/sources/classes/tag/get_name.txt new file mode 100644 index 0000000000..e5e61459b0 --- /dev/null +++ b/sources/classes/tag/get_name.txt @@ -0,0 +1,26 @@ +.. index:: + single: getName (Git\Tag method) + + +Git\\Tag::getName +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::getName** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/get_target.txt b/sources/classes/tag/get_target.txt new file mode 100644 index 0000000000..4ec63969fa --- /dev/null +++ b/sources/classes/tag/get_target.txt @@ -0,0 +1,26 @@ +.. index:: + single: getTarget (Git\Tag method) + + +Git\\Tag::getTarget +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::getTarget** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/get_type.txt b/sources/classes/tag/get_type.txt new file mode 100644 index 0000000000..1304ee9035 --- /dev/null +++ b/sources/classes/tag/get_type.txt @@ -0,0 +1,26 @@ +.. index:: + single: getType (Git\Tag method) + + +Git\\Tag::getType +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::getType** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/index.txt b/sources/classes/tag/index.txt new file mode 100644 index 0000000000..d6ca7a118a --- /dev/null +++ b/sources/classes/tag/index.txt @@ -0,0 +1,12 @@ +Git\\Tag +=========================== + + +.. note:: + this class experimental. use :doc:`Git\\Reference ` instead. + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/tag/is_blob.txt b/sources/classes/tag/is_blob.txt new file mode 100644 index 0000000000..b1980c842e --- /dev/null +++ b/sources/classes/tag/is_blob.txt @@ -0,0 +1,26 @@ +.. index:: + single: isBlob (Git\Tag method) + + +Git\\Tag::isBlob +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::isBlob** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/is_tree.txt b/sources/classes/tag/is_tree.txt new file mode 100644 index 0000000000..de3d61c565 --- /dev/null +++ b/sources/classes/tag/is_tree.txt @@ -0,0 +1,26 @@ +.. index:: + single: isTree (Git\Tag method) + + +Git\\Tag::isTree +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::isTree** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/set_message.txt b/sources/classes/tag/set_message.txt new file mode 100644 index 0000000000..a825c083da --- /dev/null +++ b/sources/classes/tag/set_message.txt @@ -0,0 +1,28 @@ +.. index:: + single: setMessage (Git\Tag method) + + +Git\\Tag::setMessage +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::setMessage** (*$message*) + + +Parameters +*********************************************************** + +*message* + fill them out later + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/set_name.txt b/sources/classes/tag/set_name.txt new file mode 100644 index 0000000000..bd498fcfd7 --- /dev/null +++ b/sources/classes/tag/set_name.txt @@ -0,0 +1,28 @@ +.. index:: + single: setName (Git\Tag method) + + +Git\\Tag::setName +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::setName** (*$name*) + + +Parameters +*********************************************************** + +*name* + fill them out later + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/set_target.txt b/sources/classes/tag/set_target.txt new file mode 100644 index 0000000000..74a702ab3c --- /dev/null +++ b/sources/classes/tag/set_target.txt @@ -0,0 +1,28 @@ +.. index:: + single: setTarget (Git\Tag method) + + +Git\\Tag::setTarget +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::setTarget** (*$target*) + + +Parameters +*********************************************************** + +*target* + fill them out later + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tag/write.txt b/sources/classes/tag/write.txt new file mode 100644 index 0000000000..4b0a339d20 --- /dev/null +++ b/sources/classes/tag/write.txt @@ -0,0 +1,26 @@ +.. index:: + single: write (Git\Tag method) + + +Git\\Tag::write +=========================================================== + +Description +*********************************************************** + +public **Git\\Tag::write** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tree/__construct.txt b/sources/classes/tree/__construct.txt new file mode 100644 index 0000000000..b58bd347b1 --- /dev/null +++ b/sources/classes/tree/__construct.txt @@ -0,0 +1,28 @@ +.. index:: + single: __construct (Git\Tree method) + + +Git\\Tree::__construct +=========================================================== + +Description +*********************************************************** + +public **Git\\Tree::__construct** (Git\Repository *$repository*) + + +Parameters +*********************************************************** + +*repository* + Git\Repository Object + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tree/add.txt b/sources/classes/tree/add.txt new file mode 100644 index 0000000000..b5f3f62d83 --- /dev/null +++ b/sources/classes/tree/add.txt @@ -0,0 +1,56 @@ +.. index:: + single: add (Git\Tree method) + + +Git\\Tree::add +=========================================================== + +Description +*********************************************************** + +public **Git\\Tree::add** (string *$hash*, string *$name*, int *$mode*) + + +Parameters +*********************************************************** + +*hash* + specified object id. + +*name* + file name. + +*mode* + file attribute. + + + ======== ========================== + 100644 Regular file + 100755 Regular file & executable + 120000 Symbolic link + 40000 Directory + 160000 submodule + ======== ========================== + + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + add($hash,"README",100644); + $tree_hash = $tree->write(); + +See Also +*********************************************************** + +:doc:`Git\\Tree ` \ No newline at end of file diff --git a/sources/classes/tree/count.txt b/sources/classes/tree/count.txt new file mode 100644 index 0000000000..d74ecc074f --- /dev/null +++ b/sources/classes/tree/count.txt @@ -0,0 +1,39 @@ +.. index:: + single: count (Git\Tree method) + + +Git\\Tree::count +=========================================================== + +Countable interface. + +Description +*********************************************************** + +public **Git\\Tree::count** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +int count. + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $tree = $repository->getTree($refs->getId()); + echo count($tree); // or echo $tree->count(); + +See Also +*********************************************************** + +`Countable Interface `_ (PHP Documents) \ No newline at end of file diff --git a/sources/classes/tree/get_entries.txt b/sources/classes/tree/get_entries.txt new file mode 100644 index 0000000000..a21b37f1fb --- /dev/null +++ b/sources/classes/tree/get_entries.txt @@ -0,0 +1,35 @@ +.. index:: + single: getEntries (Git\Tree method) + + +Git\\Tree::getEntries +=========================================================== + +returns tree entry array. + +Description +*********************************************************** + +public **Git\\Tree::getEntries** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +array Git\Tree\Entry + +Examples +*********************************************************** + +.. code-block::php + + getTree($repo->getCommit($repo->lookupRef("refs/heads/master"))); + $result = $tree->getEntries(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tree/get_entry.txt b/sources/classes/tree/get_entry.txt new file mode 100644 index 0000000000..cc88680512 --- /dev/null +++ b/sources/classes/tree/get_entry.txt @@ -0,0 +1,39 @@ +.. index:: + single: getEntry (Git\Tree method) + + +Git\\Tree::getEntry +=========================================================== + +returns specified tree entry. + +Description +*********************************************************** + +public **Git\\Tree::getEntry** (int *$offset* = 0) + + +Parameters +*********************************************************** + +*offset* + tree entry offset + + +Return Values +*********************************************************** + +Git\Tree\Entry + +Examples +*********************************************************** + +.. code-block::php + + getTree($repo->getCommit($repo->lookupRef("refs/heads/master"))); + $result = $tree->getEntry(0); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tree/get_id.txt b/sources/classes/tree/get_id.txt new file mode 100644 index 0000000000..df86c57564 --- /dev/null +++ b/sources/classes/tree/get_id.txt @@ -0,0 +1,37 @@ +.. index:: + single: getId (Git\Tree method) + + +Git\\Tree::getId +=========================================================== + +returns tree hash id. + +Description +*********************************************************** + +public **Git\\Tree::getId** () + + +Parameters +*********************************************************** + + +Return Values +*********************************************************** + +string hash id + +Examples +*********************************************************** + +.. code-block:: php + + lookupRef("refs/heads/master"); + $tree = $repository->getTree($refs->getId()); + echo $tree->getId(); + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tree/get_iterator.txt b/sources/classes/tree/get_iterator.txt new file mode 100644 index 0000000000..e09526cfa6 --- /dev/null +++ b/sources/classes/tree/get_iterator.txt @@ -0,0 +1,35 @@ +.. index:: + single: getIterator (Git\Tree method) + + +Git\\Tree::getIterator +=========================================================== + +IteratorAggregate interface. + +Description +*********************************************************** + +public **Git\\Tree::getIterator** () + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block::php + + getCommit($repo->lookupRef("refs/heads/master")->getId()); + $tree = $commit->getTree(); + foreach($tree->getIterator() as $entry){ + // something... + } + +See Also +*********************************************************** \ No newline at end of file diff --git a/sources/classes/tree/get_type.txt b/sources/classes/tree/get_type.txt new file mode 100644 index 0000000000..c824fc429b --- /dev/null +++ b/sources/classes/tree/get_type.txt @@ -0,0 +1,29 @@ +.. index:: + single: getType (Git\Tree method) + + +Git\\Tree::getType +=========================================================== + +inherits Git\\Object. + +Description +*********************************************************** + +public **Git\\Tree::getType** () + + +Parameters +*********************************************************** + +Return Values +*********************************************************** + +Examples +*********************************************************** + +See Also +*********************************************************** + + +:doc:`Git\\Object::getType ` \ No newline at end of file diff --git a/sources/classes/tree/index.txt b/sources/classes/tree/index.txt new file mode 100644 index 0000000000..eeaae305aa --- /dev/null +++ b/sources/classes/tree/index.txt @@ -0,0 +1,10 @@ +Git\\Tree +=========================== + +Git\\Tree extends Git\\Object + +.. toctree:: + :maxdepth: 1 + :glob: + + * diff --git a/sources/classes/tree/path.txt b/sources/classes/tree/path.txt new file mode 100644 index 0000000000..33514f1fed --- /dev/null +++ b/sources/classes/tree/path.txt @@ -0,0 +1,46 @@ +.. index:: + single: path (Git\Tree method) + + +Git\\Tree::path +=========================================================== + +returns specified Git\Tree\Entry. + +Description +*********************************************************** + +public **Git\\Tree::path** (*$path*) + + +Parameters +*********************************************************** + +*path* + file name + + +Return Values +*********************************************************** + +:doc:`Git\\Tree\Entry ` + +Examples +*********************************************************** + +.. code-block:: php + + getTree("cd584aba22827a6a59cad3ab1b4e026418558bfb"); + $entry = $tree->path("README.md"); + + +.. note:: + + this method can't resolve recursive yet. + +See Also +*********************************************************** + +:doc:`Git\\Tree\\Entry ` \ No newline at end of file diff --git a/sources/classes/tree/remove.txt b/sources/classes/tree/remove.txt new file mode 100644 index 0000000000..a0ad0e3ec7 --- /dev/null +++ b/sources/classes/tree/remove.txt @@ -0,0 +1,40 @@ +.. index:: + single: remove (Git\Tree method) + + +Git\\Tree::remove +=========================================================== + +Description +*********************************************************** + +public **Git\\Tree::remove** (string *$name*) + + +Parameters +*********************************************************** + +*name* + specified file name + +Return Values +*********************************************************** + +void + +Examples +*********************************************************** + +.. code-block:: php + + remove("README"); + $tree_hash = $tree->write(); + +See Also +*********************************************************** + +:doc:`Git\\Tree ` \ No newline at end of file diff --git a/sources/classes/tree/write.txt b/sources/classes/tree/write.txt new file mode 100644 index 0000000000..581e1626e2 --- /dev/null +++ b/sources/classes/tree/write.txt @@ -0,0 +1,37 @@ +.. index:: + single: write (Git\Tree method) + + +Git\\Tree::write +=========================================================== + +Description +*********************************************************** + +public **Git\\Tree::write** () + + +Parameters +*********************************************************** + + + +Return Values +*********************************************************** + +Examples +*********************************************************** + +.. code-block:: php + + add($hash,"README",100644); + $tree_hash = $tree->write(); + +See Also +*********************************************************** + +:doc:`Git\\Object::write ` \ No newline at end of file diff --git a/sources/constants.txt b/sources/constants.txt new file mode 100644 index 0000000000..b113650743 --- /dev/null +++ b/sources/constants.txt @@ -0,0 +1,18 @@ +Predefined Constants +================================================== + + +=========================== =============== +Key Value +=========================== =============== +Git\\Revwalk\\SORT_NONE 0 +Git\\Revwalk\\SORT_TOPO 1 +Git\\Revwalk\\SORT_DATE 2 +Git\\Revwalk\\SORT_REVERSE 4 +Git\\Object\\Any GIT_OBJ_ANY +Git\\Object\\Bad GIT_OBJ_BAD +Git\\Object\\Commit GIT_OBJ_COMMIT +Git\\Object\\Tree Git_OBJ_TREE +Git\\Object\\Blob Git_OBJ_BLOB +Git\\Object\\TAG Git_OBJ_TAG +=========================== =============== diff --git a/sources/examples.txt b/sources/examples.txt new file mode 100644 index 0000000000..ab5e9b3060 --- /dev/null +++ b/sources/examples.txt @@ -0,0 +1,131 @@ +Examples +================================================== + +php-git examples.these example uses experimental API. + +Create new blob +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: php + + setContent("First Object1"); + $blobHash = $blob->write(); + +:doc:`Git\Blob::setContent ` + +.. note:: + maybe this API will change next release. + +Create new Tree +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: php + + add($hash,"README",100644); + $tree_hash = $tree->write(); + +:doc:`Git\Tree::add ` + +.. note:: + maybe this API will change next release. + + +Create new Commit +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: php + + add($hash,"README",100644); + $tree_hash = $tree->write(); + $commit = new Git\Commit($repository); + $commit->setAuthor(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))); + $commit->setCommitter(new Git\Signature("Someone","someone@example.com", new DateTime("2011-01-01 00:00:00",new DateTimezone("Asia/Tokyo")))); + $commit->setTree($tree->getId()); + // when first commit. you dont call setParent. + //$commit->setParent($last_commit->getParent()->getId()); + $commit->setMessage("initial import"); + + $master_hash = $commit->write(); + +:doc:`Git\Tree::add ` +:doc:`Git\Commit::setAuthor ` +:doc:`Git\Commit::setCommitter ` +:doc:`Git\Commit::setTree ` +:doc:`Git\Commit::setParent ` +:doc:`Git\Commit::setMessage ` + +.. note:: + php-git can't manage multiple parents now. this will fix next release. + +get master tree +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: php + + getCommit($repository->lookupRef("refs/heads/master")); + $tree = $master_commit->getTree(); + // or $tree->getEntries() + foreach($tree->getIterator() as $entry){ + var_dump($entry); + } + +revision walking +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. code-block:: php + + getCommit($repository->lookupRef("refs/heads/master")); + $walker = $master_commit->getWalker(); + $walker->push($master_commit->getId()); + while($commit = $walker->next()){ + var_dump($commit); + } + +custom backends +++++++++++++++++++++++++++++++++++++++++++++++++++ + +see also :doc:`Git\\Repository\\addBackend ` + + +get available references +++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. note:: + maybe this API will change next release. + +.. code-block:: php + + getList(); + +:doc:`Git\\Reference\\Manager ` + + +this method gets available all references.if you want gets available branches.you have to check manualy now. + +.. code-block:: php + + getList() as $ref){ + if(strpos($ref->name,"refs/heads")){ + $brandhes[] $ref; + } + } diff --git a/sources/index.txt b/sources/index.txt new file mode 100644 index 0000000000..5f38db3856 --- /dev/null +++ b/sources/index.txt @@ -0,0 +1,29 @@ +.. php-git documentation master file, created by + sphinx-quickstart on Mon Jan 10 14:18:21 2011. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to php-git's documentation! +=================================== + +php-git is a set of PHP 5.3+ bindings to the libgit2 linkable C Git library. +*Important Notice* this module is EXPERIMENTAL. + +Contents: + +.. toctree:: + :maxdepth: 2 + :glob: + + intro + setup + constants + examples + classes/*/index + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` + diff --git a/sources/ini.txt b/sources/ini.txt new file mode 100644 index 0000000000..bd9c7ae300 --- /dev/null +++ b/sources/ini.txt @@ -0,0 +1,4 @@ +Runtime Configuration +================================================== + +nothing. diff --git a/sources/installation.txt b/sources/installation.txt new file mode 100644 index 0000000000..cff0d07414 --- /dev/null +++ b/sources/installation.txt @@ -0,0 +1,24 @@ +Installation +================================================== + +.. code-block:: bash + + cd /tmp + git clone https://github.com/libgit2/libgit2 libgit2 + git clone https://github.com/libgit2/php-git php-git + cd libgit2 + git checkout `cat ../php-git/LIBGIT2_VERSION` + ./waf configure + ./waf build-shared + sudo ./waf install-shared + + cd ../php-git/src + phpize + ./configure && make + sudo make install + # add your php.ini + # extension=git.so + +.. note:: + php-git still under development status. + should not use production environment. \ No newline at end of file diff --git a/sources/intro.txt b/sources/intro.txt new file mode 100644 index 0000000000..38266b261f --- /dev/null +++ b/sources/intro.txt @@ -0,0 +1,6 @@ +Introduction +================================================== + +Git module provides handy procedural and object oriented interface to libgit2. + +More information about libgit2 can be found at https://github.com/libgit2/libgit2 diff --git a/sources/requirements.txt b/sources/requirements.txt new file mode 100644 index 0000000000..2800ddd9da --- /dev/null +++ b/sources/requirements.txt @@ -0,0 +1,7 @@ +Requirements +================================================== + +- `libgit2 `_ +- php5.3 higher +- php-devel +- pcre-devel diff --git a/sources/resources.txt b/sources/resources.txt new file mode 100644 index 0000000000..58b707d4de --- /dev/null +++ b/sources/resources.txt @@ -0,0 +1,4 @@ +Resources +================================================== + +nothing diff --git a/sources/setup.txt b/sources/setup.txt new file mode 100644 index 0000000000..b92277ba65 --- /dev/null +++ b/sources/setup.txt @@ -0,0 +1,12 @@ +Installing/Configuring +================================================== + +Table of Contents: + +.. toctree:: + :maxdepth: 2 + + requirements + installation + ini + resources diff --git a/stash.c b/stash.c deleted file mode 100644 index 1a9832a8b2..0000000000 --- a/stash.c +++ /dev/null @@ -1,107 +0,0 @@ -#include "php_git2.h" -#include "php_git2_priv.h" -#include "stash.h" - -static int php_git2_stash_cb(size_t index, - const char* message, - const git_oid *stash_id, - void *payload) -{ - zval *param_index, *param_message,*param_stash_id, *retval_ptr = NULL; - php_git2_cb_t *p = (php_git2_cb_t*)payload; - long retval = 0; - char _oid[GIT2_OID_HEXSIZE] = {0}; - GIT2_TSRMLS_SET(p->tsrm_ls) - - git_oid_fmt(_oid, stash_id); - - Z_ADDREF_P(p->payload); - MAKE_STD_ZVAL(param_index); - MAKE_STD_ZVAL(param_message); - MAKE_STD_ZVAL(param_stash_id); - ZVAL_LONG(param_index, index); - ZVAL_STRING(param_message, message, 1); - ZVAL_STRING(param_stash_id, _oid, 1); - - if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 4, ¶m_index, ¶m_message, ¶m_stash_id, &p->payload)) { - return GIT_EUSER; - } - - retval = Z_LVAL_P(retval_ptr); - zval_ptr_dtor(&retval_ptr); - return retval; -} - -/* {{{ proto resource git_stash_save(resource $repo, array $stasher, string $message, long $flags) - */ -PHP_FUNCTION(git_stash_save) -{ - php_git2_t *_repo = NULL; - git_oid out = {0}; - zval *repo = NULL, *stasher = NULL; - char *message = NULL; - int message_len = 0, error = 0; - long flags = 0; - char buf[GIT2_OID_HEXSIZE] = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rasl", &repo, &stasher, &message, &message_len, &flags) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - error = git_stash_save(&out, PHP_GIT2_V(_repo, repository), stasher, message, flags); - if (php_git2_check_error(error, "git_stash_save" TSRMLS_CC)) { - RETURN_FALSE; - } - git_oid_fmt(buf, &out); - RETURN_STRING(buf, 1); -} -/* }}} */ - -/* {{{ proto long git_stash_foreach(resource $repo, Callable $callback, $payload) - */ -PHP_FUNCTION(git_stash_foreach) -{ - int result = 0; - zval *repo = NULL, *payload = NULL; - php_git2_t *_repo = NULL; - zend_fcall_info fci = empty_fcall_info; - zend_fcall_info_cache fcc = empty_fcall_info_cache; - php_git2_cb_t *cb = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rfz", &repo, &fci, &fcc, &payload) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { - RETURN_FALSE; - } - result = git_stash_foreach(PHP_GIT2_V(_repo, repository), php_git2_stash_cb, cb); - php_git2_cb_free(cb); - RETURN_LONG(result); -} -/* }}} */ - -/* {{{ proto long git_stash_drop(resource $repo, long $index) - */ -PHP_FUNCTION(git_stash_drop) -{ - int result = 0; - zval *repo = NULL; - php_git2_t *_repo = NULL; - long index = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rl", &repo, &index) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_stash_drop(PHP_GIT2_V(_repo, repository), index); - RETURN_LONG(result); -} -/* }}} */ - diff --git a/stash.h b/stash.h deleted file mode 100644 index 5640514b0c..0000000000 --- a/stash.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * PHP Libgit2 Extension - * - * https://github.com/libgit2/php-git - * - * Copyright 2014 Shuhei Tanuma. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef PHP_GIT2_STASH_H -#define PHP_GIT2_STASH_H - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_stash_save, 0, 0, 4) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, stasher) - ZEND_ARG_INFO(0, message) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_stash_foreach, 0, 0, 3) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(1, payload) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_git_stash_drop, 0, 0, 2) - ZEND_ARG_INFO(0, repo) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -/* {{{ proto resource git_stash_save(repo, stasher, message, flags) -*/ -PHP_FUNCTION(git_stash_save); - -/* {{{ proto long git_stash_foreach(repo, callback, payload) -*/ -PHP_FUNCTION(git_stash_foreach); - -/* {{{ proto long git_stash_drop(repo, index) -*/ -PHP_FUNCTION(git_stash_drop); - -#endif \ No newline at end of file diff --git a/static/ajax-loader.gif b/static/ajax-loader.gif new file mode 100644 index 0000000000..61faf8cab2 Binary files /dev/null and b/static/ajax-loader.gif differ diff --git a/static/basic.css b/static/basic.css new file mode 100644 index 0000000000..4b875f8e00 --- /dev/null +++ b/static/basic.css @@ -0,0 +1,528 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +img { + border: 0; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable dl, table.indextable dd { + margin-top: 0; + margin-bottom: 0; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- general body styles --------------------------------------------------- */ + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.field-list ul { + padding-left: 1em; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + clear: both; + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.field-list td, table.field-list th { + border: 0 !important; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.refcount { + color: #060; +} + +.optional { + font-size: 1.3em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +tt.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +tt.descclassname { + background-color: transparent; +} + +tt.xref, a tt { + background-color: transparent; + font-weight: bold; +} + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/static/comment-bright.png b/static/comment-bright.png new file mode 100644 index 0000000000..551517b8c8 Binary files /dev/null and b/static/comment-bright.png differ diff --git a/static/comment-close.png b/static/comment-close.png new file mode 100644 index 0000000000..09b54be46d Binary files /dev/null and b/static/comment-close.png differ diff --git a/static/comment.png b/static/comment.png new file mode 100644 index 0000000000..92feb52b88 Binary files /dev/null and b/static/comment.png differ diff --git a/static/contents.png b/static/contents.png new file mode 100644 index 0000000000..7fb82154a1 Binary files /dev/null and b/static/contents.png differ diff --git a/static/doctools.js b/static/doctools.js new file mode 100644 index 0000000000..8b9bd2c0e9 --- /dev/null +++ b/static/doctools.js @@ -0,0 +1,247 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilties for all documentation. + * + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +} + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s == 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * small function to check if an array contains + * a given item. + */ +jQuery.contains = function(arr, item) { + for (var i = 0; i < arr.length; i++) { + if (arr[i] == item) + return true; + } + return false; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node) { + if (node.nodeType == 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); +}; + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated == 'undefined') + return string; + return (typeof translated == 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated == 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash && $.browser.mozilla) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('.sidebar .this-page-menu')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); diff --git a/static/down-pressed.png b/static/down-pressed.png new file mode 100644 index 0000000000..6f7ad78278 Binary files /dev/null and b/static/down-pressed.png differ diff --git a/static/down.png b/static/down.png new file mode 100644 index 0000000000..3003a88770 Binary files /dev/null and b/static/down.png differ diff --git a/static/file.png b/static/file.png new file mode 100644 index 0000000000..d18082e397 Binary files /dev/null and b/static/file.png differ diff --git a/static/jquery.js b/static/jquery.js new file mode 100644 index 0000000000..7c24308023 --- /dev/null +++ b/static/jquery.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/static/minus.png b/static/minus.png new file mode 100644 index 0000000000..da1c5620d1 Binary files /dev/null and b/static/minus.png differ diff --git a/static/navigation.png b/static/navigation.png new file mode 100644 index 0000000000..1081dc1439 Binary files /dev/null and b/static/navigation.png differ diff --git a/static/plus.png b/static/plus.png new file mode 100644 index 0000000000..b3cb37425e Binary files /dev/null and b/static/plus.png differ diff --git a/static/pygments.css b/static/pygments.css new file mode 100644 index 0000000000..1a14f2ae1a --- /dev/null +++ b/static/pygments.css @@ -0,0 +1,62 @@ +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #303030 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0040D0 } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .na { color: #4070a0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60add5 } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287e } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #bb60d5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070a0 } /* Literal.String.Char */ +.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ +.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #c65d09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ +.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ +.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/static/searchtools.js b/static/searchtools.js new file mode 100644 index 0000000000..26f8fada09 --- /dev/null +++ b/static/searchtools.js @@ -0,0 +1,556 @@ +/* + * searchtools.js_t + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilties for the full-text search. + * + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words, hlwords is the list of normal, unstemmed + * words. the first one is used to find the occurance, the + * latter for highlighting it. + */ + +jQuery.makeSearchSummary = function(text, keywords, hlwords) { + var textLower = text.toLowerCase(); + var start = 0; + $.each(keywords, function() { + var i = textLower.indexOf(this.toLowerCase()); + if (i > -1) + start = i; + }); + start = Math.max(start - 120, 0); + var excerpt = ((start > 0) ? '...' : '') + + $.trim(text.substr(start, 240)) + + ((start + 240 - text.length) ? '...' : ''); + var rv = $('
').text(excerpt); + $.each(hlwords, function() { + rv = rv.highlightText(this, 'highlighted'); + }); + return rv; +} + + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + + +/** + * Search Module + */ +var Search = { + + _index : null, + _queued_query : null, + _pulse_status : -1, + + init : function() { + var params = $.getQueryParameters(); + if (params.q) { + var query = params.q[0]; + $('input[name="q"]')[0].value = query; + this.performSearch(query); + } + }, + + loadIndex : function(url) { + $.ajax({type: "GET", url: url, data: null, success: null, + dataType: "script", cache: true}); + }, + + setIndex : function(index) { + var q; + this._index = index; + if ((q = this._queued_query) !== null) { + this._queued_query = null; + Search.query(q); + } + }, + + hasIndex : function() { + return this._index !== null; + }, + + deferQuery : function(query) { + this._queued_query = query; + }, + + stopPulse : function() { + this._pulse_status = 0; + }, + + startPulse : function() { + if (this._pulse_status >= 0) + return; + function pulse() { + Search._pulse_status = (Search._pulse_status + 1) % 4; + var dotString = ''; + for (var i = 0; i < Search._pulse_status; i++) + dotString += '.'; + Search.dots.text(dotString); + if (Search._pulse_status > -1) + window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something + */ + performSearch : function(query) { + // create the required interface elements + this.out = $('#search-results'); + this.title = $('

' + _('Searching') + '

').appendTo(this.out); + this.dots = $('').appendTo(this.title); + this.status = $('

').appendTo(this.out); + this.output = $('