[PATCH 1/3] gitweb: Redirect to appropriate view if 'a=' parameter is missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pape@xxxxxxxxxxx>
Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux