Skip to content

Commit 6cf41b0

Browse files
committed
Merge pull request #53 from christopherobin/feature/v0.19.0
Ported library to libgit 0.19
2 parents ace0257 + 1c691c4 commit 6cf41b0

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ tests/*.log
1010
tests/*.diff
1111
tests/*.exp
1212
tests/*.out
13+
tests/mock
1314

1415
# ignore phpized files
1516
Makefile.global

config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ PHP_METHOD(git2_config, delete)
430430
}
431431

432432
m_config = PHP_GIT2_GET_OBJECT(php_git2_config, getThis());
433-
git_config_delete(m_config->config, key);
433+
git_config_delete_entry(m_config->config, key);
434434
php_git2_config_reload(getThis(), 0 TSRMLS_CC);
435435
}
436436
/* }}} */

libgit2

Submodule libgit2 updated 1345 files

php_git2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
# include <git2.h>
4242
# include <git2/errors.h>
4343
# include <git2/odb_backend.h>
44+
# include <git2/sys/odb_backend.h>
4445

4546
extern zend_module_entry git2_module_entry;
4647

reference.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,17 @@ PHP_METHOD(git2_reference, lookup)
9999
PHP_METHOD(git2_reference, getTarget)
100100
{
101101
php_git2_reference *m_reference;
102-
102+
const git_oid *oid;
103+
char oid_out[GIT_OID_HEXSZ] = {0};
104+
103105
m_reference = PHP_GIT2_GET_OBJECT(php_git2_reference, getThis());
104-
106+
105107
if (git_reference_type(m_reference->reference) == GIT_REF_OID) {
106-
const git_oid *oid;
107-
char oid_out[GIT_OID_HEXSZ] = {0};
108-
109-
oid = git_reference_oid(m_reference->reference);
108+
oid = git_reference_target(m_reference->reference);
110109
git_oid_fmt(oid_out, oid);
111110
RETVAL_STRINGL(oid_out,GIT_OID_HEXSZ,1);
112111
} else {
113-
RETVAL_STRING(git_reference_target(m_reference->reference),1);
112+
RETVAL_STRING(git_reference_symbolic_target(m_reference->reference), 1);
114113
}
115114
}
116115
/* }}} */
@@ -192,9 +191,9 @@ PHP_METHOD(git2_reference, create)
192191
m_repository = PHP_GIT2_GET_OBJECT(php_git2_repository, repository);
193192

194193
if (git_oid_fromstr(&oid, target) == GIT_OK) {
195-
error = git_reference_create_oid(&ref, m_repository->repository, name, &oid, (int)force);
194+
error = git_reference_create(&ref, m_repository->repository, name, &oid, (int)force);
196195
} else {
197-
error = git_reference_create_symbolic(&ref, m_repository->repository, name, target, (int)force);
196+
error = git_reference_symbolic_create(&ref, m_repository->repository, name, target, (int)force);
198197
}
199198

200199
if (error != GIT_OK) {
@@ -303,7 +302,7 @@ PHP_METHOD(git2_reference, each)
303302
MAKE_STD_ZVAL(opaque.result);
304303
array_init(opaque.result);
305304

306-
git_reference_foreach(m_repository->repository, list_flags, &php_git2_ref_foreach_cb, (void *)&opaque);
305+
git_reference_foreach(m_repository->repository, &php_git2_ref_foreach_cb, (void *)&opaque);
307306

308307
RETVAL_ZVAL(opaque.result,0,1);
309308
}

remote.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ PHP_METHOD(git2_remote, __construct)
8888
/* }}} */
8989

9090

91-
static int php_git2_rename_packfile(char *packname, git_indexer *idx)
91+
static int php_git2_rename_packfile(char *packname, git_indexer_stream *idx)
9292
{
9393
char path[GIT_PATH_MAX], oid[GIT_OID_HEXSZ + 1], *slash;
9494
int ret;
@@ -101,7 +101,7 @@ static int php_git2_rename_packfile(char *packname, git_indexer *idx)
101101
}
102102

103103
memset(oid, 0x0, sizeof(oid));
104-
git_oid_fmt(oid, git_indexer_hash(idx));
104+
git_oid_fmt(oid, git_indexer_stream_hash(idx));
105105
ret = sprintf(slash + 1, "pack-%s.pack", oid);
106106
if(ret < 0) {
107107
return -2;
@@ -124,7 +124,7 @@ static int show_ref__cb(git_remote_head *head, void *payload)
124124
PHP_METHOD(git2_remote, fetch)
125125
{
126126
php_git2_remote *m_remote;
127-
git_indexer *idx = NULL;
127+
git_indexer_stream *idx = NULL;
128128
git_transfer_progress stats;
129129
char *packname = NULL;
130130
int error = 0;
@@ -138,31 +138,31 @@ PHP_METHOD(git2_remote, fetch)
138138
return;
139139
}
140140
*/
141-
direction = GIT_DIR_FETCH;
141+
direction = GIT_DIRECTION_FETCH;
142142

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

147-
if (packname != NULL) {
147+
/*if (packname != NULL) {
148148
// Create a new instance indexer
149-
error = git_indexer_new(&idx, packname);
149+
error = git_indexer_stream_new(&idx, packname);
150150
PHP_GIT2_EXCEPTION_CHECK(error);
151151
152-
error = git_indexer_run(idx, &stats);
152+
error = git_indexer_stream_run(idx, &stats);
153153
PHP_GIT2_EXCEPTION_CHECK(error);
154154
155-
error = git_indexer_write(idx);
155+
error = git_indexer_stream_write(idx);
156156
PHP_GIT2_EXCEPTION_CHECK(error);
157157
158158
error = php_git2_rename_packfile(packname, idx);
159159
PHP_GIT2_EXCEPTION_CHECK(error);
160-
}
160+
}*/
161161

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

165-
free(packname);
165+
//free(packname);
166166
git_indexer_free(idx);
167167
}
168168
/* }}} */

0 commit comments

Comments
 (0)