From: pk910 Date: Sun, 13 Oct 2013 13:36:31 +0000 (+0200) Subject: fixed merging errors X-Git-Url: http://git.pk910.de/?p=GITManagedWebpage.git;a=commitdiff_plain;h=04b1df59f6e9c029d88dd203d7dac395122cc9cb fixed merging errors --- diff --git a/GITManagedWebpage.class.php b/GITManagedWebpage.class.php index fee826c..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; }