user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] www: advertise clone-ability over http/https
@ 2016-02-13 23:13  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-02-13 23:13 UTC (permalink / raw)
  To: meta

All public-inbox instances shall be clone-able.
---
 lib/PublicInbox/WWW.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index b4b012f..95dfcbf 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -244,10 +244,12 @@ sub footer {
 
 	my $urls = try_cat("$git_dir/cloneurl");
 	my @urls = split(/\r?\n/, $urls || '');
-	my $nurls = scalar @urls;
-	if ($nurls == 0) {
-		$urls = '($GIT_DIR/cloneurl missing)';
-	} elsif ($nurls == 1) {
+	my %seen = map { $_ => 1 } @urls;
+	my $cgi = $ctx->{cgi};
+	my $http = (ref($cgi) eq 'CGI') ? $cgi->url(-base) . "/$listname" :
+			$cgi->base->as_string . $listname;
+	$seen{$http} or unshift @urls, $http;
+	if (scalar(@urls) == 1) {
 		$urls = "git URL for <a\nhref=\"" . SSOMA_URL .
 			'">ssoma</a>: ' . $urls[0];
 	} else {
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-02-13 23:13  7% [PATCH] www: advertise clone-ability over http/https Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).