Skip to content

Commit 99d8260

Browse files
committed
test 003: use anonymous remote
1 parent 84fe8eb commit 99d8260

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

git2_tests/003_forced_checkout.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
$repo = Git2\Repository::init($tmp, false);
66

7-
try {
8-
$remote = Git2\Remote::lookup_name($repo, 'origin');
9-
} catch(\Exception $e) {
10-
$remote = Git2\Remote::create_with_fetchspec($repo, 'origin', 'git@github.com:MagicalTux/php-git2.git', '+refs/*:refs/*');
11-
}
7+
$remote = Git2\Remote::create_anonymous($repo, 'git@github.com:MagicalTux/php-git2.git');
128

139
$fetch_opts = [
1410
'callbacks' => [
@@ -21,7 +17,7 @@
2117
];
2218

2319
echo "Fetching repository...\n";
24-
var_dump($remote->fetch(NULL, $fetch_opts));
20+
var_dump($remote->fetch(['+refs/*:refs/*'], $fetch_opts));
2521

2622
$cfg = $repo->config();
2723
$cfg->set_string('branch.master.remote', 'origin');

0 commit comments

Comments
 (0)