git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Check git base URLs before generating URL from it

From
Jakub Narebski <jnareb@gmail.com>
Date
Oct 26, 2006, 10:26 UTC
Message-ID
<200610261226.44960.jnareb@gmail.com>

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
Next: Junio C Hamano
Message 1 of 3 in “gitweb: Check git base URLs before generating URL from it”
  1. gitweb: Check git base URLs before generating URL from itJakub Narebski, Oct 26, 2006
  2. Junio C HamanoOct 26, 2006
  3. Jakub NarebskiOct 26, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.