Fixed to handle the case of bad commit.

This commit is contained in:
Loic d'Anterroches 2009-07-12 22:13:52 +02:00
parent 36c1f98438
commit dc6f25cdef

View File

@ -271,10 +271,17 @@ class IDF_Views_Source
$scm->getMainBranch())); $scm->getMainBranch()));
return new Pluf_HTTP_Response_Redirect($url); return new Pluf_HTTP_Response_Redirect($url);
} }
$title = sprintf(__('%s Commit Details'), (string) $request->project);
$page_title = sprintf(__('%s Commit Details - %s'), (string) $request->project, $commit);
$large = $scm->isCommitLarge($commit); $large = $scm->isCommitLarge($commit);
$cobject = $scm->getCommit($commit, !$large); $cobject = $scm->getCommit($commit, !$large);
if (!$cobject) {
// Redirect to the first branch
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase',
array($request->project->shortname,
$scm->getMainBranch()));
return new Pluf_HTTP_Response_Redirect($url);
}
$title = sprintf(__('%s Commit Details'), (string) $request->project);
$page_title = sprintf(__('%s Commit Details - %s'), (string) $request->project, $commit);
$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();