All of lore.kernel.org
 help / color / mirror / Atom feed
From: Erik Broes <erikbroes@ripe.net>
To: git@vger.kernel.org
Subject: [PATCH] gitweb: Don't append '/' to project base URL if it ends with '/' or ':'
Date: Thu, 09 Apr 2009 21:59:21 +0200	[thread overview]
Message-ID: <49DE5399.60402@ripe.net> (raw)

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

                 reply	other threads:[~2009-04-09 23:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49DE5399.60402@ripe.net \
    --to=erikbroes@ripe.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.