Adjust all the redirects for the disappearance of cgit

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2017-08-03 15:49:56 +02:00
parent 8f05121798
commit f2015d75e1
4 changed files with 5 additions and 166 deletions

View file

@ -1,8 +1,3 @@
# Redirect requests to un-namespaced repos to their new namespaced home
RedirectMatch 302 "^/cgit/((?!(rpms|container|modules|test)).*)" "/cgit/rpms/$1"
Alias /cgit-data /usr/share/cgit
ScriptAlias /cgit /var/www/cgi-bin/cgit
<Directory "/usr/share/cgit">
Require all granted
</Directory>
RedirectMatch permanent "/cgit/rpms/$" "/"
Redirect /cgit/rpms/ /rpms/
Redirect permanent /cgit/ /

View file

@ -1,8 +1,6 @@
SetEnv GIT_PROJECT_ROOT /srv/git/repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
Alias /rpms /srv/git/repositories/rpms/
Alias /git /srv/git
<Directory "/usr/libexec/git-core*">
Options ExecCGI Indexes

View file

@ -1,154 +0,0 @@
RedirectMatch permanent ^/$ https://src.fedoraproject.org/cgit/
RewriteEngine on
# Use cgit and redirect (some) old gitweb-caching things
RewriteRule ^/cgit-data/(.*)$ /cgit-data/$1 [L,PT]
RewriteRule ^/cgit/(.*)$ /cgit/$1 [L,PT]
# blob
RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob/(.+)/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=blob;h=(.+);hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%5?id=%3;id2=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=blob;hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%4?id=%3 [R,L,NE]
RewriteCond %{query_string} p=(.+)(\.git);a=blob;f=(.+);h=(.+);hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%3?id=%4;id2=%5 [R,L,NE]
RewriteCond %{query_string} p=(.+)(\.git);a=blob;f=(.+);h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%3?id=%4 [R,L,NE]
# tree
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+)/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=tree;h=(.+);hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%5?id=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=tree;hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%4?id=%3 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+)/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=tree;h=(.+);hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/?id=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=tree;hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/?id=%3 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=tree
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/? [R,L,NE]
# commitdiff
RewriteCond %{REQUEST_URI} /(.+)(\.git)/commitdiff/(.+)/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=blobdiff;h=(.+);hp=(.+);hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/diff/%6?id2=%4;id=%3;id3=%5 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/commitdiff/(.+)/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=commitdiff;h=(.+);hp=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/diff/?id=%4;id2=%3 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/commitdiff/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=commitdiff;h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/diff/?id=%3 [R,L,NE]
# commit
RewriteCond %{REQUEST_URI} /(.+)(\.git)/commit/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=commit;h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/commit/?id=%3 [R,L,NE]
# summary
RewriteCond %{REQUEST_URI} /(.+)(\.git)/summary [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=summary
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/? [R,L,NE]
# shortlog
RewriteCond %{REQUEST_URI} /(.+)(\.git)/shortlog/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=shortlog;h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%3 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/shortlog [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=shortlog
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/? [R,L,NE]
# log
RewriteCond %{REQUEST_URI} /(.+)(\.git)/log/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=log;h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%3 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/log [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=log
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log? [R,L,NE]
# history
RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+)/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=history;h=(.+);hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%5?id=%4 [R,L,NE]
RewriteCond %{query_string} p=(.+)(\.git);a=history;f=(.+);h=(.+);hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%3?id=%4;id2=%5 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+):/(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%4?id=%3 [R,L,NE]
RewriteCond %{query_string} p=(.+)(\.git);a=history;f=(.+);h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%3?id=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+)/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=history;h=(.+);hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=history;hb=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%4?id=%3 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=history;hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%3 [R,L,NE]
# tag
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tag/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=tag;h=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tag/?id=%3 [R,L,NE]
# blob_plain
RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob_plain/(.+):/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;h=(.+);f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/plain/%4?id=%3 [R,L,NE]
RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;f=(.+);hb=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/plain/%3?id2=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob_plain/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;f=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/plain/%3 [R,L,NE]
# rss|atom
RewriteCond %{REQUEST_URI} /(.+)(\.git)/(rss|atom)/refs/heads/(.+) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=(rss|atom);h=refsheads/(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/atom?h=%4 [R,L,NE]
RewriteCond %{REQUEST_URI} /(.+)(\.git)/(rss|atom) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=(rss|atom)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/atom? [R,L,NE]
# snapshot
RewriteCond %{REQUEST_URI} /(.+)(\.git)/snapshot/(.+)(\.tar\.gz|\.tar\.bz2) [OR]
RewriteCond %{query_string} p=(.+)(\.git);a=snapshot;h=(.+);sf=(.+)
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/snapshot/%3.tar.gz [R,L,NE]
# base old gitweb project
RewriteCond %{REQUEST_URI} /gitweb/(.+)\.git.* [OR]
RewriteCond %{query_string} p=(.+)\.git.*
RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/? [R,L,NE]
# Fail safes incase nothing above matches, try at least to put the person in the project
#RewriteCond %{REQUEST_URI} /(.+)\.git.* [OR]
#RewriteCond %{query_string} p=(.+)\.git.*
#RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/? [R,L,NE]
# Or else in the root of cgit
#RewriteRule ^.* https://src.fedoraproject.org/cgit/ [R,L,NE]

View file

@ -324,8 +324,8 @@
notify:
- reload httpd
- name: install the CGit-related httpd redirect config
copy: src=redirect.conf dest=/etc/httpd/conf.d/dist-git/redirect.conf
- name: Remove the old cgit related redirect config
file: path=/etc/httpd/conf.d/dist-git/redirect.conf state=absent
tags:
- distgit
- cgit