Fixed to redirect the user to the home if no available branch.

This is a short term fix. We need to create a "howto" page for each kind
of repository to display it when the user want to access a repository
with nothing in it.
This commit is contained in:
Loic d'Anterroches 2009-01-21 19:56:47 +01:00
parent 49c8510d31
commit 3fbac71f04

View File

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