cgit upgrade & gitweb retired

Posted by Benjamin Close on November 24, 2008 under FreeDesktop | 12 Comments to Read

With CGit v0.8 supporting, atom feeds, patch targets and also the clone-url option, it’s time to finally rid ourselves of the memory hungry gitweb. Hence cgit.fd.o has been upgraded and gitweb been pointed to cgit.fd.o. There’s also a bucket load of redirects in place to support this. Hence all the old gitweb url’s should correctly translate into cgit urls.

Here’s the url redirect list in case someone else wants to use cgit over gitweb (highly recommended)

<VirtualHost *:80>
        ServerName gitweb2.freedesktop.org
        ServerAdmin [email protected]

        CustomLog /var/log/apache2/gitweb.freedesktop.org-access.log combined
        ErrorLog /var/log/apache2/gitweb.freedesktop.org-error.log

        #
        # Redirects mapping gitweb -> cgit
        #
        # Gitweb uses get targets seperated by ;
        #
        # /?...;...;...
        #
        # p = Project
        # a = action ( blob, blob_plain, blobdiff, commitdiff, commit, shortlog, summary, tree, log, tag, history, rss)
        # h = SHA Hash
        # o = sort order
        # hb= SHA Hash Tree Base
        # hp= ?
        # pg= page
        # f= file/dir
        #
        # Cgit uses the following:
        #
        # /project/action/?...
        #
        # action ( commit, log, diff, tree, tag, patch  )
        #
        # id = SHA Hash
        # id2 = SHA Hash
        # h = head
        #
        # Translation rules
        #
        # Project is a straight redirect
        # ---
        # /?p=([^.]+).git;       http://cgit.freedesktop.org/$1/
        #
        # Action requires a mapping
        # ---
        # a=(blob|tree) /tree/
        # a=(blobdiff|commitdiff)       /diff/
        # a=commit      /commit/
        # a=(summary)   /
        # a=(shortlog|log|history)      /log/
        # a=tag         /tag/
        # a=blob_plain  /blob/
        # a=rss    ?No CGIT Equivilant?
        #
        # Targets require mapping
        # ---
        # h=([^;]+)     id=$1
        # f=([^;]+)     /$1
        # hb=([^;]+)    id2=$1
        # hp([^;]+      id=$1
        #
        # Now putting it all together
        #
        RewriteEngine On
        #RewriteLog /tmp/rewrite.log
        #RewriteLogLevel 5
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob;h=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/tree/%5?id=%3;id2=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob;hb=([^;]+);f=([^;]+)
        RewriteRule ^/$  http://cgit.freedesktop.org/%1/tree/%4?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree;h=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/tree/%5?id=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree;h=([^;]+);hb=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/tree/?id=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree;hb=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/tree/?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/tree/? [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blobdiff;h=([^;]+);hp=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/diff/%6?id2=%4;id=%3;id3=%5 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=commitdiff;h=([^;]+);hp=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/diff/?id=%4;id2=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=commitdiff;h=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/diff/?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=commit;h=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/commit/?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=shortlog;h=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=shortlog
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/? [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=log;h=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=log
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log? [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;h=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/%5?id=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;h=([^;]+);hb=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/?id=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/%4?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;hb=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/log/?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tag;h=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/tag/?id=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob_plain;h=([^;]+);f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/blob/%4?id=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob_plain;f=([^;]+)
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/blob/%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=rss
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/atom? [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=summary
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/? [R,L,NE]
        #
        # Fail safes incase nothing above matches, try at least to put the person in the project, els root of cgit
        RewriteCond %{query_string} p=([^.]+)(\.git)*.*
        RewriteRule ^/$ http://cgit.freedesktop.org/%1/? [R,L,NE]
        RewriteRule ^.* http://cgit.freedesktop.org/ [R,L,NE]
</VirtualHost>


Donations keep this site alive

  • Vasily Anonimov said,

    http://cgit.freedesktop.org/mesa/drm/log/?h=modesetting-gem -> RSS -> http://cgit.freedesktop.orghttp//cgit.freedesktop.org/mesa/drm/atom/?h=modesetting-gem (broken link). All branches RSS links are broken.

  • benjsc said,

    Thanks – Fixed!

  • Xake said,

    And now when that happened: what about those project that gitweb lists and cgit does not? Like devicekit*?

  • benjsc said,

    There is always bound to be some teething problems. I wasn’t aware they repos weren’t being listed in cgit.
    Problem fixed, DeviceKit/* is now listed in cgit

  • Mart Raudsepp said,

    The only time I actually used gitweb or the like is when wanting to look at what’s been pushed recently with full logs. I don’t see that simple thing possible with cgit. How can I see a paginated git log with cgit? The thing it claims as “log” is just a shortlog with the summary first line of the commit message shown, not the information git log provides (full commit log message, not just the first summary line).

  • Martin Olsson said,

    Hi,

    Thanks a million for upgrading cgit! I’ve been hoping someone would upgrade it for a long time now. Great work.

  • Sean said,

    I agree with Mart, gitweb made it a lot easier to see what’s been updated across all projects. It allowed sorting. Could you please drop in http://www.kryogenix.org/code/browser/sorttable/sorttable.js ? You just include the file and add the sortable class to the table on the index page, and voila, you can sort all columns. I’m sure upstream would like the patch, too.

    Dropping it for other tables and log views would be a bonus.

    Thank you!

  • benjsc said,

    I’ve now added sort by age functionality to cgit and sent the changes upstream. Though the sorttable code looks cool!

    Next on the to fix list is full log.

  • adrian said,

    The gitweb feature I miss is turning SHA1 object names in log messages into hyperlinks. Autolinkification of http URLs and bugzilla bugs would also be nice.

  • Benjamin Close said,

    Hmm, interesting didn’t know that feature existed in gitweb. Could you provide a URL to show an example? I’ll see what I can do to add it (just need to know what it looks like 🙂

  • Daniel Svensson said,

    Thanks a bunch for this one!

  • ao2 said,

    Hi Benjamin,

    thanks for sharing those URL rewriting rules, they were not perfect for me as I have gitweb clean URLs enabled but they were a good base to start with.

    BTW, here’s a post about the modification I needed:
    http://ao2.it/blog/2011/05/06/migrate-gitweb-cgit-url-rewrite-rules

    And here are the rules I ended up using:
    http://git.ao2.it/gitweb_cgit_migration.git/tree

    Maybe this can be useful for someone else’s migration.

    With Kind Regards,
    Antonio

Add A Comment

*