Decline push if repository does not exist

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-12-05 18:17:51 +02:00
parent 7cefd9c6ef
commit 4491a3d12b
No known key found for this signature in database
GPG Key ID: 161B5D6A44D3D88A
1 changed files with 12 additions and 3 deletions

View File

@ -49,8 +49,17 @@ module Gitlab
end
def push_access_check(user, project, changes)
return build_status_object(false, "You don't have access") unless user && user_allowed?(user)
return build_status_object(true) if changes.blank?
unless user && user_allowed?(user)
return build_status_object(false, "You don't have access")
end
if changes.blank?
return build_status_object(true)
end
unless project.repository.exists?
return build_status_object(false, "Repository does not exist")
end
changes = changes.lines if changes.kind_of?(String)
@ -79,7 +88,7 @@ module Gitlab
else
:push_code_to_protected_branches
end
elsif project.repository && project.repository.tag_names.include?(tag_name(ref))
elsif project.repository.tag_names.include?(tag_name(ref))
# Prevent any changes to existing git tag unless user has permissions
:admin_project
else