From: Jakub Narebski Date: Fri, 07 Mar 2008 21:03:18 GMT Subject: [PATCH 1/3] gitweb: Redirect to appropriate view if 'a=' parameter is missing Message-ID: <1204923800-5923-2-git-send-email-jnareb@gmail.com> In-Reply-To: <1204923800-5923-1-git-send-email-jnareb@gmail.com> Instead of finding the type of object specified by 'h', or 'hb' and 'f' parameters and substituting it for action (view), as it was done since commit 7f9778b by Gerrit Pape, use 'object' view which would find type and REDIRECT to URL with 'a' parameter filled in. This way user will have URL with action filled in the browser history, or when adding bookmark. This hopefully would make server get less requests without 'a' parameter set, thus reducing a bit load on server. Note that the code to find object type in git_object() subroutine is a bit more complicated than was used for URL without 'a=' parameter. Cc: Gerrit Pape Signed-off-by: Jakub Narebski --- The fact that using 'object' view changes a bit behavior is addressed in second commit in this series, where git_commit() is made to do what dispatch for URL without a=, but with h= or hb= and f= did before. gitweb/gitweb.perl | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index ec73cb1..a76c4ac 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -564,10 +564,9 @@ my %actions = ( ); 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"); + if (defined $hash || + (defined $hash_base && defined $file_name)) { + $action = 'object'; } elsif (defined $project) { $action = 'summary'; } else { -- 1.5.4.3.453.gc1ad83