* [PATCH] www: advertise clone-ability over http/https
@ 2016-02-13 23:13 Eric Wong
2016-02-13 23:25 ` [PATCH 2/1] www: document "git clone --mirror" usage Eric Wong
0 siblings, 1 reply; 2+ messages in thread
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 [flat|nested] 2+ messages in thread
* [PATCH 2/1] www: document "git clone --mirror" usage
2016-02-13 23:13 [PATCH] www: advertise clone-ability over http/https Eric Wong
@ 2016-02-13 23:25 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2016-02-13 23:25 UTC (permalink / raw)
To: meta
Not everybody is willing to install or run ssoma; but at least
document "git clone --mirror" usage to promote data distribution.
It's wasteful to clone without "--mirror", so we'll suggest that
to avoid wasting disk space and inodes.
---
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 95dfcbf..77910f6 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -250,11 +250,13 @@ sub footer {
$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];
+ $urls = "URL for <a\nhref=\"" . SSOMA_URL .
+ qq(">ssoma</a> or <b>git clone --mirror \$URL</b> :) .
+ $urls[0];
} else {
- $urls = "git URLs for <a\nhref=\"" . SSOMA_URL .
- "\">ssoma</a>:\n" . join("\n", map { "\t$_" } @urls);
+ $urls = "URLs for <a\nhref=\"" . SSOMA_URL .
+ qq(">ssoma</a> or <b>git clone --mirror \$URL</b>\n) .
+ join("\n", map { "\t$_" } @urls);
}
my $addr = $pi_config->get($listname, 'address');
--
EW
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-13 23:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13 23:13 [PATCH] www: advertise clone-ability over http/https Eric Wong
2016-02-13 23:25 ` [PATCH 2/1] www: document "git clone --mirror" usage Eric Wong
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).