Solved most of issue 93 by not requesting diff content most of the time.

Still need to handle the display of a large commit in the individual
commit page.
dev
Loic d'Anterroches 2009-01-17 18:10:55 +01:00
parent 48355417d7
commit 61bc7a70b6
2 changed files with 14 additions and 7 deletions

View File

@ -250,14 +250,22 @@ class IDF_Scm_Git
* Get commit details. * Get commit details.
* *
* @param string Commit ('HEAD'). * @param string Commit ('HEAD').
* @param bool Get commit diff (false).
* @return array Changes. * @return array Changes.
*/ */
public function getCommit($commit='HEAD') public function getCommit($commit='HEAD', $getdiff=false)
{ {
$cmd = sprintf('GIT_DIR=%s git show --date=iso --pretty=format:%s %s', if ($getdiff) {
escapeshellarg($this->repo), $cmd = sprintf('GIT_DIR=%s git show --date=iso --pretty=format:%s %s',
"'".$this->mediumtree_fmt."'", escapeshellarg($this->repo),
escapeshellarg($commit)); "'".$this->mediumtree_fmt."'",
escapeshellarg($commit));
} else {
$cmd = sprintf('GIT_DIR=%s git log -1 --date=iso --pretty=format:%s %s',
escapeshellarg($this->repo),
"'".$this->mediumtree_fmt."'",
escapeshellarg($commit));
}
$out = array(); $out = array();
IDF_Scm::exec($cmd, $out); IDF_Scm::exec($cmd, $out);
$log = array(); $log = array();
@ -278,7 +286,6 @@ class IDF_Scm_Git
return $out[0]; return $out[0];
} }
/** /**
* Get latest changes. * Get latest changes.
* *

View File

@ -216,7 +216,7 @@ class IDF_Views_Source
} }
$title = sprintf(__('%s Commit Details'), (string) $request->project); $title = sprintf(__('%s Commit Details'), (string) $request->project);
$page_title = sprintf(__('%s Commit Details - %s'), (string) $request->project, $commit); $page_title = sprintf(__('%s Commit Details - %s'), (string) $request->project, $commit);
$cobject = $scm->getCommit($commit); $cobject = $scm->getCommit($commit, true);
$rcommit = IDF_Commit::getOrAdd($cobject, $request->project); $rcommit = IDF_Commit::getOrAdd($cobject, $request->project);
$diff = new IDF_Diff($cobject->changes); $diff = new IDF_Diff($cobject->changes);
$diff->parse(); $diff->parse();