RewriteEngine on

RewriteRule ^/git/ipsilon.git(.*)$ https://pagure.io/ipsilon.git$1 [L,R]
RewriteRule ^/git/rpkg.git(.*)$ https://pagure.io/rpkg.git$1 [L,R]
RewriteRule ^/git/weatheralert.git(.*)$ https://pagure.io/weatheralert.git$1 [L,R]
RewriteRule ^/git/create-tx-configuration.git(.*)$ https://pagure.io/create-tx-configuration.git$1 [L,R]
RewriteRule ^/git/kernel-tests.git(.*)$ https://pagure.io/kernel-tests.git$1 [L,R]
RewriteRule ^/git/elfutils.git$ https://sourceware.org/git/?p=elfutils.git;a=summary [L,R]

RewriteRule ^/c*git/389/ds.git(.*)$ https://pagure.io/389-ds-base [L,R]
RewriteRule ^/c*git/389/lib389.git(.*)$ https://pagure.io/lib389 [L,R]
RewriteRule ^/c*git/389/console.git(.*)$ https://pagure.io/389-console [L,R]
RewriteRule ^/c*git/389/ds-console.git(.*)$ https://pagure.io/389-ds-console [L,R]
RewriteRule ^/c*git/389/dsgw.git(.*)$ https://pagure.io/389-dsgw [L,R]
RewriteRule ^/c*git/389/admin.git(.*)$ https://pagure.io/389-admin [L,R] 
RewriteRule ^/c*git/389/adminutil.git(.*)$ https://pagure.io/389-adminutil [L,R]
RewriteRule ^/c*git/389/admin-console.git(.*)$ https://pagure.io/389-admin-console [L,R]

RewriteRule ^/c*git/idm-console-framework.git(.*)$ https://pagure.io/idm-console-framework [L,R]
RewriteRule ^/c*git/gss-ntlmssp.git(.*)$ https://pagure.io/gssntlmssp [L,R]
RewriteRule ^/c*git/mod_nss.git(.*)$ https://pagure.io/mod_nss [L,R]
RewriteRule ^/c*git/freeipa.git(.*)$ https://pagure.io/freeipa [L,R]
RewriteRule ^/c*git/certmonger.git(.*)$ https://pagure.io/certmonger [L,R]

RewriteCond %{REQUEST_URI} /cgit/sanlock\.git/commit/
RewriteCond %{query_string} id=(.+)$
RewriteRule ^/.*$ https://pagure.io/sanlock/c/%1 [R,L,NE]
RewriteRule ^/git/sanlock.git$ https://pagure.io/sanlock.git [L,R]

RewriteCond %{REQUEST_URI} /cgit/dlm\.git/commit/
RewriteCond %{query_string} id=(.+)$
RewriteRule ^/.*$ https://pagure.io/dlm/c/%1 [R,L,NE]
RewriteRule ^/git/dlm.git(.*)$ https://pagure.io/dlm.git$1 [L,R]

RewriteCond %{REQUEST_URI} /cgit/lvm2\.git/commit/
RewriteCond %{query_string} id=(.+)$
RewriteRule ^/.*$ https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=%1 [R,L,NE]
RewriteCond %{REQUEST_URI} /cgit/lvm2\.git/patch/
RewriteCond %{query_string} id=(.+)$
RewriteRule ^/.*$ https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=%1 [R,L,NE]
RewriteCond %{REQUEST_URI} /cgit/lvm2\.git(.*)$
RewriteRule ^/.*$ https://sourceware.org/git/?p=lvm2.git [R,L,NE]
RewriteRule ^/git/lvm2.git https://sourceware.org/git/?p=lvm2.git [L,R]

# redirect vdsm to ovirt git server - since ?p == querystring we have to match that sanely
RewriteCond %{QUERY_STRING} ^.*p=(.*vdsm\.git.*)$
RewriteRule ^.*$ http://gerrit.ovirt.org/gitweb\?p=%1 [R,L,NE]

RedirectMatch permanent ^/.* https://fedoraproject.org/wiki/Infrastructure/Fedorahosted-retirement
