git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gitweb: Allow for multivalued parameters passed to href subroutine
@ 2007-07-31 11:19 Jakub Narebski
  2007-07-31 11:19 ` [RFC/PATCH 2/2] gitweb: Add an option to show size of blobs in the tree view Jakub Narebski
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Narebski @ 2007-07-31 11:19 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

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"])

This also allows for easy passing back (replaying) current value
of, possibly multivalued, extra_options ('opt') parameter, using:

  href(..., extra_options=>\@extra_options)

which would be required when we start using extra_options in gitweb,
and would want to preserve its value.  For example when creating links
to next/previous page of 'log' or 'history' view output, we would want
to preserve '--no-merges' and/or '-first-parent' extra options.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is the same patch as sent earlier, but with more detailed commit
message.  As the previous version made it into git.git, this is just
for archives.

 gitweb/gitweb.perl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8a32899..498b936 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -629,7 +629,13 @@ sub href(%) {
 	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;
-- 
1.5.2.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-08-02 20:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 11:19 [PATCH 1/2] gitweb: Allow for multivalued parameters passed to href subroutine Jakub Narebski
2007-07-31 11:19 ` [RFC/PATCH 2/2] gitweb: Add an option to show size of blobs in the tree view Jakub Narebski
2007-07-31 22:12   ` Junio C Hamano
2007-08-01 13:05     ` Jakub Narebski
2007-08-01 23:12       ` Junio C Hamano
2007-08-01 23:58         ` Jakub Narebski
2007-08-02  0:47           ` Junio C Hamano
2007-08-02  5:22           ` Junio C Hamano
2007-08-02 10:47             ` Jakub Narebski
2007-08-02 20:47               ` Junio C Hamano
2007-07-31 23:07   ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).