|
41 | 41 | RewriteRule ^/ruby\.git/tree/(.*)$ https://github.com/ruby/ruby/tree/%1/$1 [R=302,L,NE,QSD] |
42 | 42 | RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{7,40}) |
43 | 43 | RewriteRule ^/ruby\.git/plain/(.*)$ https://github.com/ruby/ruby/raw/%1/$1 [R=302,L,NE,QSD] |
| 44 | + |
| 45 | + # Range diffs (id2= without id=) are the heaviest cgit operation. |
| 46 | + RewriteCond %{QUERY_STRING} (?:^|&)id2=([0-9a-fA-F]{7,40}) |
| 47 | + RewriteRule ^/ruby\.git/(?:diff|patch)(?:/.*)?$ https://github.com/ruby/ruby/compare/%1...master [R=302,L,NE,QSD] |
| 48 | + |
| 49 | + # Browse by ref (h=) -> GitHub, except branches under active |
| 50 | + # development which we still want to browse on cgit. |
| 51 | + RewriteCond %{QUERY_STRING} (?:^|&)h=(?!(?:master|ruby_3_[345]|ruby_4_0)(?:&|$))([^&]+) |
| 52 | + RewriteRule ^/ruby\.git/log(?:/.*)?$ https://github.com/ruby/ruby/commits/%1 [R=302,L,NE,QSD] |
| 53 | + RewriteCond %{QUERY_STRING} (?:^|&)h=(?!(?:master|ruby_3_[345]|ruby_4_0)(?:&|$))([^&]+) |
| 54 | + RewriteRule ^/ruby\.git/(?:commit|diff|patch)(?:/.*)?$ https://github.com/ruby/ruby/commit/%1 [R=302,L,NE,QSD] |
| 55 | + RewriteCond %{QUERY_STRING} (?:^|&)h=(?!(?:master|ruby_3_[345]|ruby_4_0)(?:&|$))([^&]+) |
| 56 | + RewriteRule ^/ruby\.git/tree/(.*)$ https://github.com/ruby/ruby/tree/%1/$1 [R=302,L,NE,QSD] |
| 57 | + RewriteCond %{QUERY_STRING} (?:^|&)h=(?!(?:master|ruby_3_[345]|ruby_4_0)(?:&|$))([^&]+) |
| 58 | + RewriteRule ^/ruby\.git/plain/(.*)$ https://github.com/ruby/ruby/raw/%1/$1 [R=302,L,NE,QSD] |
| 59 | + RewriteCond %{QUERY_STRING} !(?:^|&)h= |
44 | 60 | RewriteRule ^/ruby\.git/plain/(.*)$ https://github.com/ruby/ruby/raw/master/$1 [R=302,L,NE,QSD] |
45 | 61 | </VirtualHost> |
0 commit comments