unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/2] git: allow cloning from the URL root, too
Date: Fri, 1 Jul 2016 02:15:22 +0000	[thread overview]
Message-ID: <20160701021522.GA31128@dcvr.yhbt.net> (raw)
In-Reply-To: <20160701011703.16578-1-e@80x24.org>

This means we can still show non-git users a somewhat browseable
URL with a link to the README.html file while allowing git users
to type less when cloning.

All of the following are supported:

git clone https://public-inbox.org/ public-inbox
git clone https://public-inbox.org/public-inbox
git clone https://public-inbox.org/public-inbox.git
torsocks git clone http://ou63pmih66umazou.onion/public-inbox
---
 Documentation/dc-dlvr-spam-flow.txt | 2 +-
 README                              | 2 +-
 examples/public-inbox.psgi          | 4 +++-
 lib/PublicInbox/GitHTTPBackend.pm   | 2 +-
 lib/PublicInbox/WwwStream.pm        | 4 ++--
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/dc-dlvr-spam-flow.txt b/Documentation/dc-dlvr-spam-flow.txt
index d151d27..81aba76 100644
--- a/Documentation/dc-dlvr-spam-flow.txt
+++ b/Documentation/dc-dlvr-spam-flow.txt
@@ -45,4 +45,4 @@ delivery path as well as removing the message from the git tree.
 * spamc / spamd - SpamAssassin: http://spamassassin.apache.org/
 
 * report-spam / dc-dlvr - distributed with public-inbox in the scripts/
-  directory: git clone https://public-inbox.org/public-inbox.git
+  directory: git clone https://public-inbox.org/ public-inbox
diff --git a/README b/README
index ca4e2a8..f56d68d 100644
--- a/README
+++ b/README
@@ -87,7 +87,7 @@ Hacking
 
 Source code is available via git:
 
-	git clone https://public-inbox.org/public-inbox.git
+	git clone https://public-inbox.org/ public-inbox
 
 See below for contact info.
 
diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi
index a90a2bc..11e2a6e 100644
--- a/examples/public-inbox.psgi
+++ b/examples/public-inbox.psgi
@@ -47,7 +47,9 @@ builder {
 	sub {
 		my ($env) = @_;
 		# share public-inbox.git code!
-		if ($src && $env->{PATH_INFO} =~ m!\A/public-inbox\.git/(.*)!) {
+		if ($src && $env->{PATH_INFO} =~
+				m!\A/(?:public-inbox(?:\.git)?/)?
+				($PublicInbox::GitHTTPBackend::ANY)\z!xo) {
 			PublicInbox::GitHTTPBackend::serve($env, $src, $1);
 		} else {
 			$www->call($env);
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 4f58c6b..b485192 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -23,7 +23,7 @@ my @binary = qw!
 	objects/pack/pack-[a-f0-9]{40}\.(?:pack|idx)
 	!;
 
-our $ANY = join('|', @binary, @text);
+our $ANY = join('|', @binary, @text, 'git-upload-pack');
 my $BIN = join('|', @binary);
 my $TEXT = join('|', @text);
 
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 97a6dc7..87a461e 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -7,7 +7,7 @@ use strict;
 use warnings;
 use PublicInbox::Hval qw(ascii_html);
 use URI;
-use constant PI_URL => 'https://public-inbox.org/public-inbox.git';
+use constant PI_URL => 'https://public-inbox.org/';
 
 sub new {
 	my ($class, $ctx, $cb) = @_;
@@ -87,7 +87,7 @@ sub _html_end {
 		'- ' . $desc,
 		$urls,
 		'Archived served using code from public-inbox:',
-		"\tgit clone $url",
+		"\tgit clone <a\nhref="$url">$url</a> public-inbox",
 	).'</pre></body></html>';
 }
 

  parent reply	other threads:[~2016-07-01  2:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  1:17 [PATCH 0/2] HTTPS smart git repository for our code Eric Wong
2016-07-01  1:17 ` [PATCH 1/2] githttpbackend: allow git to be a regular scalar string Eric Wong
2016-07-01  1:17 ` [PATCH 2/2] update git repo location to https:// using GitHTTPBackend.pm Eric Wong
2016-07-01  2:15 ` Eric Wong [this message]
2016-07-01  2:20   ` [PATCH 4/2] www_stream: fix stupid typo :x Eric Wong

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

  List information: https://public-inbox.org/README

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

  git send-email \
    --in-reply-to=20160701021522.GA31128@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=meta@public-inbox.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 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).