Unverified Commit 80c4657f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'improve/repo_head_update'


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	app/models/project.rb
...@@ -10,13 +10,7 @@ def execute(role = :default) ...@@ -10,13 +10,7 @@ def execute(role = :default)
new_branch = params[:project].delete(:default_branch) new_branch = params[:project].delete(:default_branch)
if project.repository.exists? && new_branch != project.default_branch if project.repository.exists? && new_branch != project.default_branch
GitlabShellWorker.perform_async( project.change_head(new_branch)
:update_repository_head,
project.path_with_namespace,
new_branch
)
project.reload_default_branch
end end
project.update_attributes(params[:project], as: role) project.update_attributes(params[:project], as: role)
......
...@@ -482,4 +482,9 @@ def archive! ...@@ -482,4 +482,9 @@ def archive!
def unarchive! def unarchive!
update_attribute(:archived, false) update_attribute(:archived, false)
end end
def change_head(branch)
gitlab_shell.update_repository_head(self.path_with_namespace, branch)
reload_default_branch
end
end end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment