Skip to content

Commit 9c5750e

Browse files
author
Alexandre Salomé
committed
Merge pull request #66 from pitpit/feature-public-cloneRepository
changed Admin::cloneRepository() scope to make it publicly usable
2 parents 7a46107 + 02ad523 commit 9c5750e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Gitonomy/Git/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static function mirrorTo($path, $url, array $options = array())
129129
*
130130
* @return Repository
131131
*/
132-
private static function cloneRepository($path, $url, array $args = array(), array $options = array())
132+
public static function cloneRepository($path, $url, array $args = array(), array $options = array())
133133
{
134134
$process = static::getProcess('clone', array_merge(array('-q'), $args, array($url, $path)), $options);
135135

tests/Gitonomy/Git/Tests/AdminTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,21 @@ public function testExistingFile()
158158

159159
Admin::init($file, true, self::getOptions());
160160
}
161+
162+
public function testCloneRepository()
163+
{
164+
$newDir = self::createTempDir();
165+
$args = array();
166+
167+
$new = Admin::cloneRepository($newDir, self::REPOSITORY_URL, $args, self::getOptions());
168+
self::registerDeletion($new);
169+
170+
$newRefs = array_keys($new->getReferences()->getAll());
171+
172+
$this->assertTrue(in_array('refs/heads/master', $newRefs));
173+
$this->assertTrue(in_array('refs/tags/0.1', $newRefs));
174+
175+
$this->assertEquals($newDir.'/.git', $new->getGitDir());
176+
$this->assertEquals($newDir, $new->getWorkingDir());
177+
}
161178
}

0 commit comments

Comments
 (0)