diff --git a/app/contexts/projects/update_context.rb b/app/contexts/projects/update_context.rb index 55a4a6abecb29144ea49bfa27afc959e5b2ec826..ed0d451a31ad6a9e56850e47a1688ca893b4bc82 100644 --- a/app/contexts/projects/update_context.rb +++ b/app/contexts/projects/update_context.rb @@ -10,13 +10,7 @@ module Projects new_branch = params[:project].delete(:default_branch) if project.repository.exists? && new_branch != project.default_branch - GitlabShellWorker.perform_async( - :update_repository_head, - project.path_with_namespace, - new_branch - ) - - project.reload_default_branch + project.change_head(new_branch) end project.update_attributes(params[:project], as: role) diff --git a/app/models/project.rb b/app/models/project.rb index 506f34ca6b678c67b51b5d6c067f09d18e8cf247..5f0303dfb069bdadb70af33c9427291e70ecbeb3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -472,4 +472,9 @@ class Project < ActiveRecord::Base def visibility_level_field visibility_level end + + def change_head(branch) + gitlab_shell.update_repository_head(self.path_with_namespace, branch) + reload_default_branch + end end