{"thread":{"id":"9280","subject":"[PATCH] gitweb: Allow for multivalued parameters passed to href subroutine","startedAt":"2007-07-28T23:04:09Z","lastAt":"2007-07-28T23:04:09Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"48938","messageId":"1185663849243-git-send-email-jnareb@gmail.com","threadId":"9280","inReplyTo":null,"subject":"[PATCH] gitweb: Allow for multivalued parameters passed to href subroutine","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-07-28T23:04:09Z","receivedAt":"2007-07-28T23:04:09Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Make it possible to generate URLs with multivalued parameters in the\nhref() subroutine, via passing reference to array of values.\n\nExample:\n  href(action=>\"log\", extra_options=>[\"--no-merges\", \"--first-parent\"])\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 8a32899..498b936 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -629,7 +629,13 @@ sub href(%) {\n \tfor (my $i = 0; $i < @mapping; $i += 2) {\n \t\tmy ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);\n \t\tif (defined $params{$name}) {\n-\t\t\tpush @result, $symbol . \"=\" . esc_param($params{$name});\n+\t\t\tif (ref($params{$name}) eq \"ARRAY\") {\n+\t\t\t\tforeach my $par (@{$params{$name}}) {\n+\t\t\t\t\tpush @result, $symbol . \"=\" . esc_param($par);\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tpush @result, $symbol . \"=\" . esc_param($params{$name});\n+\t\t\t}\n \t\t}\n \t}\n \t$href .= \"?\" . join(';', @result) if scalar @result;\n-- \n1.5.2.4\n"}]}