Skip to content

Commit 862ccea

Browse files
committed
fix test 001
1 parent 3ff92e4 commit 862ccea

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

git2_repository.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static PHP_METHOD(Repository, clone) {
147147
git2_repository_object_t *intern;
148148
git_clone_options opts_libgit2 = GIT_CLONE_OPTIONS_INIT;
149149

150-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssh", &url, &url_len, &local_path, &local_path_len, &opts) == FAILURE)
150+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|h", &url, &url_len, &local_path, &local_path_len, &opts) == FAILURE)
151151
return;
152152

153153
if (opts != NULL) {

git2_tests/001_pull_anonymous.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
<?php
2-
exit; // XXX TEST DISABLED XXX (fails, need to check why, maybe initial checkout should be done through git_clone())
32

43
$tmp = sys_get_temp_dir().'/php-git2_test';
54

6-
$repo = Git2\Repository::init_ext($tmp, ['flags' => Git2\Repository::INIT_MKDIR]);
7-
if (!$repo) {
8-
echo "Failed to initialize repo in $tmp\n";
9-
exit(1);
5+
if (file_exists($tmp)) {
6+
echo "Skipping test - Remove $tmp to run test - rm -fr ".escapeshellarg($tmp)."\n";
7+
exit(0); // skip test
108
}
119

12-
// config repo
13-
$config = $repo->config();
14-
$config->set_string('branch.master.remote', 'origin');
15-
$config->set_string('branch.master.merge', 'refs/heads/master');
16-
$config_array = $config->export();
10+
echo "Cloning repository...\n";
11+
$repo = Git2\Repository::clone('https://github.com/MagicalTux/php-git2.git', $tmp);
1712

18-
19-
echo "Fetching remote...\n";
20-
#$remote = Git2\Remote::create_anonymous($repo, 'https://github.com/MTYoujou/php-git2.git');
21-
if (!isset($config_array['remote.origin.url'])) {
22-
$remote = Git2\Remote::create_with_fetchspec($repo, 'origin', 'https://github.com/MTYoujou/php-git2.git', '+refs/heads/*:refs/remotes/origin/*');
23-
} else {
24-
$remote = Git2\Remote::lookup_name($repo, 'origin');
25-
}
26-
#var_dump($remote->connect(false));
27-
var_dump($remote->fetch(['+refs/*', 'refs/*']));
2813
#var_dump($repo->checkout_head());
2914
var_dump($repo->head());
3015

0 commit comments

Comments
 (0)