Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported library to libgit 0.19 #53

Merged
merged 2 commits into from
Jan 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tests/*.log
tests/*.diff
tests/*.exp
tests/*.out
tests/mock

# ignore phpized files
Makefile.global
Expand Down
2 changes: 1 addition & 1 deletion config.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ PHP_METHOD(git2_config, delete)
}

m_config = PHP_GIT2_GET_OBJECT(php_git2_config, getThis());
git_config_delete(m_config->config, key);
git_config_delete_entry(m_config->config, key);
php_git2_config_reload(getThis(), 0 TSRMLS_CC);
}
/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion libgit2
Submodule libgit2 updated 1345 files
1 change: 1 addition & 0 deletions php_git2.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# include <git2.h>
# include <git2/errors.h>
# include <git2/odb_backend.h>
# include <git2/sys/odb_backend.h>

extern zend_module_entry git2_module_entry;

Expand Down
19 changes: 9 additions & 10 deletions reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,17 @@ PHP_METHOD(git2_reference, lookup)
PHP_METHOD(git2_reference, getTarget)
{
php_git2_reference *m_reference;

const git_oid *oid;
char oid_out[GIT_OID_HEXSZ] = {0};

m_reference = PHP_GIT2_GET_OBJECT(php_git2_reference, getThis());

if (git_reference_type(m_reference->reference) == GIT_REF_OID) {
const git_oid *oid;
char oid_out[GIT_OID_HEXSZ] = {0};

oid = git_reference_oid(m_reference->reference);
oid = git_reference_target(m_reference->reference);
git_oid_fmt(oid_out, oid);
RETVAL_STRINGL(oid_out,GIT_OID_HEXSZ,1);
} else {
RETVAL_STRING(git_reference_target(m_reference->reference),1);
RETVAL_STRING(git_reference_symbolic_target(m_reference->reference), 1);
}
}
/* }}} */
Expand Down Expand Up @@ -192,9 +191,9 @@ PHP_METHOD(git2_reference, create)
m_repository = PHP_GIT2_GET_OBJECT(php_git2_repository, repository);

if (git_oid_fromstr(&oid, target) == GIT_OK) {
error = git_reference_create_oid(&ref, m_repository->repository, name, &oid, (int)force);
error = git_reference_create(&ref, m_repository->repository, name, &oid, (int)force);
} else {
error = git_reference_create_symbolic(&ref, m_repository->repository, name, target, (int)force);
error = git_reference_symbolic_create(&ref, m_repository->repository, name, target, (int)force);
}

if (error != GIT_OK) {
Expand Down Expand Up @@ -303,7 +302,7 @@ PHP_METHOD(git2_reference, each)
MAKE_STD_ZVAL(opaque.result);
array_init(opaque.result);

git_reference_foreach(m_repository->repository, list_flags, &php_git2_ref_foreach_cb, (void *)&opaque);
git_reference_foreach(m_repository->repository, &php_git2_ref_foreach_cb, (void *)&opaque);

RETVAL_ZVAL(opaque.result,0,1);
}
Expand Down
20 changes: 10 additions & 10 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PHP_METHOD(git2_remote, __construct)
/* }}} */


static int php_git2_rename_packfile(char *packname, git_indexer *idx)
static int php_git2_rename_packfile(char *packname, git_indexer_stream *idx)
{
char path[GIT_PATH_MAX], oid[GIT_OID_HEXSZ + 1], *slash;
int ret;
Expand All @@ -101,7 +101,7 @@ static int php_git2_rename_packfile(char *packname, git_indexer *idx)
}

memset(oid, 0x0, sizeof(oid));
git_oid_fmt(oid, git_indexer_hash(idx));
git_oid_fmt(oid, git_indexer_stream_hash(idx));
ret = sprintf(slash + 1, "pack-%s.pack", oid);
if(ret < 0) {
return -2;
Expand All @@ -124,7 +124,7 @@ static int show_ref__cb(git_remote_head *head, void *payload)
PHP_METHOD(git2_remote, fetch)
{
php_git2_remote *m_remote;
git_indexer *idx = NULL;
git_indexer_stream *idx = NULL;
git_transfer_progress stats;
char *packname = NULL;
int error = 0;
Expand All @@ -138,31 +138,31 @@ PHP_METHOD(git2_remote, fetch)
return;
}
*/
direction = GIT_DIR_FETCH;
direction = GIT_DIRECTION_FETCH;

error = git_remote_connect(m_remote->remote, direction);
error = git_remote_ls(m_remote->remote, &show_ref__cb, NULL);
//error = git_remote_download(&packname, m_remote->remote);

if (packname != NULL) {
/*if (packname != NULL) {
// Create a new instance indexer
error = git_indexer_new(&idx, packname);
error = git_indexer_stream_new(&idx, packname);
PHP_GIT2_EXCEPTION_CHECK(error);

error = git_indexer_run(idx, &stats);
error = git_indexer_stream_run(idx, &stats);
PHP_GIT2_EXCEPTION_CHECK(error);

error = git_indexer_write(idx);
error = git_indexer_stream_write(idx);
PHP_GIT2_EXCEPTION_CHECK(error);

error = php_git2_rename_packfile(packname, idx);
PHP_GIT2_EXCEPTION_CHECK(error);
}
}*/

//error = git_remote_update_tips(m_remote->remote);
PHP_GIT2_EXCEPTION_CHECK(error);

free(packname);
//free(packname);
git_indexer_free(idx);
}
/* }}} */
Expand Down