private function initRepo()
 {
     //get path to the repo root (by default DokuWiki's savedir)
     if (defined('DOKU_FARM')) {
         $repoPath = $this->getConf('repoPath');
     } else {
         $repoPath = DOKU_INC . $this->getConf('repoPath');
     }
     //set the path to the git binary
     $gitPath = trim($this->getConf('gitPath'));
     if ($gitPath !== '') {
         Git::set_bin($gitPath);
     }
     //init the repo and create a new one if it is not present
     io_mkdir_p($repoPath);
     $repo = new GitRepo($repoPath, true, true);
     //set git working directory (by default DokuWiki's savedir)
     $repoWorkDir = DOKU_INC . $this->getConf('repoWorkDir');
     Git::set_bin(Git::get_bin() . ' --work-tree ' . escapeshellarg($repoWorkDir));
     $params = str_replace(array('%mail%', '%user%'), array($this->getAuthorMail(), $this->getAuthor()), $this->getConf('addParams'));
     if ($params) {
         Git::set_bin(Git::get_bin() . ' ' . $params);
     }
     return $repo;
 }
 private function initRepo()
 {
     if (!class_exists("Git")) {
         require 'Git.php/Git.php';
     }
     $this->pullOnChange = c::get('gcapc-pull', false);
     $this->pushOnChange = c::get('gcapc-push', false);
     $this->commitOnChange = c::get('gcapc-commit', false);
     $this->gitBin = c::get('gcapc-gitBin', '');
     $this->windowsMode = c::get('gcapc-windowsMode', false);
     if ($this->windowsMode) {
         Git::windows_mode();
     }
     if ($this->gitBin) {
         Git::set_bin($this->gitBin);
     }
     $this->repo = Git::open($this->repoPath);
     if (!$this->repo->test_git()) {
         trigger_error('git could not be found or is not working properly. ' . Git::get_bin());
     }
 }
Ejemplo n.º 3
0
 /**
  * Run a git command in the git repository
  *
  * Accepts a git command to run
  *
  * @access  public
  * @param   string  command to run
  * @return  string
  */
 public function run($command)
 {
     return $this->run_command(Git::get_bin() . ' ' . $command);
 }
Ejemplo n.º 4
0
 /**
  * Run a git command in the git repository
  *
  * Accepts a git command to run
  *
  * @access  public
  * @param   string  command to run
  * @return  string
  */
 public function run($command)
 {
     // If git.exe is in C:/Program Files, the space between Program and Files causes an error.
     return $this->run_command(Git::get_bin() . " " . $command);
 }
Ejemplo n.º 5
0
Archivo: Git.php Proyecto: iwalpola/git
 /**
  * Tests if git is installed
  *
  * @access  public
  * @return  bool
  */
 public function test()
 {
     $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
     $pipes = array();
     $resource = proc_open(Git::get_bin(), $descriptorspec, $pipes);
     $stdout = stream_get_contents($pipes[1]);
     $stderr = stream_get_contents($pipes[2]);
     foreach ($pipes as $pipe) {
         fclose($pipe);
     }
     $status = trim(proc_close($resource));
     return $status != 127;
 }