git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: Check git base URLs before generating URL from it
@ 2006-10-26 10:26 Jakub Narebski
  2006-10-26 17:21 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2006-10-26 10:26 UTC (permalink / raw)
  To: git

Check if each of git base URLs in @git_base_url_list is true before
appending "/$project" to it to generate project URL.

This fixes the error that for default configuration for gitweb in
Makefile, with GITWEB_BASE_URL empty (and "++GITWEB_BASE_URL++" being
"" in gitweb.cgi), we had URL of "/$project" in the summary view.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
I don't think that anybody would want base URL of "0".

 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 35a9afb..0d2ea72 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2516,7 +2516,8 @@ sub git_summary {
 	# or make project git URL from git base URL and project name
 	my $url_tag = "URL";
 	my @url_list = git_get_project_url_list($project);
-	@url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
+	@url_list = map { $_ ? "$_/$project" : () }
+		@git_base_url_list unless @url_list;
 	foreach my $git_url (@url_list) {
 		next unless $git_url;
 		print "<tr><td>$url_tag</td><td>$git_url</td></tr>\n";
-- 
1.4.3.3

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

* Re: [PATCH] gitweb: Check git base URLs before generating URL from it
  2006-10-26 10:26 [PATCH] gitweb: Check git base URLs before generating URL from it Jakub Narebski
@ 2006-10-26 17:21 ` Junio C Hamano
  2006-10-26 17:39   ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-10-26 17:21 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Wouldn't this be simpler and more to the point, I wonder?

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 5a81b8f..aceaeb7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -80,7 +80,7 @@ our $strict_export = "++GITWEB_STRICT_EX
 
 # list of git base URLs used for URL to where fetch project from,
 # i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
 
 # default blob_plain mimetype and default charset for text/plain blob
 our $default_blob_plain_mimetype = 'text/plain';

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

* Re: [PATCH] gitweb: Check git base URLs before generating URL from it
  2006-10-26 17:21 ` Junio C Hamano
@ 2006-10-26 17:39   ` Jakub Narebski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-10-26 17:39 UTC (permalink / raw)
  To: git

Junio C Hamano wrote:

> Wouldn't this be simpler and more to the point, I wonder?

> -our @git_base_url_list = ("++GITWEB_BASE_URL++");
> +our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");

Yes, that would be cartainly better.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


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

end of thread, other threads:[~2006-10-26 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 10:26 [PATCH] gitweb: Check git base URLs before generating URL from it Jakub Narebski
2006-10-26 17:21 ` Junio C Hamano
2006-10-26 17:39   ` 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).