} else
$argstr .= " ".escapeshellarg($arg);
}
- $gitcmd = 'git '.escapeshellarg('--git-dir='.$this->workdir.'repository/.git').' '.escapeshellarg('--work-tree='.$this->workdir.'repository/.git').$argstr;
+ $gitcmd = 'git '.escapeshellarg('--git-dir='.$this->workdir.'repository/.git').' '.escapeshellarg('--work-tree='.$this->workdir.'repository').$argstr;
$output = shell_exec($gitcmd);
return $output;
}
if($branch == $default_branch)
$dir = $this->localdir;
else
- $dir = $this->workdir.'branch_'.$branch.'/';
+ $dir = $this->workdir.'branch_'.str_replace(array('/'), array('_'), $branch).'/';
if(file_exists($dir))
return $dir;
else if($create) {
$current_branch = str_replace(array("\r", "\n"), array("", ""), $this->gitcmd("rev-parse", "--abbrev-ref", "HEAD"));
if($current_branch != $branch)
$this->gitcmd("checkout", $branch);
- echo $this->gitcmd("pull");
+ $this->gitcmd("pull");
$gitret = $this->gitcmd("rev-list", "--max-count=1", $branch);
preg_match("#([a-z0-9]{40})#", $gitret, $match);
$newest_version = $match[1];
if($this->loopedcall)
return;
- if(!$this->branchExists($branch))
- return false;
+ if(!$this->branchExists($branch)) {
+ if($this->branchExists('origin/'.$branch))
+ $branch = 'origin/'.$branch;
+ else
+ return false;
+ }
$this->setActiveBranch($branch, $remember);
if(!$this->localBranchPath($branch)) {