Fix fpeople git https clone
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
parent
2ca1f29c58
commit
1dcd73d7ba
1 changed files with 46 additions and 149 deletions
|
@ -58,7 +58,12 @@ NameVirtualHost *:80
|
||||||
<Directory "/home/fedora/*/public_html">
|
<Directory "/home/fedora/*/public_html">
|
||||||
AllowOverride FileInfo AuthConfig Limit Indexes
|
AllowOverride FileInfo AuthConfig Limit Indexes
|
||||||
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
|
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
|
||||||
IndexOptions NameWidth=* FancyIndexing
|
#IndexOptions NameWidth=* FancyIndexing
|
||||||
|
Require all granted
|
||||||
|
Require method GET POST OPTIONS
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory "/home/fedora/*/public_git*">
|
||||||
Require all granted
|
Require all granted
|
||||||
Require method GET POST OPTIONS
|
Require method GET POST OPTIONS
|
||||||
</Directory>
|
</Directory>
|
||||||
|
@ -145,157 +150,37 @@ NameVirtualHost *:80
|
||||||
RewriteRule ^repos\.fedorapeople\.org/(.*) /project/repos/$1 [L]
|
RewriteRule ^repos\.fedorapeople\.org/(.*) /project/repos/$1 [L]
|
||||||
RewriteRule ^([a-z0-9-]+)\.fedorapeople\.org/(.*) /home/fedora/$1/public_html/$2 [L]
|
RewriteRule ^([a-z0-9-]+)\.fedorapeople\.org/(.*) /home/fedora/$1/public_html/$2 [L]
|
||||||
|
|
||||||
# Use cgit and redirect (some) old gitweb-caching things
|
# Begin http git clone
|
||||||
RewriteRule ^/cgit-data/(.*)$ /cgit-data/$1 [L,PT]
|
# First, deny write access
|
||||||
RewriteRule ^/cgit/(.*)$ /cgit/$1 [L,PT]
|
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
|
||||||
|
RewriteCond %{REQUEST_URI} /git-receive-pack$
|
||||||
|
RewriteRule ^/git/ - [E=AUTHREQUIRED:yes]
|
||||||
|
<Location /git>
|
||||||
|
<RequireAll>
|
||||||
|
Require not env AUTHREQUIRED
|
||||||
|
Require all granted
|
||||||
|
</RequireAll>
|
||||||
|
Options -Indexes +ExecCGI
|
||||||
|
</Location>
|
||||||
|
|
||||||
# blob
|
# Next up, determine which user owns this repo
|
||||||
RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob/(.+)/(.+):/(.+) [OR]
|
SetEnvIf Request_URI ^/git/([a-zA-Z0-9]*)/.* GIT_PROJECT_ROOT=/home/fedora/$1/public_git
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=blob;h=(.+);hb=(.+);f=(.+)
|
Header set X-GitProject "%{GIT_PROJECT_ROOT}e"
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/tree/%5?id=%3;id2=%4 [R,L,NE]
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob/(.+):/(.+) [OR]
|
# Let's serve objects and packs directly from apache, very performant!
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=blob;hb=(.+);f=(.+)
|
AliasMatch ^/git/([a-zA-Z0-9]*)/([a-zA-Z0-9]*)\.git(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /home/fedora/$1/public_git/$2.git/$3
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/tree/%4?id=%3 [R,L,NE]
|
AliasMatch ^/git/([a-zA-Z0-9]*)/([a-zA-Z0-9]*)\.git(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /home/fedora/$1/public_git/$2.git/$3
|
||||||
|
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=blob;f=(.+);h=(.+);hb=(.+)
|
# And now for the magic, let's run the git cgi script
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/tree/%3?id=%4;id2=%5 [R,L,NE]
|
ScriptAliasMatch \
|
||||||
|
"(?x)^/git/([a-zA-Z0-9]*)/(.*/(HEAD | \
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=blob;f=(.+);h=(.+)
|
info/refs | \
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/tree/%3?id=%4 [R,L,NE]
|
objects/(info/[^/]+ | \
|
||||||
|
[0-9a-f]{2}/[0-9a-f]{38} | \
|
||||||
# tree
|
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
|
||||||
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+)/(.+):/(.+) [OR]
|
git-(upload|receive)-pack))$" \
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=tree;h=(.+);hb=(.+);f=(.+)
|
/usr/libexec/git-core/git-http-backend/$2
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/tree/%5?id=%4?h=%3 [R,L,NE]
|
# End http git clone
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+):/(.+) [OR]
|
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=tree;hb=(.+);f=(.+)
|
|
||||||
RewriteRule ^/.*$ https://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.org/cgit/%1.git/? [R,L,NE]
|
|
||||||
|
|
||||||
# shortlog
|
|
||||||
RewriteCond %{REQUEST_URI} /(.+)(\.git)/shortlog/(.+) [OR]
|
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=shortlog;h=(.+)
|
|
||||||
RewriteRule ^/.*$ https://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.org/cgit/%1.git/log/%5?id=%4 [R,L,NE]
|
|
||||||
|
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=history;f=(.+);h=(.+);hb=(.+)
|
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/log/%3?id=%4;id2=%5 [R,L,NE]
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+):/(.+)
|
|
||||||
RewriteRule ^/.*$ https://fedorapeople.org/cgit/%1.git/log/%4?id=%3 [R,L,NE]
|
|
||||||
|
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=history;f=(.+);h=(.+)
|
|
||||||
RewriteRule ^/.*$ https://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.org/cgit/%1.git/plain/%4?id=%3 [R,L,NE]
|
|
||||||
|
|
||||||
RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;f=(.+);hb=(.+)
|
|
||||||
RewriteRule ^/.*$ https://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.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://fedorapeople.org/cgit/%1.git/snapshot/%3.tar.gz [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://fedorapeople.org/cgit/%1.git/? [R,L,NE]
|
|
||||||
|
|
||||||
# Or else in the root of cgit
|
|
||||||
RewriteRule ^/git/(.+)\.git$ /cgit/$1.git [L,PT]
|
|
||||||
RewriteRule ^/git/(.*)/$ /cgit/$1.git [L,PT]
|
|
||||||
RewriteRule ^/git/([^/]*)$ /cgit/$1.git [L,PT]
|
|
||||||
RewriteRule ^/gitweb /cgit/ [L,PT]
|
|
||||||
|
|
||||||
# for cgit clone repos
|
|
||||||
RewriteRule ^/gitrepos/(.*)/public_git/(.*)$ /~$1/git/$2 [L,PT]
|
|
||||||
|
|
||||||
<Directory /srv/people/site/userdefs>
|
<Directory /srv/people/site/userdefs>
|
||||||
Options IncludesNoExec
|
Options IncludesNoExec
|
||||||
|
@ -308,6 +193,18 @@ NameVirtualHost *:80
|
||||||
IndexOptions +XHTML +SuppressRules +SuppressHTMLPreamble
|
IndexOptions +XHTML +SuppressRules +SuppressHTMLPreamble
|
||||||
ServerSignature Off
|
ServerSignature Off
|
||||||
AddOutputFilter INCLUDES .html
|
AddOutputFilter INCLUDES .html
|
||||||
|
#SetEnvIf Request_URI "(?x)^/git/([^/]*)(.*)$" \
|
||||||
|
# GIT_PROJECT_ROOT=/home/fedora/$1/public_git
|
||||||
|
|
||||||
|
# this takes care of user directories
|
||||||
|
#ScriptAliasMatch \
|
||||||
|
# "(?x)^/git/([^/]*)(/.*/(HEAD | \
|
||||||
|
# info/refs | \
|
||||||
|
# objects/(info/[^/]+ | \
|
||||||
|
# [0-9a-f]{2}/[0-9a-f]{38} | \
|
||||||
|
# pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
|
||||||
|
# git-(upload|receive)-pack))$" \
|
||||||
|
# /usr/libexec/git-core/git-http-backend/$2
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
LoadModule deflate_module modules/mod_deflate.so
|
LoadModule deflate_module modules/mod_deflate.so
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue