1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 04:46:11 +02:00

gitweb: Easier adding/changing parameters to current URL

Add boolean option '-replay' to href() subroutine, which is used to
generate links in gitweb.  This option "replays" current URL,
overriding it with provided parameters.  It means that current value
of each CGI parameter is used unless otherwise provided.

This change is meant to make it easier to generate links which differ
from current page URL only by one parameter, for example the same view
but sorted by different column:
  href(-replay=>1, order=>"age")
or view which differs by some option, e.g. in log views
  href(-replay=>1, extra_options=>"--no-merges")
or alternate view of the same object, e.g. in the 'blob' view
  href(-replay=>1, action=>"blob_plain")

Actual use of this functionality is left for later.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jakub Narebski 2007-11-01 13:06:27 +01:00 committed by Junio C Hamano
parent fa9aff463d
commit 1cad283a71

View File

@ -611,6 +611,15 @@ (%)
);
my %mapping = @mapping;
if ($params{-replay}) {
while (my ($name, $symbol) = each %mapping) {
if (!exists $params{$name}) {
# to allow for multivalued params we use arrayref form
$params{$name} = [ $cgi->param($symbol) ];
}
}
}
$params{'project'} = $project unless exists $params{'project'};
my ($use_pathinfo) = gitweb_check_feature('pathinfo');