@matheusbsbs / matheus-bagliano / commits / f22cca44ba
Fork 0

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 <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Jul 29, 2007 at 01:04 UTC f22cca44ba5022d93bfd895ec08682fbda7efb8c
1 file changed +7 -1
gitweb/gitweb.perl
+7 -1
@@ -629,7 +629,13 @@ sub href(%) {
629 for (my $i = 0; $i < @mapping; $i += 2) {
630 my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
631 if (defined $params{$name}) {
632 - push @result, $symbol . "=" . esc_param($params{$name});
632 + if (ref($params{$name}) eq "ARRAY") {
633 + foreach my $par (@{$params{$name}}) {
634 + push @result, $symbol . "=" . esc_param($par);
635 + }
636 + } else {
637 + push @result, $symbol . "=" . esc_param($params{$name});
638 + }
639 }
640 }
641 $href .= "?" . join(';', @result) if scalar @result;