]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: allow cloning from the URL root, too
authorEric Wong <e@80x24.org>
Fri, 1 Jul 2016 02:09:45 +0000 (02:09 +0000)
committerEric Wong <e@80x24.org>
Fri, 1 Jul 2016 02:14:10 +0000 (02:14 +0000)
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
README
examples/public-inbox.psgi
lib/PublicInbox/GitHTTPBackend.pm
lib/PublicInbox/WwwStream.pm

index d151d272d0aea390d6f08260ef06fe7a8ce738b6..81aba766ce8ffebc78369535ec73ed13bdfff487 100644 (file)
@@ -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 ca4e2a86ed35b0f690d50c5e222d6c7b2af8ee47..f56d68d2307d284e5b17e5c4db59d3a2838d1767 100644 (file)
--- 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.
 
index a90a2bc3ae7544ebedcc5eb04d64b52750989231..11e2a6e73a51115db0442600bd96650804cdc176 100644 (file)
@@ -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);
index 4f58c6bbcb82a3e392793c3d765f11d8324fe0cf..b4851920fe04f55b51ede42fa6770b70982cf17e 100644 (file)
@@ -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);
 
index 97a6dc78815b1e5e4734a855303c1cf9c00948bf..87a461e18b831744535f93f5e4e2b8ce2bc2f4ae 100644 (file)
@@ -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>';
 }