Closed asgrim closed 13 years ago
I have made a fix for this but not made a pull request yet as I'm not sure whether force should be 1 or 0 yet. on a branch: https://github.com/Asgrim/php-git/tree/fix-git_reference_create_oid-signature-bug
Commit: Asgrim/php-git@9528478a1130b537f51f30b1ae482cecf5a39f78
Hi James, thank you for suggesting me.
when it specified 0, git_reference_create_oid will return some sort of error when specified reference has already registered. otherwise, force create a reference.
so, we should change that signature like following sample.
ZEND_BEGIN_ARG_INFO_EX(arginfo_git_reference_manager_create, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, oid)
ZEND_ARG_INFO(0, force)
ZEND_END_ARG_INFO()
PHP_METHOD(git_reference_manager, create)
{
php_git_reference_manager_t *this = (php_git_reference_manager_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
char *name;
int name_len = 0;
char *oid;
int oid_len = 0;
git_oid id;
int force = 0;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"ssl", &name, &name_len, &oid, &oid_len, &force) == FAILURE){
return;
}
//...
anyway, i'll look for your commit and libgit2 changes when i came back home (AM8 in Japan, right now). please send pull request me.
thanks, Shuhei
Pull request made in #12 !
I tried to compile php-git with latest git clone of libgit2, and it worked except for:
/home/james/workspace/php-git/src/reference_manager.c:246: error: too few arguments to function ‘git_reference_create_oid’
I had a quick dig around and it turns out in libgit2 a parameter has been added.
This seemed to work and I got the php-git-sample app working - however I'm not experienced enough to know whether this "force" value should be 1 or 0...