/**
  * Gets a single head
  *
  * @param string $head head to find
  * @param string $hash hash of head, if known
  * @return GitPHP_Head head object
  */
 public function GetHead($head, $hash = '')
 {
     if (empty($head)) {
         return null;
     }
     $key = GitPHP_Head::CacheKey($this->project->GetProject(), $head);
     $headObj = null;
     if ($this->memoryCache) {
         $headObj = $this->memoryCache->Get($key);
     }
     if (!$headObj) {
         $headObj = new GitPHP_Head($this->project, $head, $hash);
         if ($this->memoryCache) {
             $this->memoryCache->Set($key, $headObj);
         }
     }
     return $headObj;
 }
Beispiel #2
0
 /**
  * Compares two heads by age
  *
  * @param GitPHP_Head $a first head
  * @param GitPHP_Head $b second head
  * @return integer comparison result
  */
 public static function CompareAge($a, $b)
 {
     $aObj = $a->GetCommit();
     $bObj = $b->GetCommit();
     return GitPHP_Commit::CompareAge($aObj, $bObj);
 }