summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f596157)
raw | patch | inline | side by side (parent: f596157)
author | Martin Waitz <tali@admingilde.org> | |
Sun, 1 Oct 2006 21:57:48 +0000 (23:57 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 2 Oct 2006 07:49:42 +0000 (00:49 -0700) |
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.
The this can be enabled with the "pathinfo" feature in gitweb_config.perl.
[jc: let's introduce new features disabled by default not to
upset too many existing installations.]
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
the base URI. All other parameters are appended to that, except for ?a=summary
which is the default and can be omitted.
The this can be enabled with the "pathinfo" feature in gitweb_config.perl.
[jc: let's introduce new features disabled by default not to
upset too many existing installations.]
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 44991b1538316b971884bafa5f8f01f678ec9a71..10e803a97fa411ad014fbe476e55ec83d2e9f6b6 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
'sub' => \&feature_pickaxe,
'override' => 0,
'default' => [1]},
+
+ 'pathinfo' => {
+ 'override' => 0,
+ 'default' => [0]},
);
sub gitweb_check_feature {
sub href(%) {
my %params = @_;
+ my $href = $my_uri;
my @mapping = (
project => "p",
$params{'project'} = $project unless exists $params{'project'};
+ my ($use_pathinfo) = gitweb_check_feature('pathinfo');
+ if ($use_pathinfo) {
+ # use PATH_INFO for project name
+ $href .= "/$params{'project'}" if defined $params{'project'};
+ delete $params{'project'};
+
+ # Summary just uses the project path URL
+ if (defined $params{'action'} && $params{'action'} eq 'summary') {
+ delete $params{'action'};
+ }
+ }
+
+ # now encode the parameters explicitly
my @result = ();
for (my $i = 0; $i < @mapping; $i += 2) {
my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
push @result, $symbol . "=" . esc_param($params{$name});
}
}
- return "$my_uri?" . join(';', @result);
+ $href .= "?" . join(';', @result) if scalar @result;
+
+ return $href;
}