Skip to content

Commit

Permalink
gitweb: Allow for multivalued parameters passed to href subroutine
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Jul 29, 2007
1 parent 8b4aee0 commit f22cca4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,13 @@ (%)
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;
Expand Down

0 comments on commit f22cca4

Please sign in to comment.