summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/contexts/projects/update_context.rb8
-rw-r--r--app/models/project.rb5
2 files changed, 6 insertions, 7 deletions
diff --git a/app/contexts/projects/update_context.rb b/app/contexts/projects/update_context.rb
index 55a4a6abecb..ed0d451a31a 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 d389579b3a1..1bfc27d723d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -482,4 +482,9 @@ class Project < ActiveRecord::Base
def unarchive!
update_attribute(:archived, false)
end
+
+ def change_head(branch)
+ gitlab_shell.update_repository_head(self.path_with_namespace, branch)
+ reload_default_branch
+ end
end