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>
        ServerAdmin [email protected]

        CustomLog /var/log/apache2/ combined
        ErrorLog /var/log/apache2/

        # 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;$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 ^/$;id2=%4 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob;hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree;h=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree;h=([^;]+);hb=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree;hb=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tree
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blobdiff;h=([^;]+);hp=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$;id=%3;id3=%5 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=commitdiff;h=([^;]+);hp=([^;]+)
        RewriteRule ^/$;id2=%3 [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=commitdiff;h=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=commit;h=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=shortlog;h=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=shortlog
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=log;h=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=log
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;h=([^;]+);hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;h=([^;]+);hb=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;hb=([^;]+);f=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=history;hb=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=tag;h=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob_plain;h=([^;]+);f=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=blob_plain;f=([^;]+)
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=rss
        RewriteRule ^/$ [R,L,NE]
        RewriteCond %{query_string} p=([^.]+)(\.git)*;a=summary
        RewriteRule ^/$ [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 ^/$ [R,L,NE]
        RewriteRule ^.* [R,L,NE]

Donations keep this site alive

  • Vasily Anonimov said, -> RSS -> http://cgit.freedesktop.orghttp// (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,


    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 ? 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:

    And here are the rules I ended up using:

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

    With Kind Regards,

Add A Comment