/** * @param bool $reset * @param null $repository * * @return null|VersionControl_Git * @throws BuildException */ protected function getGitClient($reset = false, $repository = null) { $this->gitClient = $reset === true ? null : $this->gitClient; $repository = null === $repository ? $this->getRepository() : $repository; if (null === $this->gitClient) { try { $this->gitClient = new VersionControl_Git($repository); } catch (VersionControl_Git_Exception $e) { // re-package throw new BuildException('You must specify readable directory as repository.', $e); } } $this->gitClient->setGitCommandPath($this->getGitPath()); return $this->gitClient; }
public function testSetGitCommandPath() { $instance = new VersionControl_Git('./fixtures/001_VersionControl_Git'); $this->assertEquals($instance->getGitCommandPath(), @System::which('git')); $instance->setGitCommandPath('/usr/local/bin/git'); $this->assertEquals($instance->getGitCommandPath(), '/usr/local/bin/git'); }