Commit 80c4657fa78eaf7d360e0f247243736387b5ce87
Exists in
master
and in
4 other branches
Merge branch 'improve/repo_head_update'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: app/models/project.rb
Showing
2 changed files
with
6 additions
and
7 deletions
Show diff stats
app/contexts/projects/update_context.rb
... | ... | @@ -10,13 +10,7 @@ module Projects |
10 | 10 | new_branch = params[:project].delete(:default_branch) |
11 | 11 | |
12 | 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 | 14 | end |
21 | 15 | |
22 | 16 | project.update_attributes(params[:project], as: role) | ... | ... |
app/models/project.rb
... | ... | @@ -482,4 +482,9 @@ class Project < ActiveRecord::Base |
482 | 482 | def unarchive! |
483 | 483 | update_attribute(:archived, false) |
484 | 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 | 490 | end | ... | ... |