Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb17
1 files changed, 5 insertions, 12 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 1f8e8b81015..95ba0973321 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1661,18 +1661,11 @@ class Project < ApplicationRecord
:visibility_level
end
- def change_head(branch)
- if repository.branch_exists?(branch)
- repository.before_change_head
- repository.raw_repository.write_ref('HEAD', "refs/heads/#{branch}")
- repository.copy_gitattributes(branch)
- repository.after_change_head
- ProjectCacheWorker.perform_async(self.id, [], [:commit_count])
- reload_default_branch
- else
- errors.add(:base, _("Could not change HEAD: branch '%{branch}' does not exist") % { branch: branch })
- false
- end
+ override :after_repository_change_head
+ def after_repository_change_head
+ ProjectCacheWorker.perform_async(self.id, [], [:commit_count])
+
+ super
end
def forked_from?(other_project)