Rewrite and improve git backend logic. Fix project movind. Raise exception to prevent unexpected issues

This commit is contained in:
Dmitriy Zaporozhets 2012-11-27 09:31:15 +03:00
parent 70bf7f6e19
commit f5551efdfd
20 changed files with 146 additions and 99 deletions

View file

@ -22,6 +22,7 @@ class Admin::GroupsController < AdminController
def create
@group = Group.new(params[:group])
@group.path = @group.name.dup.parameterize if @group.name
@group.owner = current_user
if @group.save

View file

@ -34,11 +34,16 @@ class ProjectsController < ProjectResourceController
end
def update
namespace_id = params[:project].delete(:namespace_id)
if namespace_id.present? and namespace_id.to_i != project.namespace_id
namespace = Namespace.find(namespace_id)
project.transfer(namespace)
if params[:project].has_key?(:namespace_id)
namespace_id = params[:project].delete(:namespace_id)
if namespace_id == Namespace.global_id and project.namespace.present?
# Transfer to global namespace from anyone
project.transfer(nil)
elsif namespace_id.present? and namespace_id.to_i != project.namespace_id
# Transfer to someone namespace
namespace = Namespace.find(namespace_id)
project.transfer(namespace)
end
end
respond_to do |format|