gitweb: choose appropriate view for file type if a= parameter missing
[gitweb.git] / gitweb / gitweb.perl
index 90243fdf982c02dcb0ca9e3b6b128c2e7ad3d342..21864c62a9092394a473d89ac98848e170ceab02 100755 (executable)
@@ -458,10 +458,16 @@ sub evaluate_path_info {
        "project_index" => \&git_project_index,
 );
 
-if (defined $project) {
-       $action ||= 'summary';
-} else {
-       $action ||= 'project_list';
+if (!defined $action) {
+       if (defined $hash) {
+               $action = git_get_type($hash);
+       } elsif (defined $hash_base && defined $file_name) {
+               $action = git_get_type("$hash_base:$file_name");
+       } elsif (defined $project) {
+               $action = 'summary';
+       } else {
+               $action = 'project_list';
+       }
 }
 if (!defined($actions{$action})) {
        die_error(undef, "Unknown action");