Public git read-only access via http
This commit is contained in:
parent
eb626edd3f
commit
4c6224aad1
10 changed files with 89 additions and 15 deletions
|
@ -3,6 +3,16 @@ module Grack
|
|||
attr_accessor :user, :project
|
||||
|
||||
def valid?
|
||||
# Find project by PATH_INFO from env
|
||||
if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a
|
||||
self.project = Project.find_with_namespace(m.last)
|
||||
return false unless project
|
||||
end
|
||||
|
||||
if @request.get? && project.public
|
||||
return true
|
||||
end
|
||||
|
||||
# Authentication with username and password
|
||||
login, password = @auth.credentials
|
||||
|
||||
|
@ -17,12 +27,6 @@ module Grack
|
|||
# Pass Gitolite update hook
|
||||
ENV['GL_BYPASS_UPDATE_HOOK'] = "true"
|
||||
|
||||
# Find project by PATH_INFO from env
|
||||
if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a
|
||||
self.project = Project.find_with_namespace(m.last)
|
||||
return false unless project
|
||||
end
|
||||
|
||||
# Git upload and receive
|
||||
if @request.get?
|
||||
validate_get_request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue