fixed missing --work-tree parameter
[GITManagedWebpage.git] / GITManagedWebpage.class.php
index 0cf408ce4bc1550134e1b9ca2908bc86ff820c8e..7622b30ebd41a15ff707329d29b8ce1b2c871311 100644 (file)
@@ -90,7 +90,7 @@ class GITManagedWebpage {
             } else
                 $argstr .= " ".escapeshellarg($arg);
         }
-        $gitcmd = 'git '.escapeshellarg('--git-dir='.$this->workdir.'repository/.git').$argstr;
+        $gitcmd = 'git '.escapeshellarg('--git-dir='.$this->workdir.'repository/.git').' '.escapeshellarg('--work-tree='.$this->workdir.'repository/.git').$argstr;
         $output = shell_exec($gitcmd);
         return $output;
     }
@@ -234,14 +234,13 @@ class GITManagedWebpage {
         $current_branch = str_replace(array("\r", "\n"), array("", ""), $this->gitcmd("rev-parse", "--abbrev-ref", "HEAD"));
         if($current_branch != $branch)
             $this->gitcmd("checkout", $branch);
-        $this->gitcmd("pull");
+        echo $this->gitcmd("pull");
         $gitret = $this->gitcmd("rev-list", "--max-count=1", $branch);
         preg_match("#([a-z0-9]{40})#", $gitret, $match);
         $newest_version = $match[1];
         
         $deleted_files = array();
         if(($current_version = $this->getConfig('version_'.$branch))) {
-            echo $current_version . " == " . $newest_version;
             if($current_version == $newest_version)
                 return;
             else {
@@ -319,8 +318,7 @@ class GITManagedWebpage {
                 $this->updateBranch($active_branch, $dir);
             }
             include_once($dir.$file);
-        } else {
-            include_once($this->localdir.$file);
+            die();
         }
     }