Пример #1
0
 protected function getClient($url)
 {
     $client = new Git($url);
     $client->getAdapter()->setExecutable('git');
     if (null !== $this->dispatcher) {
         $client->setDispatcher($this->dispatcher);
     }
     $client->setCwd($this->cacheDir . '/git/' . md5($url));
     return $client;
 }
Пример #2
0
 /**
  * Lists files and directories
  *
  * @todo WARNING: this is UNTESTED code!!
  *
  * returns an array with the following format:
  *
  * array(
  *   'filename' => array(
  *     'type' => 'directory', // or 'file'
  *     'mtime' => new \DateTime(),
  *   ),
  * );
  *
  * @param  string $path
  * @return array
  */
 public function ls($path)
 {
     $retval = array();
     $list = $this->git->ls($path);
     /** @var $vcsFile VcsFileInfo */
     foreach ($list as $vcsFile) {
         $retval[$vcsFile->getFilename()] = array('type' => $vcsFile->isDir() ? 'directory' : 'file', 'mtime' => null);
     }
     return $retval;
 }
Пример #3
0
 /**
  * @return Git
  */
 protected function getGit()
 {
     if (null === $this->git) {
         $this->git = new Git($this->url);
         /** @var CliAdapter $adapter */
         $adapter = $this->git->getAdapter();
         $adapter->setExecutable($this->executable);
     }
     return $this->git;
 }