Commit 80c4657fa78eaf7d360e0f247243736387b5ce87

Authored by Dmitriy Zaporozhets
2 parents f40ad6ce 28bb65f3

Merge branch 'improve/repo_head_update'

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

Conflicts:
	app/models/project.rb
app/contexts/projects/update_context.rb
@@ -10,13 +10,7 @@ module Projects @@ -10,13 +10,7 @@ module Projects
10 new_branch = params[:project].delete(:default_branch) 10 new_branch = params[:project].delete(:default_branch)
11 11
12 if project.repository.exists? && new_branch != project.default_branch 12 if project.repository.exists? && new_branch != project.default_branch
13 - GitlabShellWorker.perform_async(  
14 - :update_repository_head,  
15 - project.path_with_namespace,  
16 - new_branch  
17 - )  
18 -  
19 - project.reload_default_branch 13 + project.change_head(new_branch)
20 end 14 end
21 15
22 project.update_attributes(params[:project], as: role) 16 project.update_attributes(params[:project], as: role)
app/models/project.rb
@@ -482,4 +482,9 @@ class Project &lt; ActiveRecord::Base @@ -482,4 +482,9 @@ class Project &lt; ActiveRecord::Base
482 def unarchive! 482 def unarchive!
483 update_attribute(:archived, false) 483 update_attribute(:archived, false)
484 end 484 end
  485 +
  486 + def change_head(branch)
  487 + gitlab_shell.update_repository_head(self.path_with_namespace, branch)
  488 + reload_default_branch
  489 + end
485 end 490 end