git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: start to generate PATH_INFO URLs
@ 2006-09-29 22:16 Martin Waitz
  2006-09-29 22:30 ` Junio C Hamano
  2006-10-03 12:16 ` Jakub Narebski
  0 siblings, 2 replies; 19+ messages in thread
From: Martin Waitz @ 2006-09-29 22:16 UTC (permalink / raw)
  To: git

Instead of providing the project as a ?p= parameter it is simply appended
to the base URI.
All other parameters are appended to that, except for ?a=summary which
is the default and can be omitted.

Signed-off-by: Martin Waitz <tali@admingilde.org>
---
 gitweb/gitweb.perl |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 597d29f..e507ce9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -355,6 +355,7 @@ ## action links
 
 sub href(%) {
 	my %params = @_;
+	my $href;
 
 	my @mapping = (
 		project => "p",
@@ -373,6 +374,16 @@ sub href(%) {
 
 	$params{'project'} = $project unless exists $params{'project'};
 
+	# first encode base url and project
+	$href = "$my_uri/$params{'project'}";
+	delete $params{'project'};
+
+	# Summary just uses the project path URL
+	if ($params{'action'} eq 'summary') {
+		return $href;
+	}
+
+	# now encode the parameters explicitly
 	my @result = ();
 	for (my $i = 0; $i < @mapping; $i += 2) {
 		my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
@@ -380,7 +391,9 @@ sub href(%) {
 			push @result, $symbol . "=" . esc_param($params{$name});
 		}
 	}
-	return "$my_uri?" . join(';', @result);
+	$href .= "?" . join(';', @result);
+
+	return $href;
 }
 
 
-- 
1.4.2.gb8b6b

-- 
Martin Waitz

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2006-10-07  8:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-29 22:16 [PATCH] gitweb: start to generate PATH_INFO URLs Martin Waitz
2006-09-29 22:30 ` Junio C Hamano
2006-09-30 18:14   ` Martin Waitz
2006-09-30 19:42     ` Junio C Hamano
2006-10-01 21:57       ` Martin Waitz
2006-10-03 12:18         ` Jakub Narebski
2006-10-03 17:39           ` Junio C Hamano
2006-10-03 17:50             ` Jakub Narebski
2006-10-03 20:16               ` Junio C Hamano
2006-10-03 20:28               ` Martin Waitz
2006-10-03 18:07             ` [PATCH] gitweb: warn if feature cannot be overridden Martin Waitz
2006-10-03 16:43   ` [PATCH] gitweb: start to generate PATH_INFO URLs Jakub Narebski
2006-10-03 18:08     ` [PATCH] gitweb: make PATHINFO URL generation conditional on input URL Martin Waitz
2006-10-06 15:30   ` [PATCH] gitweb: start to generate PATH_INFO URLs Petr Baudis
2006-10-07  8:40     ` Junio C Hamano
2006-10-03 12:16 ` Jakub Narebski
2006-10-03 17:12   ` Martin Waitz
2006-10-03 17:19     ` Jakub Narebski
2006-10-03 17:36     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).