List for cgit developers and users
 help / color / mirror / Atom feed
From: mricon at kernel.org (Konstantin Ryabitsev)
Subject: CGI to transparently translate gitweb to cgit
Date: Wed, 17 Jun 2015 14:47:24 -0400	[thread overview]
Message-ID: <5581C0BC.1010808@kernel.org> (raw)
In-Reply-To: <55807E69.3060902@zytor.com>

Hello, all:

Peter Anvin wrote a CGI to transition from gitweb to cgit. I was
wondering if it makes sense to incorporate it into cgit as part of contrib?

http://git.zytor.com/users/hpa/cgit/gitweb2cgit.git/tree/gitweb2cgit.cgi

At least hopefully this will come in handy for someone so they don't
have to create terrible monstrosities with rewrite rules (like I did for
kernel.org).

Best,
-K

-------- Forwarded Message --------
Subject: Re: Migrating from gitweb to cgit
Date: Tue, 16 Jun 2015 12:52:09 -0700
From: H. Peter Anvin <hpa at zytor.com>
To: Konstantin Ryabitsev <mricon at kernel.org>

On 06/12/2015 05:26 AM, Konstantin Ryabitsev wrote:
> On 11/06/15 07:16 PM, H. Peter Anvin wrote:
>> Cool.  I ran into a set of transformation rules on the web earlier and
>> hacked up a CGI script (as I just don't trust RewriteEngine to do this
>> stuff sanely.)
>>
>> This is the latest version of it:
>>
>> http://git.zytor.com/users/hpa/cgit/gitweb2cgit.git/tree/gitweb2cgit.cgi
> 
> Forgot to ask -- how does it look like on the Apache side of things? I
> guess it ends up being a rewrite on the Apache side, which issues a
> redirect?

This is a bit more complicated than it otherwise would be, because I
explicitly wanted to avoid "gitweb" or "cgit" in URLs for whatever
reason, so the same namespace now contains legacy gitweb, cgit, and
http-cloning URLs.

Otherwise I wouldn't have had to use the rewriteengine at all and could
have gotten away with aliases.

<VirtualHost *:80>
ServerName git.zytor.com
ServerAlias git.nasm.us
DocumentRoot /var/lib/git
ErrorLog /var/log/httpd/git/error_log
CustomLog /var/log/httpd/git/access_log combined
RedirectPermanent /var/lib/git /
RedirectPermanent /pub/git /

SetEnv GIT_PROJECT_ROOT /var/lib/git
SetEnv GIT_HTTP_EXPORT_ALL

RewriteEngine on

Alias /cgit-data /usr/share/cgit
ScriptAlias /cgit /var/www/cgi-bin/cgit
ScriptAlias /robots.txt "/var/www/cgi-bin/robots.cgi"

RewriteCond "%{QUERY_STRING}" "^.*p=.*$"
RewriteRule ^/+$ /var/www/cgi-bin/gitweb2cgit.cgi [H=cgi-script]

ScriptAliasMatch ^/+$ /var/www/cgi-bin/cgit

ScriptAliasMatch ^/gitweb.cgi/*$ /var/www/cgi-bin/gitweb2cgit.cgi

AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$
/var/lib/git/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$
/var/lib/git/$1
ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
                        info/refs | \
                        objects/info/[^/]+ | \
                        git-upload-pack))$" \
        /usr/libexec/git-core/git-http-backend/$1
ScriptAliasMatch ^/+(.*)$ /var/www/cgi-bin/cgit/$1
</VirtualHost>


-- 
Konstantin Ryabitsev
Linux Foundation Collab Projects
Montr?al, Qu?bec




           reply	other threads:[~2015-06-17 18:47 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <55807E69.3060902@zytor.com>]

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=5581C0BC.1010808@kernel.org \
    --to=cgit@lists.zx2c4.com \
    /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 NNTP newsgroup(s).