/** * ReadHistory * * Reads the file history * * @access private */ private function ReadHistory() { $this->historyRead = true; $exe = new GitPHP_GitExe($this->GetProject()); $args = array(); if (isset($this->commit)) { $args[] = $this->commit->GetHash(); } else { $args[] = 'HEAD'; } $args[] = '|'; $args[] = $exe->GetBinary(); $args[] = '--git-dir=' . $this->GetProject()->GetPath(); $args[] = GIT_DIFF_TREE; $args[] = '-r'; $args[] = '--stdin'; $args[] = '--'; $args[] = $this->GetPath(); $historylines = explode("\n", $exe->Execute(GIT_REV_LIST, $args)); $commit = null; foreach ($historylines as $line) { if (preg_match('/^([0-9a-fA-F]{40})/', $line, $regs)) { $commit = $this->GetProject()->GetCommit($regs[1]); } else { if ($commit) { try { $history = new GitPHP_FileDiff($this->GetProject(), $line); $history->SetCommit($commit); $this->history[] = $history; } catch (Exception $e) { } unset($commit); } } } }