Merge branch 'improve/repo_head_update'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: app/models/project.rb
This commit is contained in:
commit
80c4657fa7
2 changed files with 6 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue