From 80d3cffbef12b8d4fe6ecb0310bc20598a368cea Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Thu, 16 Jan 2014 02:59:06 +0900 Subject: [PATCH 01/13] add note for latest branch --- README.md | 7 ++++++- libgit2 | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b970b5e071..3ae801928d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ # PHP-Git2 - libgit2 bindings in PHP -php-git2 is a PHP bindings to the libgit2 linkable C Git library. +php-git2 is a PHP bindings to the libgit2 linkable C Git library. this extension are re-writing php-git as that code too dirty. +# Latest Branch + +v0.3.0 (switching to functions) +https://github.com/libgit2/php-git/tree/functions + # Important Notice php-git changed it's API drastically. this changes doesn't care about compatibility between old one. diff --git a/libgit2 b/libgit2 index eddc1f1ed7..43cb8b3242 160000 --- a/libgit2 +++ b/libgit2 @@ -1 +1 @@ -Subproject commit eddc1f1ed78898a4ca41480045b1d0d5b075e773 +Subproject commit 43cb8b32428b1b29994874349ec22eb5372e152c From 5d3a8cd80bc34561bd681f2b46690e9fff583d8f Mon Sep 17 00:00:00 2001 From: Gerry Date: Wed, 22 Jan 2014 01:13:20 +0800 Subject: [PATCH 02/13] Add missing part in path Git clone creates a directory named after the project you are cloning. The initial step to change directory assumed we were already in the cloned directory, which would not be the case if you had just run the command above it. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ae801928d..76f30050b6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ you need to install libgit2 before make php-git. ```` git clone https://github.com/libgit2/php-git.git --recursive -cd libgit2 +cd php-git/libgit2 mkdir build && cd build cmake .. cmake -DBUILD_SHARED_LIBS=OFF -build . From 04e41d08567df0234f5b5139d2db3dee5b404ae2 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Wed, 19 Feb 2014 01:44:00 +0900 Subject: [PATCH 03/13] add requirements --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e1f19a6717..2e9395d73f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ 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) From 96e71175c3d5b040c9946cc6618a2ac47e6fd078 Mon Sep 17 00:00:00 2001 From: "Gary A. Mort" Date: Fri, 21 Feb 2014 15:45:24 -0500 Subject: [PATCH 04/13] Fix for unknown symbol convert_to_bool when running under Ubuntu Raring, PHP 5.4.9 --- g_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g_config.c b/g_config.c index 29fdcf8a8a..cb15c30ad5 100644 --- a/g_config.c +++ b/g_config.c @@ -119,7 +119,7 @@ static void php_git2_config_set_with(INTERNAL_FUNCTION_PARAMETERS, enum php_git2 } case PHP_GIT2_CONFIG_BOOL: { if (Z_TYPE_P(value) != IS_BOOL) { - convert_to_bool(value); + 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)) { From 5ce464e8183bb48f3f417d2a2d87f8bde865aebe Mon Sep 17 00:00:00 2001 From: "Gary A. Mort" Date: Fri, 21 Feb 2014 15:51:01 -0500 Subject: [PATCH 05/13] Fix for php_git2_diff_delta_to_array --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 68002ec878..7acd39a64c 100644 --- a/diff.c +++ b/diff.c @@ -288,7 +288,7 @@ PHP_FUNCTION(git_diff_get_delta) 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_git_diff_delta_to_array(result, &_result TSRMLS_CC); + php_git2_diff_delta_to_array(result, &_result TSRMLS_CC); RETURN_ZVAL(_result, 0, 1); } /* }}} */ From 20b6bef24896b1946b8359106c7d028cc855342f Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Tue, 4 Mar 2014 12:09:53 +0900 Subject: [PATCH 06/13] add stub file --- ref.php | 19 ++ stubs/git2.php | 549 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 568 insertions(+) create mode 100644 ref.php create mode 100644 stubs/git2.php diff --git a/ref.php b/ref.php new file mode 100644 index 0000000000..0235eeea8d --- /dev/null +++ b/ref.php @@ -0,0 +1,19 @@ +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/stubs/git2.php b/stubs/git2.php new file mode 100644 index 0000000000..7b1229e428 --- /dev/null +++ b/stubs/git2.php @@ -0,0 +1,549 @@ + Date: Mon, 14 Apr 2014 17:41:06 +0200 Subject: [PATCH 07/13] Adding missing & --- status.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/status.c b/status.c index 4f9c9670da..072d713895 100644 --- a/status.c +++ b/status.c @@ -152,7 +152,7 @@ PHP_FUNCTION(git_status_file) } ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); - result = git_status_file(status_flags, PHP_GIT2_V(_repo, repository), path); + result = git_status_file(&status_flags, PHP_GIT2_V(_repo, repository), path); RETURN_LONG(result); } /* }}} */ @@ -280,4 +280,4 @@ PHP_FUNCTION(git_status_options_new) php_git2_git_status_options_to_array(&options, &result TSRMLS_CC); RETURN_ZVAL(result, 0, 1); -} \ No newline at end of file +} From 2c4cce504ef10419a4ff241bdff931dad870d1f3 Mon Sep 17 00:00:00 2001 From: Philippe Gaultier Date: Mon, 14 Apr 2014 22:13:35 +0200 Subject: [PATCH 08/13] Allow clone options bare and ignore_cert --- clone.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/clone.c b/clone.c index 6bd6337883..095aa5dc38 100644 --- a/clone.c +++ b/clone.c @@ -2,25 +2,50 @@ #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 *options;// = GIT_OPTIONS_INIT; + 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, &options) == FAILURE) { + "ss|a", &url, &url_len, &localpath, &localpath_len, &opts) == FAILURE) { return; } /* TODO(chobie): convert options to git_clone_options */ - error = git_clone(&repository, url, localpath, NULL); + 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 } From 9e707b4797c13399de760e191975598e3209ade0 Mon Sep 17 00:00:00 2001 From: Gary Mort Date: Mon, 12 May 2014 21:17:25 -0400 Subject: [PATCH 09/13] Modified README for 64bit compile instructions --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e9395d73f..175ec8fcc2 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,22 @@ https://docs.google.com/spreadsheet/ccc?key=0AjvShWAWqvfHdDRneEtIUF9GRUZMNVVVR1h ``` # 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 @@ -115,4 +125,4 @@ document will generate later. please check source code before publish docs. ## LICENSE -MIT License \ No newline at end of file +MIT License From 6b60e8f6aa0cab3557ccef3ea96d427d79ce19f6 Mon Sep 17 00:00:00 2001 From: Gary Mort Date: Mon, 12 May 2014 21:36:57 -0400 Subject: [PATCH 10/13] Fix test for change in blob create return --- tests/blob/git_blob_create_frombuffer.phpt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/blob/git_blob_create_frombuffer.phpt diff --git a/tests/blob/git_blob_create_frombuffer.phpt b/tests/blob/git_blob_create_frombuffer.phpt new file mode 100644 index 0000000000..97cf4692bf --- /dev/null +++ b/tests/blob/git_blob_create_frombuffer.phpt @@ -0,0 +1,17 @@ +--TEST-- +Check for git_blob_create_frombuffer presence +--SKIPIF-- + +--FILE-- + Date: Wed, 14 May 2014 00:37:07 +0900 Subject: [PATCH 11/13] fix test case --- tests/blob/git_blob_create_frombuffer.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/blob/git_blob_create_frombuffer.phpt b/tests/blob/git_blob_create_frombuffer.phpt index 97cf4692bf..ff0d61ef52 100644 --- a/tests/blob/git_blob_create_frombuffer.phpt +++ b/tests/blob/git_blob_create_frombuffer.phpt @@ -5,7 +5,7 @@ Check for git_blob_create_frombuffer presence --FILE-- Date: Tue, 13 May 2014 15:06:36 -0400 Subject: [PATCH 12/13] Added testing for tree --- tests/init.php | 52 +++++++++++++++++++++++++++++++++ tests/tree/git_tree_lookup.phpt | 37 +++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 tests/init.php create mode 100644 tests/tree/git_tree_lookup.phpt diff --git a/tests/init.php b/tests/init.php new file mode 100644 index 0000000000..23a9035a7d --- /dev/null +++ b/tests/init.php @@ -0,0 +1,52 @@ + +--FILE-- + Date: Fri, 16 May 2014 01:51:49 +0900 Subject: [PATCH 13/13] add travis.yml --- .travis.yml | 26 ++++++++++++++++++++++++++ script/cibuild.sh | 13 +++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .travis.yml create mode 100755 script/cibuild.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..bfe6af5ccf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +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/script/cibuild.sh b/script/cibuild.sh new file mode 100755 index 0000000000..720213790d --- /dev/null +++ b/script/cibuild.sh @@ -0,0 +1,13 @@ +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