X-Git-Url: http://git.pk910.de/?p=GITManagedWebpage.git;a=blobdiff_plain;f=GITManagedWebpage.class.php;h=c8c7714e719eec80823363657b4263165c185ce7;hp=6b6d903b57f095fdda048aa9b4fc9e6e52ce3e7b;hb=04b1df59f6e9c029d88dd203d7dac395122cc9cb;hpb=1ece2cf1027486cd6eb3f8b1065d56c80a66fe41 diff --git a/GITManagedWebpage.class.php b/GITManagedWebpage.class.php index 6b6d903..c8c7714 100644 --- a/GITManagedWebpage.class.php +++ b/GITManagedWebpage.class.php @@ -243,9 +243,8 @@ class GITManagedWebpage { if(substr($path, -1) != '/') $path .= '/'; $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"); + $this->gitcmd("fetch"); + $this->gitcmd("reset", "--hard", "origin/".$branch); $gitret = $this->gitcmd("rev-list", "--max-count=1", $branch); preg_match("#([a-z0-9]{40})#", $gitret, $match); $newest_version = $match[1]; @@ -302,6 +301,7 @@ class GITManagedWebpage { return; if(!$this->branchExists($branch)) { + $this->gitcmd("fetch"); if(!$this->branchExists('origin/'.$branch)) return false; } @@ -313,7 +313,7 @@ class GITManagedWebpage { } } - public function execute($file = null) { + public function getExecFile($file = null) { if($this->loopedcall) return; define("GITMANAGED_EXECUTED", true); @@ -326,16 +326,15 @@ class GITManagedWebpage { $default_branch = $this->getConfig("defaultbranch"); $active_branch = $this->getActiveBranch(); if($active_branch != $default_branch) { - if(!($dir = $this->localBranchPath($branch))) { + if(!($dir = $this->localBranchPath($active_branch))) { $dir = $this->localBranchPath($active_branch, true); $this->updateBranch($active_branch, $dir, true); } chdir($dir); - include_once($dir.$file); + return $dir.$file; } else { - include($file); //possible loop! + return $file; } - die(); } }