Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
gitweb: Allow for multivalued parameters passed to href subroutine
author
Jakub Narebski
<jnareb@gmail.com>
Sat, 28 Jul 2007 23:04:09 +0000
(
01:04
+0200)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 29 Jul 2007 01:54:56 +0000
(18:54 -0700)
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>
gitweb/gitweb.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8b4aee0
)
diff --git
a/gitweb/gitweb.perl
b/gitweb/gitweb.perl
index 8a32899655d1a2862e3a3ffbf6df560811bc493b..498b936dd48bef9a788b56c2ddbbacb63d1e29b6 100755
(executable)
--- a/
gitweb/gitweb.perl
+++ b/
gitweb/gitweb.perl
@@
-629,7
+629,13
@@
(%)
for (my $i = 0; $i < @mapping; $i += 2) {
my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
if (defined $params{$name}) {
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;
}
}
$href .= "?" . join(';', @result) if scalar @result;