Skip to content

Commit f22cca4

Browse files
jnarebgitster
authored andcommitted
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>
1 parent 8b4aee0 commit f22cca4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gitweb/gitweb.perl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,13 @@ (%)
629629
for (my $i = 0; $i < @mapping; $i += 2) {
630630
my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
631631
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+
}
633639
}
634640
}
635641
$href .= "?" . join(';', @result) if scalar @result;

0 commit comments

Comments
 (0)