* [PATCH] gitweb: Don't append '/' to project base URL if it ends with '/' or ':'
@ 2009-04-09 19:59 Erik Broes
0 siblings, 0 replies; only message in thread
From: Erik Broes @ 2009-04-09 19:59 UTC (permalink / raw)
To: git
The base URL 'user@host' would always be appended with a '/', making it
impossible to create clone URLs like: user@host:repo. Setting your base
URL to 'user@host:' will now have the desired effect.
Signed-off-by: Erik Broes <erikbroes@ripe.net>
---
gitweb/README | 13 +++++++------
gitweb/gitweb.perl | 5 ++++-
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/gitweb/README b/gitweb/README
index 8433dd1..efb0f1b 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -69,12 +69,13 @@ You can specify the following configuration variables when building GIT:
SERVER_NAME CGI environment variable is not set (e.g. if running
gitweb as standalone script). [No default]
* GITWEB_BASE_URL
- Git base URLs used for URL to where fetch project from, i.e. full
- URL is "$git_base_url/$project". Shown on projects summary page.
- Repository URL for project can be also configured per repository; this
- takes precedence over URLs composed from base URL and a project name.
- Note that you can setup multiple base URLs (for example one for
- git:// protocol access, another for http:// access) from the gitweb
+ Git base URLs used for URL to where fetch project from, i.e. full URL is
+ "$git_base_url/$project". No '/' will be added between the base URL and and
+ the project if the base URL ends with either a ':' or '/'. Shown on
+ projects summary page. Repository URL for project can be also configured
+ per repository; this takes precedence over URLs composed from base URL and a
+ project name. Note that you can setup multiple base URLs (for example one
+ for git:// protocol access, another for http:// access) from the gitweb
config file. [No default]
* GITWEB_CSS
Points to the location where you put gitweb.css on your web server
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 33ef190..179c48d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4503,7 +4503,10 @@ 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;
+
+ # Only join with a '/' if there is no trailing '/' or ':'
+ @url_list = map { $_ .= '/' unless m{[:/]$}; $_.$project } @git_base_url_list unless @url_list;
+
foreach my $git_url (@url_list) {
next unless $git_url;
print "<tr class=\"metadata_url\"><td>$url_tag</td><td>$git_url</td></tr>\n";
--
1.6.2.1.519.gcf01bc
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-09 23:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-09 19:59 [PATCH] gitweb: Don't append '/' to project base URL if it ends with '/' or ':' Erik Broes
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).