Added a control to avoid redirecting to an inexisting branch.

This commit is contained in:
Loic d'Anterroches 2009-01-25 20:48:02 +01:00
parent e513d95dbe
commit 743a3f312c

View File

@ -64,6 +64,12 @@ class IDF_Views_Source
$branches = $scm->getBranches(); $branches = $scm->getBranches();
$commit = $match[2]; $commit = $match[2];
if ('commit' != $scm->testHash($commit)) { if ('commit' != $scm->testHash($commit)) {
if (count($branches) == 0) {
// Redirect to the project source help
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::help',
array($request->project->shortname));
return new Pluf_HTTP_Response_Redirect($url);
}
// Redirect to the first branch // Redirect to the first branch
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::changeLog', $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::changeLog',
array($request->project->shortname, array($request->project->shortname,