From: Jakub Narebski Date: Sat, 28 Jul 2007 23:04:09 +0000 (+0200) Subject: gitweb: Allow for multivalued parameters passed to href subroutine X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/b650d2fdc6ae258518ce3c6e84cf9b6210213a23710dcb661c891ce735bc0507 gitweb: Allow for multivalued parameters passed to href subroutine Make it possible to generate URLs with multivalued parameters in the href() subroutine, via passing reference to array of values. Example: href(action=>"log", extra_options=>["--no-merges", "--first-parent"]) Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index 4a8d5e6..972339d 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -630,7 +630,13 @@ sub href(%) { for (my $i = 0; $i < @mapping; $i += 2) { my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]); if (defined $params{$name}) { - push @result, $symbol . "=" . esc_param($params{$name}); + if (ref($params{$name}) eq "ARRAY") { + foreach my $par (@{$params{$name}}) { + push @result, $symbol . "=" . esc_param($par); + } + } else { + push @result, $symbol . "=" . esc_param($params{$name}); + } } } $href .= "?" . join(';', @result) if scalar @result;