added possibility to use origin branches
authorpk910 <philipp@zoelle1.de>
Sun, 6 Oct 2013 01:23:44 +0000 (03:23 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 6 Oct 2013 01:23:44 +0000 (03:23 +0200)
GITManagedWebpage.class.php

index 3a76edcec7cca0f9722b56633d86dd92f339c5f5..5b15d8cbf32293e6209683935ce3756d0628e306 100644 (file)
@@ -218,7 +218,7 @@ class GITManagedWebpage {
         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) {
@@ -290,8 +290,12 @@ class GITManagedWebpage {
         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)) {